Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 26, 2009, 10:06:54 AM (14 years ago)
Author:
dafrick
Message:

Some Documenting and bug fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/modules/pickup/PickupSpawner.cc

    r6419 r6421  
    5353    /**
    5454    @brief
    55         Constructor. Registers the PickupSpawner.
     55        Constructor. Creates a blank PickupSpawner.
    5656    @param creator
    5757        Pointer to the object which created this item.
     
    6262    }
    6363
     64    /**
     65    @brief
     66        Constructor, Creates a fully functional PickupSpawner.
     67    @param creator
     68        The creator of this PickupSpawner.
     69    @param pickup
     70        The Pickupable to be spawned by this PickupSpawner.
     71    @param triggerDistance
     72        The distance at which the PickupSpawner will trigger.
     73    @param respawnTime
     74        The minimum time between two spawns.
     75    @param maySpawnedItems
     76        The maximum number of items spawned by this PickupSpawner.
     77    */
    6478    PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator)
    6579    {
     
    7387    }
    7488
     89    /**
     90    @brief
     91        Registers the object and sets some default values.
     92    */
    7593    void PickupSpawner::initialize(void)
    7694    {
     
    92110    PickupSpawner::~PickupSpawner()
    93111    {
    94        
     112        if(this->pickup_ != NULL)
     113            delete this->pickup_;
    95114    }
    96115
     
    107126        SUPER(PickupSpawner, XMLPort, xmlelement, mode);
    108127
    109         XMLPortObject(PickupSpawner, Pickupable, "pickup", addPickupable, getPickupable, xmlelement, mode);
     128        XMLPortObject(PickupSpawner, Pickupable, "pickup", setPickupable, getPickupable, xmlelement, mode);
    110129       
    111130        XMLPortParam(PickupSpawner, "triggerDistance", setTriggerDistance, getTriggerDistance, xmlelement, mode);
     
    128147        //  & load the GUI itself too, along with some empty windows
    129148        //   = even less delays
    130 //         GUIManager::showGUI("PickupInventory");
    131 //         GUIManager::hideGUI("PickupInventory");
     149//         GUIManager::getInstance().showGUI("PickupInventory");
     150//         GUIManager::getInstance().executeCode("hideGUI(\"PickupInventory\")");
    132151//         PickupInventory::getSingleton();
    133152    }
    134153   
    135     void PickupSpawner::addPickupable(Pickupable* pickup)
     154    /**
     155    @brief
     156        Sets a Pickupable for the PickupSpawner to spawn.
     157    @param pickup
     158        The Pickupable to be set.
     159    */
     160    void PickupSpawner::setPickupable(Pickupable* pickup)
    136161    {
    137162        if(this->pickup_ != NULL)
     
    149174    }
    150175   
    151     Pickupable* PickupSpawner::getPickupable(void)
     176    /**
     177    @brief
     178        Get the Pickupable that is spawned by this PickupSpawner.
     179    @return
     180        Returns the Pickupable that is spawned by this PickupSpawner.
     181    */
     182    const Pickupable* PickupSpawner::getPickupable(void)
    152183    {
    153184        return this->pickup_;
     
    166197//     }
    167198
     199    /**
     200    @brief
     201        Sets the maximum number of spawned items.
     202    @param items
     203        The maximum number of spawned items to be set.
     204    */
    168205    void PickupSpawner::setMaxSpawnedItems(int items)
    169206    {
     
    243280    }
    244281   
     282    /**
     283    @brief
     284        Decrements the number of remaining spawns.
     285        Sets the PickupSpawner to inactive for the duration of the respawnTime.
     286        Destroys the PickupSpawner if the number of remaining spawns has reached zero.
     287       
     288    */
    245289    void PickupSpawner::decrementSpawnsRemaining(void)
    246290    {
     
    251295        if(this->spawnsRemaining_ != 0 && this->respawnTime_ > 0)
    252296        {
    253             //TODO: Nicer?
     297            //TODO: Nicer? Does this even work?
    254298            this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));
    255299
Note: See TracChangeset for help on using the changeset viewer.