/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Christian Meyer co-programmer: Benjamin Grauer */ #include "factory.h" #include "game_loader.h" using namespace std; /* -------------------------------------------------- * Factory * -------------------------------------------------- */ /** * constructor set everything to zero and define factoryName */ Factory::Factory (const char* factoryName) { this->setClassID(CL_FACTORY, "Factory"); this->setName(factoryName); this->next = NULL; Factory::registerFactory(this); } /** a reference to the First Factory */ Factory* Factory::first = NULL; /** * destructor clear the Q */ Factory::~Factory () { // printf("%s\n", this->factoryName); // Factory* tmpDel = this->next; // this->next = NULL; if (this->next) delete this->next; } /** * add a Factory to the Factory Queue * @param factory a Factory to be registered */ void Factory::registerFactory( Factory* factory) { assert( factory != NULL); PRINTF(4)("Registered factory for '%s'\n", factory->getName()); if( Factory::first == NULL) Factory::first = factory; else { Factory* tmpFac = Factory::first; while( tmpFac->next != NULL) { tmpFac = tmpFac->next; } tmpFac->setNext(factory); } }