Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7461 in orxonox.OLD for trunk/src/util/game_rules.cc


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

orxonox: the mission goal framework is nearly completed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.