| 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: Patrick Boenzli | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD | 
|---|
| 16 |  | 
|---|
| 17 |  | 
|---|
| 18 | #include "single_player_world.h" | 
|---|
| 19 | #include "single_player_world_data.h" | 
|---|
| 20 |  | 
|---|
| 21 | #include "state.h" | 
|---|
| 22 | #include "class_list.h" | 
|---|
| 23 |  | 
|---|
| 24 | #include "load_param.h" | 
|---|
| 25 | #include "fast_factory.h" | 
|---|
| 26 | #include "factory.h" | 
|---|
| 27 |  | 
|---|
| 28 | #include "world_entity.h" | 
|---|
| 29 | #include "npcs/npc_test1.h" | 
|---|
| 30 |  | 
|---|
| 31 |  | 
|---|
| 32 | using namespace std; | 
|---|
| 33 |  | 
|---|
| 34 |  | 
|---|
| 35 | //! This creates a Factory to fabricate a SinglePlayerWorld | 
|---|
| 36 | CREATE_FACTORY(SinglePlayerWorld, CL_SINGLE_PLAYER_WORLD); | 
|---|
| 37 |  | 
|---|
| 38 |  | 
|---|
| 39 |  | 
|---|
| 40 | SinglePlayerWorld::SinglePlayerWorld(const TiXmlElement* root) | 
|---|
| 41 |   : GameWorld(root) | 
|---|
| 42 | { | 
|---|
| 43 |   this->setClassID(CL_SINGLE_PLAYER_WORLD, "SinglePlayerWorld"); | 
|---|
| 44 |   this->setName("SinglePlayerWorld uninitialized"); | 
|---|
| 45 |  | 
|---|
| 46 |   this->dataTank = new SinglePlayerWorldData(); | 
|---|
| 47 |  | 
|---|
| 48 |   this->loadParams(root); | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 | /** | 
|---|
| 53 |  *  remove the SinglePlayerWorld from memory | 
|---|
| 54 |  * | 
|---|
| 55 |  *  delete everything explicitly, that isn't contained in the parenting tree! | 
|---|
| 56 |  *  things contained in the tree are deleted automaticaly | 
|---|
| 57 |  */ | 
|---|
| 58 | SinglePlayerWorld::~SinglePlayerWorld () | 
|---|
| 59 | { | 
|---|
| 60 |   PRINTF(3)("SinglePlayerWorld::~SinglePlayerWorld() - deleting current world\n"); | 
|---|
| 61 |  | 
|---|
| 62 |   if( this->dataTank) | 
|---|
| 63 |     delete this->dataTank; | 
|---|
| 64 | } | 
|---|
| 65 |  | 
|---|
| 66 |  | 
|---|
| 67 | /** | 
|---|
| 68 |  * loads the parameters of a SinglePlayerWorld from an XML-element | 
|---|
| 69 |  * @param root the XML-element to load from | 
|---|
| 70 |  */ | 
|---|
| 71 | void SinglePlayerWorld::loadParams(const TiXmlElement* root) | 
|---|
| 72 | { | 
|---|
| 73 |   GameWorld::loadParams(root); | 
|---|
| 74 |  | 
|---|
| 75 |   PRINTF(4)("Loaded SinglePlayerWorld specific stuff\n"); | 
|---|
| 76 | } | 
|---|
| 77 |  | 
|---|