Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/levelLoader.tmp/src/util/levelLoader/factory.cc @ 3901

Last change on this file since 3901 was 3901, checked in by bensch, 19 years ago

orxonox/branches/levelLoader.tmp: temporaty

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#include "game_loader.h"
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{
36        classname = "NULL";
37        next = NULL;
38}
39
40/**
41   \brief destructor
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*/
54BaseObject* Factory::fabricate( TiXmlElement* data)
55{
56        return NULL;
57}
58
59/**
60   \brief make this particular factory known to the LevelFactory
61*/
62void Factory::initialize()
63{
64        assert( classname != NULL);
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
78const char* grabParameter( TiXmlElement* root, const char* name)
79{
80        TiXmlElement* element;
81        TiXmlNode* node;
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        {
92                if( node->ToText()) return node->Value();
93                node = node->NextSibling();
94        }
95        return NULL;
96}
97
Note: See TracBrowser for help on using the repository browser.