Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2011, 6:35:35 PM (13 years ago)
Author:
msalomon
Message:
 
File:
1 edited

Legend:

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

    r8428 r8552  
    4343        RegisterObject(SpaceRace);
    4444        this->checkpointsReached_ = 0;
     45        this->bTimeIsUp_ = false;
    4546        this->numberOfBots_ = 0;
    4647    }
     
    5354    void SpaceRace::end()
    5455    {
    55         Gametype::end();
    56         this->clock_->capture();
    57         int s = this->clock_->getSeconds();
    58         int ms = this->clock_->getMilliseconds()-1000*s;
    59         const std::string& message = "You have reached the last check point after "+ multi_cast<std::string>(s) +
    60                                       "." + multi_cast<std::string>(ms) + " seconds.";
    61         COUT(0) << message << std::endl;
    62         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    63         Host::Broadcast(message);
    64         float time = this->clock_->getSecondsPrecise();
    65         this->scores_.insert(time);
    66         std::set<float>::iterator it;
    67         for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
     56        Gametype::end();
     57        this->stopTimer();
     58        if (this->bTimeIsUp_) {
     59            COUT(0) << "Time is up" << std::endl;
     60            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage("Time is up");
     61        }
     62        else {
     63            this->clock_->capture();
     64            int s = this->clock_->getSeconds();
     65            int ms = this->clock_->getMilliseconds()-1000*s;
     66            const std::string& message = "You have reached the last check point after "+ multi_cast<std::string>(s) +
     67                                          "." + multi_cast<std::string>(ms) + " seconds.";
     68            COUT(0) << message << std::endl;
     69            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     70            Host::Broadcast(message);
     71            float time = this->clock_->getSecondsPrecise();
     72            this->scores_.insert(time);
     73            std::set<float>::iterator it;
     74            for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
    6875            COUT(0) <<  multi_cast<std::string>(*it) << std::endl;
     76        }
    6977    }
    7078
     
    7381        Gametype::start();
    7482       
     83        this->startTimer();
    7584        clock_= new Clock();
    7685        std::string message("The match has started! Reach the check points as quick as possible!");
Note: See TracChangeset for help on using the changeset viewer.