Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3517 was 3504, checked in by chris, 20 years ago

orxonox/branches/levelloader: forgot to add all files and removed the outdated

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"
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.