Changeset 7286 in orxonox.OLD for trunk/src/story_entities/game_world.cc
- Timestamp:
- Apr 13, 2006, 10:33:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r7283 r7286 20 20 #include "game_world_data.h" 21 21 22 #include "util/loading/resource_manager.h"23 22 #include "state.h" 24 23 #include "class_list.h" … … 27 26 #include "util/loading/game_loader.h" 28 27 29 #include "p_node.h"30 #include "world_entity.h"31 28 #include "player.h" 32 29 #include "camera.h" 33 30 #include "environment.h" 34 31 #include "terrain.h" 35 #include "test_entity.h"36 #include "terrain.h"37 32 #include "md2Model.h" 38 #include "world_entities/projectiles/projectile.h"39 #include "npcs/npc_test1.h"40 33 #include "playable.h" 41 34 … … 47 40 #include "shell_command.h" 48 41 42 #include "util/loading/resource_manager.h" 49 43 #include "graphics_engine.h" 50 44 #include "event_handler.h" … … 53 47 #include "network_manager.h" 54 48 #include "physics_engine.h" 55 #include "fields.h"56 49 57 50 #include "glmenu_imagescreen.h" … … 103 96 PRINTF(4)("Deleted GameWorld\n"); 104 97 105 if (this->audioThread != NULL) 106 SDL_KillThread(this->audioThread); 98 this->bRunning = false; 99 this->unloadData(); 100 101 if( this->dataTank) 102 delete this->dataTank; 107 103 } 108 104 … … 140 136 GameWorld* gw = (GameWorld*)gameWorld; 141 137 printf("STARTIG AUDIO THREAD\n"); 138 if(gw->dataTank != NULL && gw->dataTank->music != NULL) 139 gw->dataTank->music->playback(); 140 SDL_Delay(100); 142 141 while (gw->bRunning) 143 142 { 144 if(gw->dataTank->music != NULL) 145 gw->dataTank->music->playback(); 143 printf("PLAYBACK\n"); 144 ClassList::debug(3, CL_SOUND_OGG_PLAYER); 145 if(gw->dataTank != NULL && gw->dataTank->music != NULL) 146 gw->dataTank->music->update(); 146 147 SDL_Delay(5); 147 148 } 148 printf("E ndthe AudioThread\n");149 printf("END the AudioThread\n"); 149 150 } 150 151 … … 168 169 } 169 170 170 TiXmlDocument * XMLDoc = newTiXmlDocument( getLoadFile());171 TiXmlDocument XMLDoc = TiXmlDocument( getLoadFile()); 171 172 // load the xml world file for further loading 172 if( !XMLDoc->LoadFile()) 173 { 174 PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getLoadFile().c_str(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol()); 175 delete XMLDoc; 173 if( !XMLDoc.LoadFile()) 174 { 175 PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc.ErrorDesc(), this->getLoadFile().c_str(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol()); 176 176 return (ErrorMessage){213,"XML File parsing error","GameWorld::load()"}; 177 177 } 178 178 // check basic validity 179 TiXmlElement* root = XMLDoc ->RootElement();179 TiXmlElement* root = XMLDoc.RootElement(); 180 180 assert( root != NULL); 181 181 if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile")) … … 183 183 // report an error 184 184 PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n"); 185 delete XMLDoc;186 185 return (ErrorMessage){213,"Path not a WorldDataFile","GameWorld::load()"}; 187 186 } … … 190 189 this->dataXML = (TiXmlElement*)root->Clone(); 191 190 192 delete XMLDoc;193 191 this->releaseLoadScreen(); 194 192 } … … 201 199 { 202 200 delete this->shell; 203 PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n"); 201 this->shell = NULL; 202 PRINTF(0)("GameWorld::~unloadData() - unloading the current GameWorld %s::%s\n", this->getClassName(), this->getName()); 203 204 if (this->audioThread != NULL) 205 { 206 this->bRunning = false; 207 SDL_WaitThread(this->audioThread, NULL); 208 this->audioThread = NULL; 209 } 210 211 ClassList::debug( 3, CL_GAME_WORLD_DATA); 204 212 205 213 this->dataTank->unloadData(); … … 207 215 State::setCurrentStoryEntity(NULL); 208 216 if (this->dataXML) 217 { 209 218 delete this->dataXML; 219 this->dataXML = NULL; 220 } 210 221 } 211 222 … … 233 244 PRINTF(3)("GameWorld::stop() - got stop signal\n"); 234 245 this->bRunning = false; 235 236 // SDL_KillThread(this->audioThread);237 this->audioThread = NULL;238 246 } 239 247 … … 396 404 PNode::getNullParent()->updateNode (this->dtS); 397 405 SoundEngine::getInstance()->update(); 398 399 if (this->dataTank->music != NULL)400 this->dataTank->music->update();401 406 } 402 407
Note: See TracChangeset
for help on using the changeset viewer.