Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: more load-params for Particles

File size: 1.9 KB
RevLine 
[4597]1/*
[3940]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
[4250]13   co-programmer: Benjamin Grauer
[3940]14*/
15
16
17#include "factory.h"
18#include "game_loader.h"
19
20using namespace std;
21
22/*  --------------------------------------------------
[4597]23 *               Factory
[4003]24 *   --------------------------------------------------
25 */
[3940]26
27/**
28   \brief constructor
[4597]29
[4020]30   set everything to zero and define factoryName
[3940]31*/
[4487]32Factory::Factory (const char* factoryName)
[3940]33{
[4597]34  this->setClassID(CL_FACTORY, "Factory");
35  this->setName(factoryName);
36
[4020]37  this->factoryName = NULL;
[4487]38  this->setFactoryName(factoryName);
[4003]39  next = NULL;
[4597]40
[4003]41  initialize();
[3940]42}
43
44/**
45   \brief destructor
[4597]46
[3940]47   clear the Q
48*/
49Factory::~Factory ()
50{
[4020]51  //  printf("%s\n", this->factoryName);
[4004]52  //  Factory* tmpDel = this->next;
53  //  this->next = NULL;
54  if (this->next)
55    delete this->next;
[4487]56
57  if (this->factoryName)
58    delete []this->factoryName;
[3940]59}
60
[4487]61/**
62   \brief sets the name of this factory
63*/
64void Factory::setFactoryName(const char* factoryName)
[4004]65{
[4487]66  if (this->factoryName)
67    delete this->factoryName;
68  this->factoryName = new char[strlen(factoryName)+1];
69  strcpy(this->factoryName, factoryName);
[4004]70}
71
72
[3940]73/**
74   \brief generates the associated object from data
75*/
[4253]76BaseObject* Factory::fabricate(const TiXmlElement* data)
[3940]77{
[4003]78  return NULL;
[3940]79}
80
81/**
82   \brief make this particular factory known to the LevelFactory
83*/
84void Factory::initialize()
85{
[4725]86#ifdef IS_ORXONOX
87  GameLoader::getInstance()->registerFactory( this);
88#endif /* IS_ORXONOX */
[3940]89}
90
91/**
92   \brief add a Factory to the Q
93*/
94void Factory::registerFactory( Factory* factory)
95{
[4003]96  if( next == NULL) setNext( factory);
97  else next->registerFactory( factory);
[3940]98}
99
Note: See TracBrowser for help on using the repository browser.