Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2013, 12:19:18 AM (11 years ago)
Author:
jo
Message:

Merged trunk into branch levelKaan to add new features for the gametype Mission.

Location:
code/branches/levelKaan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/levelKaan

  • code/branches/levelKaan/src/orxonox/gametypes/Mission.cc

    r9667 r9733  
    3232
    3333#include "core/CoreIncludes.h"
     34#include "core/command/ConsoleCommand.h"
     35#include "infos/PlayerInfo.h"
    3436#include "network/Host.h"
    3537#include "worldentities/pawns/Pawn.h"
    3638
     39
    3740namespace orxonox
    3841{
     42    SetConsoleCommand("Mission", "endMission", &Mission::endMission);
     43    SetConsoleCommand("Mission", "setLives", &Mission::setLivesWrapper);
    3944    RegisterUnloadableClass(Mission);
    4045
     
    5661            this->end();
    5762        }
     63        else if (this->lives_ == 0)
     64        {
     65            this->missionAccomplished_ = false;
     66            this->end();
     67        }
    5868    }
    5969
    6070    void Mission::pawnKilled(Pawn* victim, Pawn* killer)
    6171    {
    62         if (victim && victim->getPlayer() && this->lives_ == 1)
     72        if (victim && victim->getPlayer() && victim->getPlayer()->isHumanPlayer() )
    6373        {
    64             this->missionAccomplished_ = false;
    65             this->end();
     74            this->lives_--;
    6675        }
    6776    }
     
    7887    {
    7988        Gametype::end();
    80         /*if (this->missionAccomplished_)
     89        if (this->missionAccomplished_)
    8190            this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
    8291        else
    8392            this->gtinfo_->sendAnnounceMessage("Mission failed!");
    84         */
    8593    }
    8694
     
    94102        }
    95103    }
    96 
     104    void Mission::endMission(bool accomplished)
     105    {
     106        for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
     107        {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions!
     108            it->setMissionAccomplished(accomplished);
     109            it->end();
     110        }
     111    }
     112   
     113    void Mission::setLivesWrapper(unsigned int amount)
     114    {
     115        for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
     116        {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions!
     117            it->setLives(amount);
     118        }
     119    }
    97120
    98121
Note: See TracChangeset for help on using the changeset viewer.