Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/story_entities/network_world.cc @ 6413

Last change on this file since 6413 was 6345, checked in by bensch, 19 years ago

orxonox/trunk: tried to merge the old world to the new one… this was not too good

File size: 21.1 KB
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: Patrick Boenzli
13   co-programmer: Christian Meyer
14   co-programmer: Benjamin Grauer
15*/
16
17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
18
19#include "network_world.h"
20
21#include "shell_command.h"
22#include "resource_manager.h"
23#include "state.h"
24
25#include "p_node.h"
26#include "world_entity.h"
27#include "player.h"
28#include "camera.h"
29#include "environment.h"
30#include "terrain.h"
31
32#include "test_entity.h"
33#include "terrain.h"
34#include "light.h"
35#include "load_param.h"
36#include "shell.h"
37
38#include "fast_factory.h"
39#include "animation_player.h"
40#include "particle_engine.h"
41#include "graphics_engine.h"
42#include "physics_engine.h"
43#include "fields.h"
44
45#include "md2Model.h"
46
47#include "glmenu_imagescreen.h"
48#include "game_loader.h"
49
50#include "animation3d.h"
51
52#include "substring.h"
53
54#include "factory.h"
55
56#include "weapons/projectile.h"
57#include "event_handler.h"
58#include "sound_engine.h"
59#include "ogg_player.h"
60
61#include "class_list.h"
62
63#include "cd_engine.h"
64#include "npcs/npc_test1.h"
65#include "shader.h"
66
67#include "playable.h"
68#include "network_manager.h"
69#include "network_game_manager.h"
70#include "playable.h"
71
72
73SHELL_COMMAND(speed, NetworkWorld, setSpeed);
74SHELL_COMMAND(togglePNodeVisibility, NetworkWorld, togglePNodeVisibility);
75SHELL_COMMAND(toggleBVVisibility, NetworkWorld, toggleBVVisibility);
76
77using namespace std;
78
79//! This creates a Factory to fabricate a NetworkWorld
80CREATE_FACTORY(NetworkWorld, CL_WORLD);
81
82NetworkWorld::NetworkWorld(const TiXmlElement* root)
83{
84  this->constuctorInit("", -1);
85  this->path = NULL;
86
87  this->loadParams(root);
88}
89
90/**
91 *  remove the NetworkWorld from memory
92 *
93 *  delete everything explicitly, that isn't contained in the parenting tree!
94 *  things contained in the tree are deleted automaticaly
95 */
96NetworkWorld::~NetworkWorld ()
97{
98  delete this->shell;
99  PRINTF(3)("NetworkWorld::~NetworkWorld() - deleting current world\n");
100
101  delete this->localPlayer;
102
103  // delete all the initialized Engines.
104  FastFactory::flushAll(true);
105  delete LightManager::getInstance();
106  delete ParticleEngine::getInstance();
107  delete AnimationPlayer::getInstance();
108  delete PhysicsEngine::getInstance();
109
110  // external engines initialized by the orxonox-class get deleted
111  SoundEngine::getInstance()->flushAllBuffers();
112  SoundEngine::getInstance()->flushAllSources();
113
114  if (State::getObjectManager() == &this->objectManager)
115    State::setObjectManager(NULL);
116  // erease everything that is left.
117  delete PNode::getNullParent();
118
119  //secondary cleanup of PNodes;
120  const std::list<BaseObject*>* nodeList = ClassList::getList(CL_PARENT_NODE);
121  if (nodeList != NULL)
122    while (!nodeList->empty())
123      delete nodeList->front();
124
125  Shader::suspendShader();
126
127  // unload the resources !!
128  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
129}
130
131/**
132 * initializes the world.
133 * @param name the name of the world
134 * @param worldID the ID of this world
135 *
136 * set all stuff here that is world generic and does not use to much memory
137 * because the real init() function StoryEntity::init() will be called
138 * shortly before start of the game.
139 * since all worlds are initiated/referenced before they will be started.
140 * NO LEVEL LOADING HERE - NEVER!
141*/
142void NetworkWorld::constuctorInit(const char* name, int worldID)
143{
144  this->setClassID(CL_WORLD, "NetworkWorld");
145  PRINTF(0)("START\n");
146
147  this->setName(name);
148  this->gameTime = 0.0f;
149  this->setSpeed(1.0);
150  this->music = NULL;
151  this->shell = NULL;
152  this->localPlayer = NULL;
153  this->localCamera = NULL;
154
155  this->showPNodes = false;
156  this->showBV = false;
157}
158
159/**
160 * loads the parameters of a NetworkWorld from an XML-element
161 * @param root the XML-element to load from
162 */
163void NetworkWorld::loadParams(const TiXmlElement* root)
164{
165  PRINTF(4)("Creating a NetworkWorld\n");
166
167  LoadParam(root, "identifier", this, NetworkWorld, setStoryID)
168    .describe("Sets the StoryID of this world");
169
170  LoadParam(root, "nextid", this, NetworkWorld, setNextStoryID)
171    .describe("Sets the ID of the next world");
172
173  LoadParam(root, "path", this, NetworkWorld, setPath)
174    .describe("The Filename of this NetworkWorld (relative from the data-dir)");
175}
176
177/**
178 * this is executed just before load
179 *
180 * since the load function sometimes needs data, that has been initialized
181 * before the load and after the proceeding storyentity has finished
182*/
183ErrorMessage NetworkWorld::preLoad()
184{
185  State::setObjectManager(&this->objectManager);
186  this->cycle = 0;
187
188  /* init the world interface */
189  this->shell = new Shell();
190
191  LightManager::getInstance();
192  PNode::getNullParent();
193
194  AnimationPlayer::getInstance(); // initializes the animationPlayer
195  ParticleEngine::getInstance();
196  PhysicsEngine::getInstance();
197
198  this->localCamera = new Camera();
199  this->localCamera->setName ("NetworkWorld-Camera");
200
201  State::setCamera(this->localCamera, this->localCamera->getTarget());
202
203  GraphicsEngine::getInstance()->displayFPS(true);
204  this->displayLoadScreen();
205}
206
207
208/**
209 *  loads the NetworkWorld by initializing all resources, and set their default values.
210 */
211ErrorMessage NetworkWorld::load()
212{
213  PRINTF(3)("> Loading world: '%s'\n", getPath());
214  TiXmlElement* element;
215  GameLoader* loader = GameLoader::getInstance();
216
217  if( getPath() == NULL)
218    {
219      PRINTF(1)("World has no path specified for loading");
220      return (ErrorMessage){213,"Path not specified","World::load()"};
221    }
222
223  TiXmlDocument* XMLDoc = new TiXmlDocument( getPath());
224  // load the campaign document
225  if( !XMLDoc->LoadFile())
226  {
227    // report an error
228    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getPath(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
229    delete XMLDoc;
230    return (ErrorMessage){213,"XML File parsing error","NetworkWorld::load()"};
231  }
232
233  // check basic validity
234  TiXmlElement* root = XMLDoc->RootElement();
235  assert( root != NULL);
236
237  if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile"))
238    {
239      // report an error
240      PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
241      delete XMLDoc;
242      return (ErrorMessage){213,"Path not a WorldDataFile","NetworkWorld::load()"};
243    }
244
245
246  // load the parameters
247  // name
248  const char* string = grabParameter( root, "name");
249  if( string == NULL)
250    {
251      PRINTF(2)("World is missing a proper 'name'\n");
252      this->setName("Unknown");
253    }
254  else
255    {
256      this->setName(string);
257    }
258
259
260  ////////////////
261  // LOADSCREEN //
262  ////////////////
263  element = root->FirstChildElement("LoadScreen");
264  if (element == NULL)
265    {
266      PRINTF(2)("no LoadScreen specified, loading default\n");
267
268      glmis->setBackgroundImage("pictures/load_screen.jpg");
269      this->glmis->setMaximum(8);
270      this->glmis->draw();
271    }
272  else
273    {
274      this->glmis->loadParams(element);
275      this->glmis->draw();
276    }
277  this->glmis->draw();
278
279
280
281  ////////////////////////////
282  // Loading Spawning Point //
283  ////////////////////////////
284  element = root->FirstChildElement("SpawningPoints");
285  if( element == NULL)
286  {
287    PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n");
288  }
289  else
290  {
291    element = element->FirstChildElement();
292      // load Players/Objects/Whatever
293    PRINTF(4)("Loading Spawning Points\n");
294    while( element != NULL)
295    {
296      BaseObject* created = Factory::fabricate(element);
297      if( created != NULL )
298      {
299//        if(created->isA(CL_SPAWNING_POINT))
300//          this->spawn(dynamic_cast<WorldEntity*>(created));
301        printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName());
302      }
303
304
305      element = element->NextSiblingElement();
306      glmis->step(); //! @todo temporary
307    }
308    PRINTF(4)("Done loading NetworkWorldEntities\n");
309  }
310
311
312  ////////////////////////
313  // find WorldEntities //
314  ////////////////////////
315  element = root->FirstChildElement("WorldEntities");
316  if( element == NULL)
317  {
318    PRINTF(1)("NetworkWorld is missing 'WorldEntities'\n");
319  }
320  else
321  {
322    element = element->FirstChildElement();
323      // load Players/Objects/Whatever
324    PRINTF(4)("Loading NetworkWorldEntities\n");
325    while( element != NULL)
326    {
327      if( NetworkManager::getInstance()->isGameServer())
328      {
329
330        BaseObject* created = NetworkGameManager::getInstance()->createEntity(element);
331        if( created != NULL )
332        {
333//          if(created->isA(CL_WORLD_ENTITY))
334//            this->spawn(dynamic_cast<WorldEntity*>(created));
335          printf("Created a %s: %s\n", created->getClassName(), created->getName());
336        }
337        else
338          PRINTF(1)("NetworkWorld: could not create this entity\n");
339
340          // if we load a 'Player' we use it as localPlayer
341
342
343          //todo do this more elegant
344        if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
345          sky = dynamic_cast<WorldEntity*>(created);
346        if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
347        {
348          terrain = dynamic_cast<Terrain*>(created);
349          CDEngine::getInstance()->setTerrain(terrain);
350
351        }
352
353      }
354      else if( /* !strcmp( element->Value(), "SkyBox") || */ /* !strcmp( element->Value(), "Terrain") || */ !strcmp( element->Value(), "SpaceShip"))
355      {
356        BaseObject* created = Factory::fabricate(element);
357        if( created != NULL )
358        {
359//          if(created->isA(CL_WORLD_ENTITY))
360//            this->spawn(dynamic_cast<WorldEntity*>(created));
361          printf("Created a %s: %s\n", created->getClassName(), created->getName());
362        }
363        else
364          PRINTF(1)("NetworkWorld: could not create this entity\n");
365
366          // if we load a 'Player' we use it as localPlayer
367
368
369          //todo do this more elegant
370        if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
371          sky = dynamic_cast<WorldEntity*>(created);
372        if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
373        {
374          terrain = dynamic_cast<Terrain*>(created);
375          CDEngine::getInstance()->setTerrain(terrain);
376        }
377      }
378      element = element->NextSiblingElement();
379      glmis->step(); //! @todo temporary
380      PRINTF(4)("Done loading NetworkWorldEntities\n");
381    }
382  }
383
384
385    //////////////////////////////
386    // LOADING ADDITIONAL STUFF //
387    //////////////////////////////
388
389    LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
390
391   LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
392//   LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
393
394  // free the XML data
395
396  delete XMLDoc;
397  /* GENERIC LOADING PROCESS FINISHED */
398
399
400  // Create a Player
401  this->localPlayer = new Player();
402
403  Playable* playable;
404  const list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
405  if (playableList != NULL)
406  {
407    playable = dynamic_cast<Playable*>(playableList->front());
408    this->localPlayer->setControllable(playable);
409  }
410
411
412//   //localCamera->setParent(TrackNode::getInstance());
413//  tn->addChild(this->localCamera);
414  localCamera->setClipRegion(1, 10000.0);
415//  localCamera->lookAt(playable);
416//  this->localPlayer->setParentMode(PNODE_ALL);
417  if (this->sky != NULL)
418  {
419    this->localCamera->addChild(sky);
420  }
421  SoundEngine::getInstance()->setListener(this->localCamera);
422
423
424
425  ////////////
426  // STATIC //
427  ////////////
428
429
430//   TestEntity* testEntity = new TestEntity();
431//   testEntity->setRelCoor(Vector(570, 10, -15));
432//   testEntity->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
433//   this->spawn(testEntity);
434
435//   for(int i = 0; i < 100; i++)
436//   {
437//     WorldEntity* tmp = NetworkGameManager::;
438//     char npcChar[10];
439//     sprintf (npcChar, "NPC_%d", i);
440//         tmp->setName(npcChar);
441//     tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
442//     this->spawn(tmp);
443//   }
444
445  this->music = NULL;
446  //(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
447  //music->playback();
448}
449
450ErrorMessage NetworkWorld::postLoad()
451{
452  /*monitor progress*/
453  this->glmis->step();
454  // stuff beyond this point remains to be loaded properly
455
456  // LIGHT initialisation
457  LightManager::getInstance()->setAmbientColor(.1,.1,.1);
458//  LightManager::getInstance()->addLight();
459  LightManager::getInstance()->debug();
460
461  this->releaseLoadScreen();
462}
463
464
465/**
466 *  initializes a new NetworkWorld shortly before start
467 *
468 * this is the function, that will be loaded shortly before the world is
469 * started
470*/
471ErrorMessage NetworkWorld::preStart()
472{
473  this->bPause = false;
474
475  /* update the object position before game start - so there are no wrong coordinates used in the first processing */
476  PNode::getNullParent()->updateNode (0.001f);
477  PNode::getNullParent()->updateNode (0.001f);
478}
479
480
481/**
482 *  starts the NetworkWorld
483 */
484ErrorMessage NetworkWorld::start()
485{
486  this->bQuitWorld = false;
487  this->mainLoop();
488}
489
490/**
491 *  stops the world.
492
493   This happens, when the player decides to end the Level.
494*/
495ErrorMessage NetworkWorld::stop()
496{
497  PRINTF(3)("NetworkWorld::stop() - got stop signal\n");
498  this->bQuitWorld= true;
499}
500
501/**
502 *  pauses the Game
503*/
504ErrorMessage NetworkWorld::pause()
505{
506  this->isPaused = true;
507}
508
509/**
510 *  ends the pause Phase
511*/
512ErrorMessage NetworkWorld::resume()
513{
514  this->isPaused = false;
515}
516
517/**
518 *  destroys the NetworkWorld
519*/
520ErrorMessage NetworkWorld::destroy()
521{
522
523}
524
525/**
526 *  shows the loading screen
527*/
528void NetworkWorld::displayLoadScreen ()
529{
530  PRINTF(3)("NetworkWorld::displayLoadScreen - start\n");
531
532  //GLMenuImageScreen*
533  this->glmis = new GLMenuImageScreen();
534  this->glmis->setMaximum(8);
535
536  PRINTF(3)("NetworkWorld::displayLoadScreen - end\n");
537}
538
539/**
540 * @brief removes the loadscreen, and changes over to the game
541 *
542 * @todo take out the delay
543*/
544void NetworkWorld::releaseLoadScreen ()
545{
546  PRINTF(3)("NetworkWorld::releaseLoadScreen - start\n");
547  this->glmis->setValue(this->glmis->getMaximum());
548  PRINTF(3)("NetworkWorld::releaseLoadScreen - end\n");
549  delete this->glmis;
550}
551
552
553/**
554 *  this returns the current game time
555 * @returns elapsed game time
556*/
557double NetworkWorld::getGameTime()
558{
559  return this->gameTime;
560}
561
562/**
563  \brief main loop of the world: executing all world relevant function
564  in this loop we synchronize (if networked), handle input events, give the heart-beat to
565  all other member-entities of the world (tick to player, enemies etc.), checking for
566  collisions drawing everything to the screen.
567*/
568void NetworkWorld::mainLoop()
569{
570  this->lastFrame = SDL_GetTicks ();
571  PRINTF(3)("World::mainLoop() - Entering main loop\n");
572
573  while(!this->bQuitWorld) /* @todo implement pause */
574  {
575    ++this->cycle;
576      // Network
577    this->synchronize ();
578      // Process input
579    this->handleInput ();
580    if( this->bQuitWorld)
581      break;
582      // Process time
583    this->tick ();
584      // Process collision
585    this->collide ();
586      // Update the state
587    this->update ();
588      // Draw
589    this->display ();
590  }
591
592  PRINTF(3)("NetworkWorld::mainLoop() - Exiting the main loop\n");
593}
594
595
596/**
597 *  synchronize local data with remote data
598*/
599void NetworkWorld::synchronize ()
600{
601  // Get remote input
602  // Update synchronizables
603  NetworkManager::getInstance()->synchronize();
604}
605
606
607/**
608 *  run all input processing
609
610   the command node is the central input event dispatcher. the node uses the even-queue from
611   sdl and has its own event-passing-queue.
612*/
613void NetworkWorld::handleInput ()
614{
615  EventHandler::getInstance()->process();
616
617  // remoteinput
618}
619
620void NetworkWorld::tick(std::list<WorldEntity*> entityList, float dt)
621{
622  std::list<WorldEntity*>::iterator entity;
623  for (entity = entityList.begin(); entity != entityList.end(); entity++)
624    (*entity)->tick(dt);
625
626}
627
628/**
629 *  advance the timeline
630
631   this calculates the time used to process one frame (with all input handling, drawing, etc)
632   the time is mesured in ms and passed to all world-entities and other classes that need
633   a heart-beat.
634*/
635void NetworkWorld::tick ()
636{
637  Uint32 currentFrame = SDL_GetTicks();
638  if(!this->bPause)
639    {
640      this->dt = currentFrame - this->lastFrame;
641
642      if( this->dt > 10)
643        {
644          float fps = 1000/dt;
645
646          // temporary, only for showing how fast the text-engine is
647          char tmpChar[20];
648          sprintf(tmpChar, "fps: %4.0f", fps);
649        }
650      else
651        {
652          /* the frame-rate is limited to 100 frames per second, all other things are for
653             nothing.
654          */
655          PRINTF(3)("fps = 1000 - frame rate is adjusted\n");
656          SDL_Delay(10-dt);
657          this->dt = 10;
658        }
659
660      this->dtS = (float)this->dt / 1000.0 * this->speed;
661      this->gameTime += this->dtS;
662
663      this->tick(this->objectManager.getObjectList(OM_DEAD_TICK), this->dtS);
664      this->tick(this->objectManager.getObjectList(OM_COMMON), this->dtS);
665      this->tick(this->objectManager.getObjectList(OM_GROUP_00), this->dtS);
666      this->tick(this->objectManager.getObjectList(OM_GROUP_01), this->dtS);
667      this->tick(this->objectManager.getObjectList(OM_GROUP_01_PROJ), this->dtS);
668
669      /* update tick the rest */
670      this->localCamera->tick(this->dtS);
671      // tick the engines
672      AnimationPlayer::getInstance()->tick(this->dtS);
673//      if (this->cycle > 5)
674        PhysicsEngine::getInstance()->tick(this->dtS);
675
676      ParticleEngine::getInstance()->tick(this->dtS);
677
678
679      /** actualy the Graphics Engine should tick the world not the other way around...
680         but since we like the things not too complicated we got it this way around
681         until there is need or time to do it the other way around.
682         @todo: GraphicsEngine ticks world: separation of processes and data...
683
684        bensch: in my opinion the GraphicsEngine could draw the world, but not tick it,
685         beceause graphics have nothing(or at least not much) to do with Motion.
686      */
687      GraphicsEngine::getInstance()->tick(this->dtS);
688    }
689  this->lastFrame = currentFrame;
690}
691
692
693/**
694 *  this function gives the world a consistant state
695
696   after ticking (updating the world state) this will give a constistant
697   state to the whole system.
698*/
699void NetworkWorld::update()
700{
701  GraphicsEngine::getInstance()->update(this->dtS);
702  PNode::getNullParent()->updateNode (this->dtS);
703  SoundEngine::getInstance()->update();
704  //music->update();
705}
706
707
708void NetworkWorld::collide()
709{
710  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_00),
711                                            this->objectManager.getObjectList(OM_GROUP_01_PROJ));
712  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_01),
713                                            this->objectManager.getObjectList(OM_COMMON));
714}
715
716/**
717 *  render the current frame
718
719   clear all buffers and draw the world
720*/
721void NetworkWorld::display ()
722{
723  // clear buffer
724  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
725  // set camera
726  this->localCamera->apply ();
727  // draw world
728  this->draw();
729  // draw HUD
730  /** @todo draw HUD */
731  // flip buffers
732  GraphicsEngine::swapBuffers();
733  //SDL_Surface* screen = Orxonox::getInstance()->getScreen ();
734  //SDL_Flip (screen);
735}
736
737
738/**
739 *  runs through all entities calling their draw() methods
740 */
741void NetworkWorld::draw ()
742{
743  GraphicsEngine* engine = GraphicsEngine::getInstance();
744  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
745  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON));
746  engine->draw(State::getObjectManager()->getObjectList(OM_COMMON));
747  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_00));
748  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01));
749  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
750
751   if( unlikely( this->showBV))  // to draw the bounding boxes of the objects at level 2 for debug purp
752   {
753     CDEngine* engine = CDEngine::getInstance();
754     engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
755     engine->drawBV(State::getObjectManager()->getObjectList(OM_ENVIRON));
756     engine->drawBV(State::getObjectManager()->getObjectList(OM_COMMON));
757     engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_00));
758     engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01));
759     engine->drawBV(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
760   }
761
762//   {
763//     if( entity->isVisible() ) entity->draw();
764  //FIXME
765//     entity = iterator->nextElement();
766//   }
767
768  ParticleEngine::getInstance()->draw();
769
770  if (unlikely(this->showPNodes))
771    PNode::getNullParent()->debugDraw(0);
772
773  engine->draw();
774  //TextEngine::getInstance()->draw();
775}
776
777void NetworkWorld::setPath( const char* name)
778{
779  if (this->path)
780    delete this->path;
781  if (ResourceManager::isFile(name))
782  {
783    this->path = new char[strlen(name)+1];
784    strcpy(this->path, name);
785  }
786  else
787    {
788      this->path = new char[strlen(ResourceManager::getInstance()->getDataDir()) + strlen(name) +1];
789      sprintf(this->path, "%s%s", ResourceManager::getInstance()->getDataDir(), name);
790    }
791}
792
793const char* NetworkWorld::getPath( void)
794{
795  return path;
796}
Note: See TracBrowser for help on using the repository browser.