Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/levelloader/src/factory.cc @ 4080

Last change on this file since 4080 was 3542, checked in by chris, 20 years ago

orxonox/branches/levelloader: First incarnation of a debugworld loaded from a XML-File in place, compilability in place, all necessary basic loading constuctors in place. Unfortunately the code still generates interferences with the old hardcoded debugworld resulting in SegFault crash.

File size: 1.7 KB
RevLine 
[3504]1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Christian Meyer
15   co-programmer: ...
16*/
17
18
19#include "factory.h"
[3530]20#include "game_loader.h"
[3504]21
22using namespace std;
23
24/*  --------------------------------------------------
25*                Factory
26*   --------------------------------------------------
27*/
28
29/**
30   \brief constructor
31   
32   set everything to zero and define classname
33*/
34Factory::Factory ()
35{
[3530]36        classname = "NULL";
[3504]37        next = NULL;
38}
39
40/**
[3530]41   \brief destructor
[3504]42   
43   clear the Q
44*/
45Factory::~Factory ()
46{
47        if( next != NULL)       delete next;
48}
49
50
51/**
52   \brief generates the associated object from data
53*/
[3530]54BaseObject* Factory::fabricate( TiXmlElement* data)
[3504]55{
56        return NULL;
57}
58
59/**
60   \brief make this particular factory known to the LevelFactory
61*/
62void Factory::initialize()
63{
[3530]64        assert( classname != NULL);
[3504]65        GameLoader* gl = GameLoader::getInstance();
66        gl->registerFactory( this);
67}
68
69/**
70   \brief add a Factory to the Q
71*/
72void Factory::registerFactory( Factory* factory)
73{
74        if( next == NULL) setNext( factory);
75        else next->registerFactory( factory);
76}
77
[3525]78const char* grabParameter( TiXmlElement* root, const char* name)
[3504]79{
[3525]80        TiXmlElement* element;
81        TiXmlNode* node;
[3504]82       
83        assert( root != NULL);
84        assert( name != NULL);
85       
86        element = root->FirstChildElement( name);
87        if( element == NULL) return NULL;
88       
89        node = element->FirstChild();
90        while( node != NULL)
91        {
[3530]92                if( node->ToText()) return node->Value();
93                node = node->NextSibling();
[3504]94        }
95        return NULL;
96}
97
Note: See TracBrowser for help on using the repository browser.