Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9333


Ignore:
Timestamp:
Jul 22, 2012, 10:04:10 PM (12 years ago)
Author:
landauf
Message:

added const qualifier to all message-sending functions in GametypeInfo
removed some related const_casts from spacerace classes

Location:
code/branches/presentation2012merge/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012merge/src/modules/gametypes/OldRaceCheckPoint.cc

    r9271 r9333  
    112112                const std::string& message =  "You have " + multi_cast<std::string>(this->bTimeLimit_)
    113113                            + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1);
    114                 const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
     114                gametype->getGametypeInfo()->sendAnnounceMessage(message);
    115115                ChatManager::message(message);
    116116            }
  • code/branches/presentation2012merge/src/modules/gametypes/OldSpaceRace.cc

    r9271 r9333  
    5858                        + "You didn't reach the check point " + multi_cast<std::string>(this->checkpointsReached_+1)
    5959                        + " before the time limit. You lose!";
    60             const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     60            this->getGametypeInfo()->sendAnnounceMessage(message);
    6161            ChatManager::message(message);
    6262        }
     
    6868            const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
    6969                        + "." + multi_cast<std::string>(ms) + " seconds.";
    70             const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     70            this->getGametypeInfo()->sendAnnounceMessage(message);
    7171            ChatManager::message(message);
    7272/*
     
    8585
    8686        std::string message("The match has started! Reach the check points as quickly as possible!");
    87         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     87        this->getGametypeInfo()->sendAnnounceMessage(message);
    8888        ChatManager::message(message);
    8989    }
     
    9898                        + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
    9999                        + " seconds.";
    100         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     100        this->getGametypeInfo()->sendAnnounceMessage(message);
    101101        ChatManager::message(message);
    102102    }
  • code/branches/presentation2012merge/src/modules/gametypes/RaceCheckPoint.cc

    r9263 r9333  
    9797            std::string message =  "You have " + multi_cast<std::string>(this->timeLimit_)
    9898                        + " seconds to reach the check point " + multi_cast<std::string>(this->checkpointIndex_ + 1);
    99             const_cast<GametypeInfo*>(this->getGametype()->getGametypeInfo())->sendAnnounceMessage(message);
     99            this->getGametype()->getGametypeInfo()->sendAnnounceMessage(message);
    100100            ChatManager::message(message);
    101101        }
  • code/branches/presentation2012merge/src/modules/gametypes/SpaceRace.cc

    r9306 r9333  
    7272        }
    7373
    74         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     74        this->getGametypeInfo()->sendAnnounceMessage(message);
    7575        ChatManager::message(message);
    7676    }
     
    9999
    100100            std::string message = "The match has started! Reach the check points as quickly as possible!";
    101             const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     101            this->getGametypeInfo()->sendAnnounceMessage(message);
    102102            ChatManager::message(message);
    103103        }
     
    114114        const std::string& message = "Checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1)
    115115            + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds.";
    116         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     116        this->getGametypeInfo()->sendAnnounceMessage(message);
    117117        ChatManager::message(message);
    118118    }
  • code/branches/presentation2012merge/src/modules/objects/triggers/CheckPoint.cc

    r7601 r9333  
    109109                if (bIsDestination_)
    110110                {
    111                     const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage("Congratulations - you have won the match!");
     111                    gametype->getGametypeInfo()->sendAnnounceMessage("Congratulations - you have won the match!");
    112112                    gametype->end();
    113113                }
     
    115115                if (!bIsFirst_ && !bIsDestination_)
    116116                {
    117                     const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage("Checkpoint reached");
     117                    gametype->getGametypeInfo()->sendAnnounceMessage("Checkpoint reached");
    118118                }
    119119            }
  • code/branches/presentation2012merge/src/orxonox/infos/GametypeInfo.cc

    r9016 r9333  
    6868    {
    6969        RegisterObject(GametypeInfo);
    70        
     70
    7171        this->bStarted_ = false;
    7272        this->bEnded_ = false;
     
    165165        if(this->bStarted_)
    166166           { return;}
    167        
     167
    168168        this->bStarted_ = true;
    169169        this->changedStarted();
    170        
    171        
     170
     171
    172172    }
    173173
     
    195195        if(this->startCountdown_ == countdown || countdown < 0.0f)
    196196            return;
    197        
     197
    198198        this->startCountdown_ = countdown;
    199199        // Set the counter to the ceiling of the current countdown.
     
    225225        if(this->counter_ == 0)
    226226            return;
    227        
     227
    228228        this->counter_--;
    229229        this->changedCountdownCounter();
     
    325325        if(this->spawned_ == spawned)
    326326            return;
    327        
     327
    328328        this->spawned_ = spawned;
    329329        // Clear the notifications if the Player has spawned.
     
    395395    // TODO: Replace with notifications.
    396396
    397     void GametypeInfo::sendAnnounceMessage(const std::string& message)
     397    void GametypeInfo::sendAnnounceMessage(const std::string& message) const
    398398    {
    399399        if (GameMode::isMaster())
     
    404404    }
    405405
    406     void GametypeInfo::sendAnnounceMessage(const std::string& message, unsigned int clientID)
     406    void GametypeInfo::sendAnnounceMessage(const std::string& message, unsigned int clientID) const
    407407    {
    408408        if (GameMode::isMaster())
     
    415415    }
    416416
    417     void GametypeInfo::sendKillMessage(const std::string& message, unsigned int clientID)
     417    void GametypeInfo::sendKillMessage(const std::string& message, unsigned int clientID) const
    418418    {
    419419        if (GameMode::isMaster())
     
    426426    }
    427427
    428     void GametypeInfo::sendDeathMessage(const std::string& message, unsigned int clientID)
     428    void GametypeInfo::sendDeathMessage(const std::string& message, unsigned int clientID) const
    429429    {
    430430        if (GameMode::isMaster())
     
    437437    }
    438438
    439     void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour)
     439    void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour) const
    440440    {
    441441        if (GameMode::isMaster())
     
    448448    }
    449449
    450     void GametypeInfo::sendFadingMessage(const std::string& message, unsigned int clientID)
     450    void GametypeInfo::sendFadingMessage(const std::string& message, unsigned int clientID) const
    451451    {
    452452        if (GameMode::isMaster())
     
    459459    }
    460460
    461     void GametypeInfo::dispatchAnnounceMessage(const std::string& message)
     461    void GametypeInfo::dispatchAnnounceMessage(const std::string& message) const
    462462    {
    463463        for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
     
    465465    }
    466466
    467     void GametypeInfo::dispatchKillMessage(const std::string& message)
     467    void GametypeInfo::dispatchKillMessage(const std::string& message) const
    468468    {
    469469        for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
     
    471471    }
    472472
    473     void GametypeInfo::dispatchDeathMessage(const std::string& message)
     473    void GametypeInfo::dispatchDeathMessage(const std::string& message) const
    474474    {
    475475        for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
     
    477477    }
    478478
    479      void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour)
     479     void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour) const
    480480    {
    481481        for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
     
    483483    }
    484484
    485      void GametypeInfo::dispatchFadingMessage(const std::string& message)
     485     void GametypeInfo::dispatchFadingMessage(const std::string& message) const
    486486    {
    487487        for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
  • code/branches/presentation2012merge/src/orxonox/infos/GametypeInfo.h

    r9016 r9333  
    6868                { return this->bStarted_; }
    6969            void changedStarted(void); // Is called when the game has changed to started.
    70            
     70
    7171            /**
    7272            @brief Get whether the game has ended yet.
     
    108108                { return this->readyToSpawn_; }
    109109            void changedReadyToSpawn(bool ready); // Inform the GametypeInfo that the local player has changed its spawned status.
    110            
     110
    111111            /**
    112112            @brief Get whether the local player is spawned.
     
    119119            inline const std::string& getHUDTemplate() const
    120120                { return this->hudtemplate_; }
    121            
     121
    122122            inline unsigned int getNumberOfPlayers() const
    123123                {  return this->spawnedPlayers_.size(); }
    124124
    125             void sendAnnounceMessage(const std::string& message);
    126             void sendAnnounceMessage(const std::string& message, unsigned int clientID);
    127             void sendKillMessage(const std::string& message, unsigned int clientID);
    128             void sendDeathMessage(const std::string& message, unsigned int clientID);
    129             void sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour);
    130             void sendFadingMessage(const std::string& message, unsigned int clientID);
     125            void sendAnnounceMessage(const std::string& message) const;
     126            void sendAnnounceMessage(const std::string& message, unsigned int clientID) const;
     127            void sendKillMessage(const std::string& message, unsigned int clientID) const;
     128            void sendDeathMessage(const std::string& message, unsigned int clientID) const;
     129            void sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour) const;
     130            void sendFadingMessage(const std::string& message, unsigned int clientID) const;
    131131
    132             void dispatchAnnounceMessage(const std::string& message);
    133             void dispatchKillMessage(const std::string& message);
    134             void dispatchDeathMessage(const std::string& message);
    135             void dispatchStaticMessage(const std::string& message,const ColourValue& colour);
    136             void dispatchFadingMessage(const std::string& message);
    137            
     132            void dispatchAnnounceMessage(const std::string& message) const;
     133            void dispatchKillMessage(const std::string& message) const;
     134            void dispatchDeathMessage(const std::string& message) const;
     135            void dispatchStaticMessage(const std::string& message,const ColourValue& colour) const;
     136            void dispatchFadingMessage(const std::string& message) const;
     137
    138138        protected:
    139139            void start(void); // Inform the GametypeInfo that the game has started.
     
    165165            unsigned int counter_; //!< The current integer value of the start countdown, the start countdown counter.
    166166            std::string hudtemplate_;
    167            
     167
    168168            std::set<PlayerInfo*> spawnedPlayers_; //!< A set of players that are currently spawned.
    169169            bool spawned_; //!< Whether the local Player is currently spawned.
Note: See TracChangeset for help on using the changeset viewer.