Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/ll2trunktemp/src/game_loader.h @ 4008

Last change on this file since 4008 was 4004, checked in by bensch, 20 years ago

orxonox/branches/ll2trunktemp: changed the Factory-Macro into a Template, this code will be easyer to read and to debug
also found the segfault when deleting orxonox.
each factory tried to delete itself, because they were initialized implicitely (not with new).
now we only have to delete the first factory at the beginning

File size: 1.9 KB
Line 
1/*!
2    \file game_loader.h
3    \brief loads campaigns, worlds and all other story_entities
4*/ 
5
6#ifndef _GAME_LOADER_H
7#define _GAME_LOADER_H
8
9//#include "stdincl.h"
10#include "story_def.h"
11#include "comincl.h"
12
13
14//-----------------------------------------------------------------------------
15// Forward declarations
16//-----------------------------------------------------------------------------
17class Campaign;
18class World;
19class Camera;
20class CammandNode;
21
22//! The GameLoader
23/**
24   The game loader loads all game date. this is performed in the following way:
25   1. Read the structure of campaings and worlds
26   2. Create the instances of the tree: here _ALL_ StoryEntities are created
27      also if they are not yet used. the worlds should load their data in
28      the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE!
29      Elsewhere, all the data will be allocated at the beginning... mess...
30   3. StoryEntities are load() and init() before they start
31   4. once the gamloader starts the game there will be a campaing starting a
32      world. this is done by callaing those StoryEntity::start()
33*/
34class GameLoader
35{
36
37 public:
38  static GameLoader* getInstance();
39
40  ErrorMessage init();
41  ErrorMessage loadCampaign(char* name);
42  ErrorMessage start();
43  ErrorMessage stop();
44  ErrorMessage pause();
45  ErrorMessage resume();
46  ErrorMessage destroy();
47
48  void nextLevel();
49  void previousLevel();
50
51  bool worldCommand(Command* cmd);
52  ErrorMessage loadDebugCampaign(Uint32 campaignID);
53 
54  void registerFactory( Factory* factory);
55  BaseObject* fabricate( TiXmlElement* data);
56
57 private:
58  GameLoader ();
59  ~GameLoader ();
60  Uint32 startTime; //!> start time of the campaign
61  static GameLoader* singletonRef;
62  bool isPaused;
63
64  Campaign* currentCampaign; //!> the current campaign playing
65 
66  Campaign* fileToCampaign(char* name);
67
68  Factory* first;
69};
70
71#endif /* _GAME_LOADER_H */
Note: See TracBrowser for help on using the repository browser.