Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 16, 2010, 2:18:45 PM (14 years ago)
Author:
dafrick
Message:

Resolving some more TODO's.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/pickup/PickupSpawner.h

    r7547 r7549  
    3838#include "PickupPrereqs.h"
    3939
     40#include <map>
    4041#include <string>
    4142#include "tools/Timer.h"
     
    102103            inline int getMaxSpawnedItems(void) const
    103104                { return this->maxSpawnedItems_; }
    104            
    105105
    106106        protected:
    107107            void decrementSpawnsRemaining(void); //!< Decrements the number of remaining spawns.
    108             void startRespawnTimer(void);
     108            void startRespawnTimer(void); //!< Invoked by the timer, re-activates the PickupSpawner.
     109
     110            /**
     111            @brief Helper method. Adds a PickupCarrier to the list of PickupCarrier that are blocked form getting a Pickupable from the PickupSpawner for a specified time.
     112            @param carrier A pointer to the PickupCarrier to be blocked.
     113            @param time The time for which the Pawn is blocked. Default is 5.
     114            */
     115            void block(PickupCarrier* carrier, unsigned int time = DEFAULT_BLOCKED_TIME)
     116                { this->blocked_.insert(std::pair<PickupCarrier*, std::time_t>(carrier, std::time(0)+time)); }
    109117
    110118            /**
     
    142150            float respawnTime_; //!< Time after which this gets re-actived.
    143151            Timer respawnTimer_; //!< Timer used for re-activating.
     152            std::map<PickupCarrier*, std::time_t> blocked_;
    144153
    145154            bool selfDestruct_; //!< True if the PickupSpawner is selfdestructing.
    146155
    147156            static const int INF = -1; //!< Constant for infinity.
     157            static const unsigned int DEFAULT_BLOCKED_TIME = 5; //!< The default time a PickupCarrier is blocked after picking up a Pickupable.
    148158    };
    149159}
Note: See TracChangeset for help on using the changeset viewer.