Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/util/loading/factory.cc @ 4492

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

orxonox/trunk: importer works again

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