Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 4, 2018, 4:58:37 PM (6 years ago)
Author:
landauf
Message:

[SpaceRace_HS16] reverted some unwanted changes and fixed formatting a little bit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/gametypes/SpaceRace.cc

    r11358 r11720  
    8080        RegisterObject(SpaceRace);
    8181
    82         this->botclass_ = Class(SpaceRaceBot); //ClassByString("")
     82        this->botclass_ = Class(SpaceRaceBot);
    8383        this->cantMove_ = false;
    8484        this->bTimeIsUp_ = false;
    85         this->setConfigValues();
    8685
    8786        this->numberOfBots_ = 5; // quick fix: don't allow default-bots to enter the race
     
    8988    }
    9089
    91   void SpaceRace::setConfigValues()
    92     {
    93        
    94    
    95     }
    96 
    9790    void SpaceRace::start()
    9891    {
    99     // define spawn positions of the 5 bots
     92        // define spawn positions of the 5 bots
    10093
    10194        int startpos[15];
     
    120113        startpos[13] =-40;
    121114        startpos[14] =80;
    122        
    123 
    124 
    125115
    126116        Gametype::start();
    127    if (true)
    128         {
    129             this->spawnPlayersIfRequested();
    130             this->cantMove_ = true;
    131             //players are unable to move while countdown is running
    132             for (Engine* engine : ObjectList<Engine>()){
    133                 engine->setActive(false);
    134                
    135 
    136             }
    137            //append spawn positions to bots
    138            int a,b,c;
    139             a=0;
    140             b=1;
    141             c=2;
    142               for (SpaceRaceBot* bot : ObjectList<SpaceRaceBot>()){
    143                 bot->getControllableEntity()->setPosition(startpos[a],startpos[b],startpos[c]);
    144                a= a+3;
    145                b = b+3;
    146                c+= 3;
    147             }
    148 
    149 
    150         }
    151 
    152                                                
     117
     118        this->spawnPlayersIfRequested();
     119        this->cantMove_ = true;
     120        //players are unable to move while countdown is running
     121        for (Engine* engine : ObjectList<Engine>())
     122        {
     123            engine->setActive(false);
     124        }
     125
     126        //append spawn positions to bots
     127        int a,b,c;
     128        a=0;
     129        b=1;
     130        c=2;
     131
     132        for (SpaceRaceBot* bot : ObjectList<SpaceRaceBot>())
     133        {
     134            bot->getControllableEntity()->setPosition(startpos[a], startpos[b], startpos[c]);
     135            a += 3;
     136            b += 3;
     137            c += 3;
     138        }
    153139
    154140        std::string message("Use headphones to hear the countdown!");
     
    156142        ChatManager::message(message);
    157143
    158 //after 11 seconds , countdownFinished function is called to activate bots` engines
    159 Timer* countdownTimer = new Timer();
     144        //after 11 seconds , countdownFinished function is called to activate bots` engines
     145        Timer* countdownTimer = new Timer();
    160146        countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));
    161147    }
     
    189175    }
    190176
    191 
    192 void SpaceRace::tick(float dt)
    193     {
    194         SUPER(SpaceRace,tick,dt);
    195 }
    196 
    197177    void SpaceRace::newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player)
    198178    {
     
    207187        const std::string& message = player->getName() + " reached the checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1)
    208188        + "after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds.";
    209  this->getGametypeInfo()->sendAnnounceMessage(message);
    210         ChatManager::message(message);
    211 
    212     }
    213 
    214  void SpaceRace::countdownFinished()//activates the engines of all players
     189        this->getGametypeInfo()->sendAnnounceMessage(message);
     190        ChatManager::message(message);
     191
     192    }
     193
     194    void SpaceRace::countdownFinished()//activates the engines of all players
    215195    {
    216196
     
    220200
    221201
    222     for (Engine* engine : ObjectList<Engine>())
    223                 engine->setActive(true);
    224 
    225 
    226    
    227 }
    228 
    229  void SpaceRace::playerEntered(PlayerInfo* player)
     202        for (Engine* engine : ObjectList<Engine>())
     203            engine->setActive(true);
     204    }
     205
     206    void SpaceRace::playerEntered(PlayerInfo* player)
    230207    {
    231208        Gametype::playerEntered(player);
     
    236213
    237214
    238  void SpaceRace::addBots(unsigned int amount) //function that add the bots to the game
     215    void SpaceRace::addBots(unsigned int amount) //function that add the bots to the game
    239216    {
    240217        for (unsigned int i = 1; i <= amount; ++i){
     
    244221
    245222
    246 //set bot configurations
     223    //set bot configurations
    247224    bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator)
    248225    {
     
    255232    }
    256233
    257     bool SpaceRace::allowPawnDeath(Pawn* victim, Pawn* originator)// false because the bots can not recognize the objects and die to early
    258                                                                     //if they can
     234    bool SpaceRace::allowPawnDeath(Pawn* victim, Pawn* originator)// false because the bots can not recognize the objects and die to earlyif they can
    259235    {
    260236        return false;
Note: See TracChangeset for help on using the changeset viewer.