Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7464 in orxonox.OLD for trunk/src/util


Ignore:
Timestamp:
May 1, 2006, 4:52:33 PM (19 years ago)
Author:
patrick
Message:

orxonox: mission goals get checked now, verbose output.

Location:
trunk/src/util
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/kill_target.cc

    r7463 r7464  
    6060
    6161
    62 MissionState KillTarget::checkMissionGoal()
     62MissionState KillTarget::checkMissionGoal(float dt)
    6363{}
    6464
  • trunk/src/util/kill_target.h

    r7463 r7464  
    3030
    3131
    32     virtual MissionState checkMissionGoal();
     32    virtual MissionState checkMissionGoal(float dt);
    3333
    3434
  • trunk/src/util/mission_goal.cc

    r7463 r7464  
    1717
    1818#include "mission_goal.h"
     19#include "game_rules.h"
    1920
     21#include "state.h"
    2022#include "util/loading/load_param.h"
    2123
     
    3032{
    3133   this->setClassID(CL_MISSION_GOAL, "MissionGoal");
     34
     35   this->missionState = MS_PASSIVE;
     36   // add the mission to the current game rule
     37   GameRules* gr = State::getGameRules();
     38   if( gr)
     39     gr->addMissionGoal(this);
    3240
    3341   if( root != NULL)
  • trunk/src/util/mission_goal.h

    r7463 r7464  
    1616{
    1717  MS_ACCOMPLISHED = 0,
    18   MS_RUNNING,
     18  MS_ACCEPTED,
    1919  MS_FAILED,
     20  MS_PASSIVE,
    2021
    2122  MS_NUMBER
     
    4748  inline MissionState getMissionState() { return this->missionState; }
    4849
    49   virtual MissionState checkMissionGoal() = 0;
     50  virtual MissionState checkMissionGoal(float dt) = 0;
    5051
    5152
  • trunk/src/util/singleplayer_shootemup.cc

    r7462 r7464  
    2020#include "util/loading/factory.h"
    2121
    22 #include "render2D/billboard.h"
    23 #include "state.h"
    24 #include "class_list.h"
    25 
    26 #include "player.h"
    27 #include "playable.h"
    28 #include "space_ships/space_ship.h"
    29 
    30 
    31 #include "shared_network_data.h"
    32 #include "terrain.h"
    33 #include "class_list.h"
    34 #include "space_ships/space_ship.h"
     22#include "mission_goal.h"
    3523
    3624
     
    6755  GameRules::loadParams(root) ;
    6856
    69 //   LoadParam(root, "death-penalty-timeout", this, SingleplayerShootemup, setDeathPenaltyTimeout)
    70 //       .describe("sets the time in seconds a player has to wait for respawn");
    71 //
    72 //   LoadParam(root, "max-kills", this, SingleplayerShootemup, setMaxKills)
    73 //       .describe("sets the maximal kills for winning condition");
    74 //
    75 //   LoadParam(root, "death-screen-image", this, SingleplayerShootemup, setDeathScreen)
    76 //       .describe("sets the death screen image");
     57   LoadParam(root, "death-screen-image", this, SingleplayerShootemup, setDeathScreen)
     58       .describe("sets the death screen image");
    7759
    7860}
     
    10991void SingleplayerShootemup::tick(float dt)
    11092{
    111   this->checkGameRules();
     93  this->checkGameRules(dt);
    11294}
    11395
     
    123105 * check the game rules for consistency
    124106 */
    125 void SingleplayerShootemup::checkGameRules()
    126 {}
     107void SingleplayerShootemup::checkGameRules(float dt)
     108{
     109  PRINTF(0)("===========| Printing Mission State:\n");
     110  for (std::vector<MissionGoal*>::iterator it = this->missionList.begin(); it != this->missionList.end(); it++)
     111  {
     112    if( (*it)->checkMissionGoal(dt) != MS_ACCOMPLISHED)
     113    {
     114      PRINTF(0)("  Mission \"%s\" is not finished yet\n", (*it)->getMissionName().c_str());
     115    }
     116  }
     117}
    127118
    128119
  • trunk/src/util/singleplayer_shootemup.h

    r7391 r7464  
    3535
    3636  protected:
    37     virtual void checkGameRules();
     37    virtual void checkGameRules(float dt);
    3838
    3939
Note: See TracChangeset for help on using the changeset viewer.