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 | |
---|
20 | using namespace std; |
---|
21 | |
---|
22 | /* -------------------------------------------------- |
---|
23 | * Factory |
---|
24 | * -------------------------------------------------- |
---|
25 | */ |
---|
26 | |
---|
27 | /** |
---|
28 | \brief constructor |
---|
29 | |
---|
30 | set everything to zero and define factoryName |
---|
31 | */ |
---|
32 | Factory::Factory (const char* factoryName) |
---|
33 | { |
---|
34 | this->setClassID(CL_FACTORY, "Factory"); |
---|
35 | this->setName(factoryName); |
---|
36 | |
---|
37 | if (Factory::first == NULL) |
---|
38 | Factory::first = this; |
---|
39 | next = NULL; |
---|
40 | |
---|
41 | initialize(); |
---|
42 | } |
---|
43 | |
---|
44 | Factory* Factory::first = NULL; |
---|
45 | |
---|
46 | /** |
---|
47 | \brief destructor |
---|
48 | |
---|
49 | clear the Q |
---|
50 | */ |
---|
51 | Factory::~Factory () |
---|
52 | { |
---|
53 | // printf("%s\n", this->factoryName); |
---|
54 | // Factory* tmpDel = this->next; |
---|
55 | // this->next = NULL; |
---|
56 | if (this->next) |
---|
57 | delete this->next; |
---|
58 | } |
---|
59 | |
---|
60 | /** |
---|
61 | \brief make this particular factory known to the LevelFactory |
---|
62 | */ |
---|
63 | void Factory::initialize() |
---|
64 | { |
---|
65 | GameLoader::getInstance()->registerFactory( this); |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | \brief add a Factory to the Q |
---|
70 | */ |
---|
71 | void Factory::registerFactory( Factory* factory) |
---|
72 | { |
---|
73 | if( next == NULL) setNext( factory); |
---|
74 | else next->registerFactory( factory); |
---|
75 | } |
---|
76 | |
---|
Note: See
TracBrowser
for help on using the repository browser.