Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 13, 2010, 10:57:13 PM (14 years ago)
Author:
dafrick
Message:

Some cleanup in PickupManager.

Location:
code/trunk/src/modules/pickup
Files:
2 edited

Legend:

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

    r7533 r7539  
    3434#include "PickupManager.h"
    3535
    36 #include "util/Convert.h"
    37 #include "util/ScopedSingletonManager.h"
    3836#include "core/CoreIncludes.h"
    3937#include "core/LuaState.h"
     
    4240#include "network/Host.h"
    4341#include "network/NetworkFunction.h"
    44 
     42#include "util/ScopedSingletonManager.h"
     43
     44#include "infos/PlayerInfo.h"
    4545#include "interfaces/PickupCarrier.h"
    46 #include "infos/PlayerInfo.h"
    4746#include "worldentities/pawns/Pawn.h"
    4847
     
    9695        this->representationsNetworked_.clear();
    9796
    98         //TODO: Destroying properly?
    99         //TODO: Shouldnt these list be empty, to avoid problems when switching levels?
    10097        // Destroying all the PickupInventoryContainers that are still there.
    10198        for(std::map<uint32_t, PickupInventoryContainer*>::iterator it = this->pickupInventoryContainers_.begin(); it != this->pickupInventoryContainers_.end(); it++)
     
    484481    {
    485482        // If we're either server or standalone and the list of pickups is not empty, we find and drop the input pickup.
    486         if(GameMode::isMaster() && !this->pickups_.empty())
    487         {
     483        if(GameMode::isMaster())
     484        {
     485            if(this->pickups_.empty())
     486                return;
    488487            Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
    489488            if(pickupable != NULL)
     
    509508        {
    510509            PickupManager& manager = PickupManager::getInstance();
    511             //TODO: Just call dropPickup() on manager?
    512             if(manager.pickups_.empty())
    513                 return;
    514             Pickupable* pickupable = manager.pickups_.find(pickup)->second->get();
    515             if(pickupable != NULL)
    516                 pickupable->drop();
     510            manager.dropPickup(pickup);
    517511        }
    518512    }
     
    530524    {
    531525        // If we're either server or standalone and the list of pickups is not empty, we find and change the used status of the input pickup.
    532         if(GameMode::isMaster() && !this->pickups_.empty())
    533         {
     526        if(GameMode::isMaster())
     527        {
     528            if(this->pickups_.empty())
     529                return;
    534530            Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
    535531            if(pickupable != NULL)
     
    557553        {
    558554            PickupManager& manager = PickupManager::getInstance();
    559             //TODO: Just call usePickup() on manager?
    560             if(manager.pickups_.empty())
    561                 return;
    562             Pickupable* pickupable = manager.pickups_.find(pickup)->second->get();
    563             if(pickupable != NULL)
    564                 pickupable->setUsed(use);
     555            manager.usePickup(pickup, use);
    565556        }
    566557    }
  • code/trunk/src/modules/pickup/PickupRepresentation.h

    r7504 r7539  
    5454        The PickupRepresentation class represents a specific pickup type (identified by its PickupIdentifier). It defines the information displayed in the GUI and how PickupSpawners that spawn the pickup type look like.
    5555        They are created through XML and are registered with the PickupManager.
     56
     57    @author
     58        Damian 'Mozork' Frick
     59
     60    @ingroup Pickup
    5661    */
    5762    class _PickupExport PickupRepresentation // tolua_export
Note: See TracChangeset for help on using the changeset viewer.