Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 9:12:21 PM (9 years ago)
Author:
landauf
Message:

merged branch core7 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/pickup/PickupManager.cc

    r9667 r10624  
    3838#include "core/GUIManager.h"
    3939#include "core/class/Identifier.h"
     40#include "core/singleton/ScopedSingletonIncludes.h"
    4041#include "network/Host.h"
    41 #include "network/NetworkFunction.h"
    42 #include "util/ScopedSingletonManager.h"
     42#include "network/NetworkFunctionIncludes.h"
    4343
    4444#include "infos/PlayerInfo.h"
     
    5151namespace orxonox
    5252{
    53     ManageScopedSingleton(PickupManager, ScopeID::Root, false);
     53    ManageScopedSingleton(PickupManager, ScopeID::ROOT, false);
    5454
    5555    // Initialization of the name of the PickupInventory GUI.
     
    6262    registerStaticNetworkFunction(PickupManager::usePickupNetworked);
    6363
     64    RegisterAbstractClass(PickupManager).inheritsFrom<PickupListener>();
     65
    6466    /**
    6567    @brief
     
    9496
    9597        // Destroying all the WeakPointers that are still there.
    96         for(std::map<uint32_t, WeakPtr<Pickupable>*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
    97             delete it->second;
    9898        this->pickups_.clear();
    9999
     
    212212        else
    213213        {
    214             callStaticNetworkFunction(PickupManager::pickupChangedUsedNetwork, clientId, index, used, pickup->isUsable(), pickup->isUnusable());
     214            callStaticNetworkFunction(&PickupManager::pickupChangedUsedNetwork, clientId, index, used, pickup->isUsable(), pickup->isUnusable());
    215215        }
    216216    }
     
    286286            // Add the Pickupable to the indexes_ and pickups_ lists.
    287287            this->indexes_[pickup] = index;
    288             this->pickups_[index] = new WeakPtr<Pickupable>(pickup);
     288            this->pickups_[index] = pickup;
    289289        }
    290290        else // If it was dropped, it is removed from the required lists.
     
    294294            index = it->second;
    295295
    296             // Remove the Pickupable form the indexes_ and pickups_ list.
    297             WeakPtr<Pickupable>* ptr = this->pickups_[index];
     296            // Remove the Pickupable from the indexes_ and pickups_ list.
    298297            this->indexes_.erase(it);
    299298            this->pickups_.erase(index);
    300             delete ptr;
    301299        }
    302300
     
    316314            if(this->representations_.find(pickup->getRepresentationName()) == this->representations_.end())
    317315            {
    318                 callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp);
     316                callStaticNetworkFunction(&PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp);
    319317            }
    320318            else
    321319            {
    322                 callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickedUp);
     320                callStaticNetworkFunction(&PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickedUp);
    323321            }
    324322        }
     
    400398            if(this->pickups_.empty())
    401399                return;
    402             Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
     400            Pickupable* pickupable = this->pickups_.find(pickup)->second;
    403401            if(pickupable != NULL)
    404402                pickupable->drop();
     
    407405        else
    408406        {
    409             callStaticNetworkFunction(PickupManager::dropPickupNetworked, 0, pickup);
     407            callStaticNetworkFunction(&PickupManager::dropPickupNetworked, 0, pickup);
    410408        }
    411409    }
     
    443441            if(this->pickups_.empty())
    444442                return;
    445             Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
     443            Pickupable* pickupable = this->pickups_.find(pickup)->second;
    446444            if(pickupable != NULL)
    447445                pickupable->setUsed(use);
     
    450448        else
    451449        {
    452             callStaticNetworkFunction(PickupManager::usePickupNetworked, 0, pickup, use);
     450            callStaticNetworkFunction(&PickupManager::usePickupNetworked, 0, pickup, use);
    453451        }
    454452    }
Note: See TracChangeset for help on using the changeset viewer.