Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3525 was 3525, checked in by chris, 19 years ago

orxonox/branches/levelloader: removed excess class usage adn messed with makefile definitions

File size: 1.7 KB
Line 
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"
20
21using namespace std;
22
23/*  --------------------------------------------------
24*                Factory
25*   --------------------------------------------------
26*/
27
28/**
29   \brief constructor
30   
31   set everything to zero and define classname
32*/
33Factory::Factory ()
34{
35        classname = "NULL"
36        next = NULL;
37}
38
39/**
40   \brief constructor
41   
42   clear the Q
43*/
44Factory::~Factory ()
45{
46        if( next != NULL)       delete next;
47}
48
49
50/**
51   \brief generates the associated object from data
52*/
53BaseObject* ObjectFactory::fabricate( TiXmlElement* data)
54{
55        return NULL;
56}
57
58/**
59   \brief make this particular factory known to the LevelFactory
60*/
61void Factory::initialize()
62{
63        GameLoader* gl = GameLoader::getInstance();
64        gl->registerFactory( this);
65}
66
67/**
68   \brief add a Factory to the Q
69*/
70void Factory::registerFactory( Factory* factory)
71{
72        if( next == NULL) setNext( factory);
73        else next->registerFactory( factory);
74}
75
76const char* grabParameter( TiXmlElement* root, const char* name)
77{
78        TiXmlElement* element;
79        TiXmlNode* node;
80       
81        assert( root != NULL);
82        assert( name != NULL);
83       
84        element = root->FirstChildElement( name);
85        if( element == NULL) return NULL;
86       
87        node = element->FirstChild();
88        while( node != NULL)
89        {
90                if( node->Type() == TEXT) return node->Value();
91                node = node->NextChild();
92        }
93        return NULL;
94}
95
Note: See TracBrowser for help on using the repository browser.