Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 2, 2012, 10:34:48 PM (12 years ago)
Author:
landauf
Message:

cleaned up new SpaceRace classes (no functional code-changes):

  • formatting
  • naming of variables, arguments, functions
  • unused and duplicate code
  • public member variables
File:
1 edited

Legend:

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

    r9016 r9260  
    4444namespace orxonox
    4545{
    46   /**
    47   @brief
    48     The SpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order.
    49   */
     46    /**
     47    @brief
     48        The SpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order.
     49    */
    5050    class _GametypesExport SpaceRace : public Gametype
    5151    {
    5252        friend class RaceCheckPoint;
    53        
     53
    5454
    5555        public:
     
    5757            virtual ~SpaceRace() {}
    5858
     59            void tick(float dt);
     60
    5961            virtual void start();
    6062            virtual void end();
    6163
    62             virtual void newCheckpointReached(SpaceRaceManager* p, int index,PlayerInfo* pl);
    63             virtual void newCheckpointReached(RaceCheckPoint* p, PlayerInfo* pl);
     64            virtual void newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player);
    6465
    65             inline void setCheckpointReached(int n, PlayerInfo* p)
    66                 { this->checkpointReached_[p] = n;}
    67             inline int getCheckpointReached(PlayerInfo* p)
    68                 { return this->checkpointReached_[p]; }
     66            inline void setCheckpointReached(int index, PlayerInfo* player)
     67                { this->checkpointReached_[player] = index;}
     68            inline int getCheckpointReached(PlayerInfo* player)
     69                { return this->checkpointReached_[player]; }
    6970
    70             inline void timeIsUp()
     71            inline void setTimeIsUp()
    7172                { this->bTimeIsUp_ = true;}
    72             void tick(float dt);
    73             Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
    74 
     73            inline Clock& getClock()
     74                { return this->clock_; }
    7575
    7676            bool allowPawnHit(Pawn* victim, Pawn* originator);
     77            bool allowPawnDamage(Pawn* victim, Pawn* originator);
     78            bool allowPawnDeath(Pawn* victim, Pawn* originator);
    7779
    78             bool allowPawnDamage(Pawn* victim, Pawn* originator);
     80        protected:
     81            virtual void playerEntered(PlayerInfo* player); ///< Initializes values.
    7982
    80             bool allowPawnDeath(Pawn* victim, Pawn* originator);
    81         protected:
    82             virtual void playerEntered(PlayerInfo* player); //!< Initializes values.
    83             virtual bool playerLeft(PlayerInfo* player); //!< Manages all local variables.
    8483        private:
    8584            bool cantMove_;
    86             std::map<PlayerInfo*, int>checkpointReached_; //The number of the last check point reached by each player.
    87             std::set<float> scores_; //The times of the players are saved in a set.
    88             bool bTimeIsUp_; //True if one of the check points is reached too late.
    89            
    90             int playersAlive_;
     85            std::map<PlayerInfo*, int> checkpointReached_; ///< The number of the last check point reached by each player.
     86            bool bTimeIsUp_;                               ///< True if one of the check points is reached too late.
     87
     88            Clock clock_; ///< The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
    9189    };
    9290}
Note: See TracChangeset for help on using the changeset viewer.