Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2010, 10:44:10 PM (14 years ago)
Author:
dafrick
Message:

Loads of changes.
1) PickupInventory should now be working even for extreme cases.
2) Added support for inactive Spawnpoints in Gametype.
3) Made Pickupable rewardble. meaning from now on any Pickupable can be given as a reward for completing Quests.
4) Added some keybinds to KeybindMenu, such as PickupInventory, QuestGUI and Chat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/modules/pickup/PickupManager.cc

    r6965 r6996  
    3939#include "core/ScopedSingletonManager.h"
    4040#include "core/Identifier.h"
     41#include "util/Convert.h"
    4142#include "interfaces/PickupCarrier.h"
    4243#include "infos/PlayerInfo.h"
     
    6465       
    6566        this->defaultRepresentation_ = new PickupRepresentation();
    66         this->pickupsIndex_ = 0;
    6767       
    6868        COUT(3) << "PickupManager created." << std::endl;
     
    154154    {
    155155        this->pickupsList_.clear();
    156         this->pickupsIndex_ = 0;
    157156       
    158157        PlayerInfo* player = GUIManager::getInstance().getPlayer(PickupManager::guiName_s);
     
    169168            for(std::set<Pickupable*>::iterator pickup = pickups.begin(); pickup != pickups.end(); pickup++)
    170169            {
    171                 this->pickupsList_.insert(*pickup);
     170                this->pickupsList_.insert(std::pair<Pickupable*, WeakPtr<Pickupable> >(*pickup, WeakPtr<Pickupable>(*pickup)));
    172171            }
    173172        }
     
    199198    void PickupManager::dropPickup(orxonox::Pickupable* pickup)
    200199    {
     200        std::map<Pickupable*, WeakPtr<Pickupable> >::iterator it = this->pickupsList_.find(pickup);
     201        if(pickup == NULL || it == this->pickupsList_.end() || it->second.get() == NULL)
     202            return;
     203
    201204        if(!pickup->isPickedUp())
    202205            return;
    203        
     206
    204207        PickupCarrier* carrier = pickup->getCarrier();
    205208        if(pickup != NULL && carrier != NULL)
     209        {
    206210            carrier->drop(pickup);
     211        }
    207212    }
    208213
    209214    void PickupManager::usePickup(orxonox::Pickupable* pickup, bool use)
    210215    {
     216        std::map<Pickupable*, WeakPtr<Pickupable> >::iterator it = this->pickupsList_.find(pickup);
     217        if(pickup == NULL || it == this->pickupsList_.end() || it->second.get() == NULL)
     218            return;
     219       
    211220        if(!pickup->isPickedUp())
    212221            return;
Note: See TracChangeset for help on using the changeset viewer.