Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/util/game_rules.cc @ 7905

Last change on this file since 7905 was 7488, checked in by patrick, 19 years ago

orxonox: mission manager less verbose and more secure now

File size: 1.8 KB
RevLine 
[7017]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*/
14
[7020]15#define DEBUG_MODULE_GAME_RULES
[7017]16
17#include "game_rules.h"
18
[7193]19#include "util/loading/load_param.h"
[7461]20#include "util/loading/factory.h"
[7017]21
[7461]22#include "util/mission_goal.h"
[7020]23
[7461]24
25
[7017]26using namespace std;
27
28
[7020]29/**
30 * constructor
31 */
[7035]32GameRules::GameRules(const TiXmlElement* root)
33{
34  this->setClassID(CL_GAME_RULES, "GameRules");
35}
[7017]36
[7020]37/**
38 * decontsructor
39 */
[7017]40GameRules::~GameRules()
41{}
[7020]42
43
44
45void GameRules::loadParams(const TiXmlElement* root)
[7035]46{
47  BaseObject::loadParams(root);
[7461]48
[7462]49  PRINTF(0)("GameRules::loadParams(...) hit me\n");
[7461]50  LoadParamXML(root, "MissionGoal", this, GameRules, loadMissionGoal)
51      .describe("an XML-Element to load the missions from");
[7035]52}
[7020]53
[7461]54
55
56void GameRules::loadMissionGoal(const TiXmlElement* root)
57{
[7462]58  PRINTF(0)("Trying to load MissionGoals\n");
[7461]59  const TiXmlElement* element = root->FirstChildElement();
60  while( element != NULL)
61  {
[7488]62    PRINTF(4)("============ MissionGoal\n");
63    PRINTF(4)("Adding Mission Goal:%s\n", element->Value());
[7461]64    BaseObject* created = Factory::fabricate(element);
[7462]65    if (created != NULL /*&& created->isA(CL_GAME_RULES)*/)
[7461]66    {
67      MissionGoal* mg = dynamic_cast<MissionGoal*>(created);
68      this->addMissionGoal(mg);
69      // if there is a valid game rule loaded, break because it is not thought to load multiple game rules
70      break;
71    }
72    else
73    {
74      PRINTF(1)("Could not create a %s\n", element->Value());
75      delete created;
76    }
77    element = element->NextSiblingElement();
78  }
79}
80
Note: See TracBrowser for help on using the repository browser.