Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6063 in orxonox.OLD for branches/network/src/util/loading


Ignore:
Timestamp:
Dec 12, 2005, 3:22:01 PM (19 years ago)
Author:
patrick
Message:

network: added extended game_loader interface

Location:
branches/network/src/util/loading
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/util/loading/game_loader.cc

    r6000 r6063  
    4646/**
    4747 *  simple constructor
    48 */
     48 */
    4949GameLoader::GameLoader ()
    5050{
     
    5757/**
    5858 *  simple deconstructor
    59 */
     59 */
    6060GameLoader::~GameLoader ()
    6161{
     
    6969 *  this class is a singleton class
    7070 * @returns an instance of itself
    71 
    72    if you are unsure about singleton classes, check the theory out on the internet :)
    73 */
     71 *
     72 * if you are unsure about singleton classes, check the theory out on the internet :)
     73 */
    7474GameLoader* GameLoader::getInstance()
    7575{
     
    8181/**
    8282 *  initializes the GameLoader
    83 */
     83 */
    8484ErrorMessage GameLoader::init()
    8585{
     
    100100 * @param fileName to be loaded
    101101 * @returns the loaded campaign
    102 
    103    this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
    104 */
     102 *
     103 * this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
     104 */
    105105ErrorMessage GameLoader::loadCampaign(const char* fileName)
    106106{
     
    122122 * @param fileName to be loaded
    123123 * @returns the loaded campaign
    124 
    125    this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
    126  */
    127 ErrorMessage GameLoader::loadNetworkCampaign(const char* fileName)
     124 *
     125 * this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
     126 */
     127ErrorMessage GameLoader::loadNetworkCampaign(const char* fileName, int nodeState)
    128128{
    129129  ErrorMessage errorCode;
     
    131131  if (campaignName)
    132132  {
    133     this->currentCampaign = this->fileToNetworkCampaign(campaignName);
     133    this->currentCampaign = this->fileToNetworkCampaign(campaignName, nodeState);
    134134    delete[] campaignName;
    135135  }
    136 //   World* world0 = new World(DEBUG_WORLD_0);
    137 //   world0->setNextStoryID(WORLD_ID_GAMEEND);
    138 //   this->currentCampaign->addEntity(world0, WORLD_ID_2);
    139 }
    140 
     136}
    141137
    142138
     
    145141 * @param campaignID the identifier of the campaign.
    146142 * @returns error message if not able to do so.
    147 */
     143 */
    148144ErrorMessage GameLoader::loadDebugCampaign(Uint32 campaignID)
    149145{
     
    180176
    181177/**
    182   *  starts the current entity
    183   * @returns error code if this action has caused a error
    184 */
     178 *  starts the current entity
     179 * @returns error code if this action has caused a error
     180 */
    185181ErrorMessage GameLoader::start()
    186182{
     
    191187
    192188/**
    193   *  stops the current entity
    194   * @returns error code if this action has caused a error
    195 
    196     ATTENTION: this function shouldn't call other functions, or if so, they must return
    197     after finishing. If you ignore or forget to do so, the current entity is not able to
    198     terminate and it will run in the background or the ressources can't be freed or even
    199     worse: are freed and the program will end in a segmentation fault!
    200     hehehe, have ya seen it... :)
    201 */
     189 *  stops the current entity
     190 * @returns error code if this action has caused a error
     191 *
     192 *  ATTENTION: this function shouldn't call other functions, or if so, they must return
     193 *  after finishing. If you ignore or forget to do so, the current entity is not able to
     194 *  terminate and it will run in the background or the ressources can't be freed or even
     195 *  worse: are freed and the program will end in a segmentation fault!
     196 *  hehehe, have ya seen it... :)
     197 */
    202198void GameLoader::stop()
    203199{
     
    208204
    209205/**
    210   *  pause the current entity
    211   * @returns error code if this action has caused a error
    212 
    213    this pauses the current entity or passes this call forth to the running entity.
    214 */
     206 *  pause the current entity
     207 * @returns error code if this action has caused a error
     208 *
     209 * this pauses the current entity or passes this call forth to the running entity.
     210 */
    215211ErrorMessage GameLoader::pause()
    216212{
     
    222218
    223219/**
    224   *  resumes a pause
    225   * @returns error code if this action has caused a error
    226 
    227     this resumess the current entity or passes this call forth to the running entity.
    228 */
     220 *  resumes a pause
     221 * @returns error code if this action has caused a error
     222 *
     223 *  this resumess the current entity or passes this call forth to the running entity.
     224 */
    229225ErrorMessage GameLoader::resume()
    230226{
     
    248244 * @param fileName to be loaded
    249245 * @returns the loaded campaign
    250 
    251    this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
    252 */
     246 *
     247 * this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
     248 */
    253249Campaign* GameLoader::fileToCampaign(const char* fileName)
    254250{
     
    296292
    297293
    298 
    299294/**
    300295 *  reads a campaign definition file into a campaign class
    301296 * @param fileName to be loaded
    302297 * @returns the loaded campaign
    303 
    304    this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
    305  */
    306 Campaign* GameLoader::fileToNetworkCampaign(const char* fileName)
     298 *
     299 *  this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
     300 */
     301Campaign* GameLoader::fileToNetworkCampaign(const char* fileName, int nodeState)
    307302{
    308303  /* do not entirely load the campaign. just the current world
     
    389384
    390385/**
    391   \brief this changes to the next level
    392 */
     386 * \brief this changes to the next level
     387 */
    393388void GameLoader::nextLevel()
    394389{
     
    399394
    400395/**
    401   \brief change to the previous level - not implemented
    402 
    403   this propably useless
    404 */
     396 * change to the previous level - not implemented
     397 *
     398 * this propably useless
     399 */
    405400void GameLoader::previousLevel()
    406401{
  • branches/network/src/util/loading/game_loader.h

    r6018 r6063  
    4040{
    4141
     42
    4243 public:
    4344  ~GameLoader ();
     
    4647
    4748  ErrorMessage init();
    48   ErrorMessage loadCampaign(const char* name);
    49   ErrorMessage loadNetworkCampaign(const char* fileName);
    5049  ErrorMessage start();
    5150  void stop();
     
    5453  ErrorMessage destroy();
    5554
     55  ErrorMessage loadCampaign(const char* name);
     56  ErrorMessage loadDebugCampaign(Uint32 campaignID);
     57  ErrorMessage loadNetworkCampaign(const char* fileName, int nodeState);
     58
    5659  void nextLevel();
    5760  void previousLevel();
    5861
    59   /** \brief a world command to send to the GameLoader @param cmd the command */
    60   bool worldCommand(Command* cmd);
    61   ErrorMessage loadDebugCampaign(Uint32 campaignID);
     62  void process(const Event &event);
    6263
    63   void process(const Event &event);
    6464
    6565 private:
     
    6767
    6868  Campaign* fileToCampaign(const char* name);
    69   Campaign* fileToNetworkCampaign(const char* fileName);
     69  Campaign* fileToNetworkCampaign(const char* fileName, int nodeState);
     70
    7071
    7172 private:
Note: See TracChangeset for help on using the changeset viewer.