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:
6 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r9667 r10624  
    4040namespace orxonox
    4141{
    42     RegisterAbstractClass(CollectiblePickup).inheritsFrom(Class(Pickupable));
     42    RegisterAbstractClass(CollectiblePickup).inheritsFrom<Pickupable>();
    4343
    4444    /**
  • 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    }
  • code/trunk/src/modules/pickup/PickupManager.h

    r9667 r10624  
    161161            std::map<uint32_t, PickupInventoryContainer*>::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_.
    162162
    163             std::map<uint32_t, WeakPtr<Pickupable>*> pickups_; //!< Map linking a number identifying a Pickupable to a weak pointer of a Pickupable.
     163            std::map<uint32_t, WeakPtr<Pickupable> > pickups_; //!< Map linking a number identifying a Pickupable to a weak pointer of a Pickupable.
    164164            std::map<Pickupable*, uint32_t> indexes_;//!< Map linking Pickupable to the number identifying it.
    165165
  • code/trunk/src/modules/pickup/PickupSpawner.cc

    r9667 r10624  
    145145        if(GameMode::isMaster() && this->isActive())
    146146        {
    147             WeakPtr<PickupSpawner> spawner = this; // Create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup)
     147            // TODO: why is this a WeakPtr when the comment says StrongPtr?
     148            WeakPtr<PickupSpawner> spawner = this; // Create a strong pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup)
    148149
    149150            // Remove PickupCarriers from the blocked list if they have exceeded their time.
  • code/trunk/src/modules/pickup/items/ShrinkPickup.cc

    r9667 r10624  
    182182
    183183                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    184                 const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     184                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
    185185                int size = cameraPositions.size();
    186186                for(int index = 0; index < size; index++)
     
    208208
    209209                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    210                 const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     210                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
    211211                int size = cameraPositions.size();
    212212                for(int index = 0; index < size; index++)
     
    263263
    264264                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    265                 const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     265                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
    266266                int size = cameraPositions.size();
    267267                for(int index = 0; index < size; index++)
     
    304304
    305305                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    306                 const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     306                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
    307307                int size = cameraPositions.size();
    308308                for(int index = 0; index < size; index++)
Note: See TracChangeset for help on using the changeset viewer.