Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7287 in orxonox.OLD for trunk/src/story_entities/game_world.cc


Ignore:
Timestamp:
Apr 13, 2006, 10:41:48 PM (18 years ago)
Author:
bensch
Message:

merged back with:
svn merge . . -rHEAD:PREV

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/game_world.cc

    r7286 r7287  
    2020#include "game_world_data.h"
    2121
     22#include "util/loading/resource_manager.h"
    2223#include "state.h"
    2324#include "class_list.h"
     
    2627#include "util/loading/game_loader.h"
    2728
     29#include "p_node.h"
     30#include "world_entity.h"
    2831#include "player.h"
    2932#include "camera.h"
    3033#include "environment.h"
    3134#include "terrain.h"
     35#include "test_entity.h"
     36#include "terrain.h"
    3237#include "md2Model.h"
     38#include "world_entities/projectiles/projectile.h"
     39#include "npcs/npc_test1.h"
    3340#include "playable.h"
    3441
     
    4047#include "shell_command.h"
    4148
    42 #include "util/loading/resource_manager.h"
    4349#include "graphics_engine.h"
    4450#include "event_handler.h"
     
    4753#include "network_manager.h"
    4854#include "physics_engine.h"
     55#include "fields.h"
    4956
    5057#include "glmenu_imagescreen.h"
     
    96103  PRINTF(4)("Deleted GameWorld\n");
    97104
    98   this->bRunning = false;
    99   this->unloadData();
    100 
    101   if( this->dataTank)
    102     delete this->dataTank;
     105  if (this->audioThread != NULL)
     106    SDL_KillThread(this->audioThread);
    103107}
    104108
     
    136140  GameWorld* gw = (GameWorld*)gameWorld;
    137141  printf("STARTIG AUDIO THREAD\n");
    138   if(gw->dataTank != NULL && gw->dataTank->music != NULL)
    139     gw->dataTank->music->playback();
    140   SDL_Delay(100);
    141142  while (gw->bRunning)
    142143  {
    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();
     144    if(gw->dataTank->music != NULL)
     145      gw->dataTank->music->playback();
    147146    SDL_Delay(5);
    148147  }
    149   printf("END the AudioThread\n");
     148  printf("End the AudioThread\n");
    150149}
    151150
     
    169168  }
    170169
    171   TiXmlDocument XMLDoc = TiXmlDocument( getLoadFile());
     170  TiXmlDocument* XMLDoc = new TiXmlDocument( getLoadFile());
    172171  // load the xml world file for further loading
    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());
     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;
    176176    return (ErrorMessage){213,"XML File parsing error","GameWorld::load()"};
    177177  }
    178178  // check basic validity
    179   TiXmlElement* root = XMLDoc.RootElement();
     179  TiXmlElement* root = XMLDoc->RootElement();
    180180  assert( root != NULL);
    181181  if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile"))
     
    183183    // report an error
    184184    PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
     185    delete XMLDoc;
    185186    return (ErrorMessage){213,"Path not a WorldDataFile","GameWorld::load()"};
    186187  }
     
    189190  this->dataXML = (TiXmlElement*)root->Clone();
    190191
     192  delete XMLDoc;
    191193  this->releaseLoadScreen();
    192194}
     
    199201{
    200202  delete this->shell;
    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);
     203  PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n");
    212204
    213205  this->dataTank->unloadData();
     
    215207  State::setCurrentStoryEntity(NULL);
    216208  if (this->dataXML)
    217   {
    218209    delete this->dataXML;
    219     this->dataXML = NULL;
    220   }
    221210}
    222211
     
    244233  PRINTF(3)("GameWorld::stop() - got stop signal\n");
    245234  this->bRunning = false;
     235
     236//  SDL_KillThread(this->audioThread);
     237  this->audioThread = NULL;
    246238}
    247239
     
    404396  PNode::getNullParent()->updateNode (this->dtS);
    405397  SoundEngine::getInstance()->update();
     398
     399  if (this->dataTank->music != NULL)
     400    this->dataTank->music->update();
    406401}
    407402
Note: See TracChangeset for help on using the changeset viewer.