Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7461 in orxonox.OLD


Ignore:
Timestamp:
May 1, 2006, 1:47:53 PM (18 years ago)
Author:
patrick
Message:

orxonox: the mission goal framework is nearly completed

Location:
trunk/src
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r7450 r7461  
    133133  CL_GAME_WORLD_DATA            =    0x00102000,
    134134  CL_GAME_RULES                 =    0x00104000,
     135  CL_MISSION_GOAL               =    0x00105000,
    135136
    136137  CL_CAMPAIGN                   =    0x00000101,
     
    144145  CL_MOVIE_LOADER               =    0x00000109,
    145146
    146   CL_MULTIPLAYER_TEAM_DEATHMATCH=    0x00000111,
    147   CL_SINGLEPLAYER_SHOOTEMUP     =    0x00000112,
    148 
    149   CL_MISSION_GOAL               =    0x00000113,
     147  CL_MULTIPLAYER_TEAM_DEATHMATCH=    0x00104001,
     148  CL_SINGLEPLAYER_SHOOTEMUP     =    0x00104002,
     149
     150  CL_KILL_TARGET                =    0x00105001,
     151
     152
    150153
    151154  /// SUPER-PNodes
  • trunk/src/story_entities/game_world_data.cc

    r7460 r7461  
    379379  while( element != NULL)
    380380  {
    381     PRINTF(4)("============ GameRules ==");
    382     PRINTF(4)("creating %s\n", element->Value());
     381    PRINTF(2)("============ GameRules ==\n");
     382    PRINTF(2)("creating %s\n", element->Value());
    383383    BaseObject* created = Factory::fabricate(element);
    384     if (created != NULL /*&& created->isA(CL_GAME_RULES)*/)
     384    if (created != NULL && created->isA(CL_GAME_RULES))
    385385    {
    386386      this->gameRule = dynamic_cast<GameRules*>(created);
    387387      State::setGameRules(this->gameRule);
     388      // if there is a valid game rule loaded, break because it is not thought to load multiple game rules
     389      break;
    388390    }
    389391    else
  • trunk/src/util/Makefile.am

    r7440 r7461  
    88                        state.cc \
    99                        hud.cc \
     10                        \
    1011                        game_rules.cc \
    11                         mission_goal.cc\
    1212                        multiplayer_team_deathmatch.cc \
    1313                        singleplayer_shootemup.cc \
     14                        \
     15                        mission_goal.cc\
     16                        kill_target.cc\
     17                        \
    1418                        signal_handler.cc \
    1519                        \
     
    2731                        state.h \
    2832                        hud.h \
     33                        \
    2934                        game_rules.h \
    30                         mission_goal.h \
    3135                        multiplayer_team_deathmatch.h \
    3236                        singleplayer_shootemup.h \
     37                        \
     38                        mission_goal.cc\
     39                        kill_target.h\
    3340                        signal_handler.h \
    3441                        \
  • trunk/src/util/game_rules.cc

    r7193 r7461  
    1818
    1919#include "util/loading/load_param.h"
     20#include "util/loading/factory.h"
     21
     22#include "util/mission_goal.h"
     23
    2024
    2125
     
    4246{
    4347  BaseObject::loadParams(root);
     48
     49  LoadParamXML(root, "MissionGoal", this, GameRules, loadMissionGoal)
     50      .describe("an XML-Element to load the missions from");
    4451}
    4552
     53
     54
     55void GameRules::loadMissionGoal(const TiXmlElement* root)
     56{
     57  const TiXmlElement* element = root->FirstChildElement();
     58  while( element != NULL)
     59  {
     60    PRINTF(2)("============ MissionGoal\n");
     61    PRINTF(2)("Adding Mission Goal:%s\n", element->Value());
     62    BaseObject* created = Factory::fabricate(element);
     63    if (created != NULL && created->isA(CL_GAME_RULES))
     64    {
     65      MissionGoal* mg = dynamic_cast<MissionGoal*>(created);
     66      this->addMissionGoal(mg);
     67      // if there is a valid game rule loaded, break because it is not thought to load multiple game rules
     68      break;
     69    }
     70    else
     71    {
     72      PRINTF(1)("Could not create a %s\n", element->Value());
     73      delete created;
     74    }
     75    element = element->NextSiblingElement();
     76  }
     77}
     78
  • trunk/src/util/game_rules.h

    r7400 r7461  
    2626
    2727    virtual void loadParams(const TiXmlElement* root = NULL);
     28    void loadMissionGoal(const TiXmlElement* root = NULL);
    2829
    2930
  • trunk/src/util/mission_goal.cc

    r7391 r7461  
    2525 * @todo this constructor is not jet implemented - do it
    2626*/
    27 MissionGoal::MissionGoal ()
     27MissionGoal::MissionGoal (const TiXmlElement* root)
    2828{
    2929   this->setClassID(CL_MISSION_GOAL, "MissionGoal");
     30
     31   if( root != NULL)
     32     this->loadParams(root);
    3033}
    3134
     
    3841
    3942}
     43
     44
     45void MissionGoal::loadParams(const TiXmlElement* root)
     46{
     47  BaseObject::loadParams(root);
     48}
  • trunk/src/util/mission_goal.h

    r7400 r7461  
    2727
    2828 public:
    29   MissionGoal();
     29  MissionGoal(const TiXmlElement* root);
    3030  virtual ~MissionGoal();
    3131
  • trunk/src/util/signal_handler.cc

    r7440 r7461  
    1515
    1616#include "signal_handler.h"
     17#include <assert.h>
    1718
    1819#ifndef __WIN32__
     
    2829  this->type = type;
    2930  this->appName = appName;
    30  
     31
    3132  catchSignal( SIGSEGV );
    3233  catchSignal( SIGABRT );
     
    7576
    7677  assert( pipe(fd) != -1 );
    77  
     78
    7879  int pid = fork();
    7980
     
    8687    sleep(2);
    8788
    88    
     89
    8990    return;
    9091  }
     
    9899      exit(0);
    99100    }
    100    
     101
    101102    char command[256];
    102103    if ( getInstance()->type == GDB_RUN_WRITE_TO_FILE )
  • trunk/src/util/singleplayer_shootemup.cc

    r7391 r7461  
    4949  this->setClassID(CL_SINGLEPLAYER_SHOOTEMUP, "SingleplayerShootemup");
    5050
     51  PRINTF(0)("Created a SinglePlayer Shootemup game\n");
    5152
    5253  if( root != NULL)
Note: See TracChangeset for help on using the changeset viewer.