[Orxonox-commit 2801] r7504 - in code/trunk: data/gui/scripts src/modules/notifications src/modules/pickup src/orxonox src/orxonox/interfaces

dafrick at orxonox.net dafrick at orxonox.net
Wed Oct 6 08:00:40 CEST 2010


Author: dafrick
Date: 2010-10-06 08:00:40 +0200 (Wed, 06 Oct 2010)
New Revision: 7504

Added:
   code/trunk/src/orxonox/interfaces/PickupListener.cc
   code/trunk/src/orxonox/interfaces/PickupListener.h
Modified:
   code/trunk/data/gui/scripts/PickupInventory.lua
   code/trunk/src/modules/notifications/NotificationManager.cc
   code/trunk/src/modules/pickup/PickupManager.cc
   code/trunk/src/modules/pickup/PickupManager.h
   code/trunk/src/modules/pickup/PickupRepresentation.cc
   code/trunk/src/modules/pickup/PickupRepresentation.h
   code/trunk/src/orxonox/CMakeLists.txt
   code/trunk/src/orxonox/interfaces/CMakeLists.txt
   code/trunk/src/orxonox/interfaces/Pickupable.cc
   code/trunk/src/orxonox/interfaces/Pickupable.h
Log:
Pickups module is now (from what I can tell after some basic testing) fully functional over the network.
However it's still a little messy, needs some cleanup and documentation.
I introduced a new class, the PickupListener, which allows reacting to pickups becoming used, unused, picked up or dropped.


Modified: code/trunk/data/gui/scripts/PickupInventory.lua
===================================================================
--- code/trunk/data/gui/scripts/PickupInventory.lua	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/data/gui/scripts/PickupInventory.lua	2010-10-06 06:00:40 UTC (rev 7504)
@@ -44,27 +44,27 @@
             if pickup ~= nil and pickup ~= 0 then
                 local useButton = winMgr:getWindow("orxonox/PickupInventory/Details" .. k .. "/UseButton")
                 local dropButton = winMgr:getWindow("orxonox/PickupInventory/Details" .. k .. "/DropButton")
-                if orxonox.PickupManager:getInstance():isValidPickup(pickup) == false then
+                if orxonox.PickupManager:getInstance():isValidPickup(pickup.pickup) == false then
                     useButton:setEnabled(false)
                     dropButton:setEnabled(false)
                     P.detailPickups[k] = nil
                 else
                     useButton:setEnabled(true)
-                    if pickup:isUsed() == true then
+                    if pickup.inUse == true then
                         useButton:setText("unuse")
                         orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseDetailButton_clicked")
-                        if pickup:isUsable() == false then
+                        if pickup.usable == false then
                             useButton:setEnabled(false)
                         end
                     else
                         useButton:setText("use")
                         orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseDetailButton_clicked")
-                        if pickup:isUnusable() == false then
+                        if pickup.unusable == false then
                             useButton:setEnabled(false)
                         end
                     end
 
-                    if pickup:isPickedUp() == false then
+                    if pickup.pickedUp == false then
                         useButton:setEnabled(false)
                         dropButton:setEnabled(false)
                         P.detailPickups[k] = nil
@@ -107,7 +107,7 @@
 end
 
 function P.createPickupEntry(index, pickup)
-    local representation = orxonox.PickupManager:getInstance():getPickupRepresentation(pickup)
+    local representation = orxonox.PickupManager:getInstance():getPickupRepresentation(pickup.pickup)
 
     local name = "orxonox/PickupInventory/Box/Pickup" .. index
 
@@ -132,16 +132,16 @@
     local useButton = winMgr:createWindow("MenuWidgets/Button", name .. "/UseButton")
     useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+10),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2)))
     useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight)))
-    if pickup:isUsed() == false then
+    if pickup.inUse == false then
         useButton:setText("use")
         orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseButton_clicked")
-        if pickup:isUsable() == false then
+        if pickup.usable == false then
             useButton:setEnabled(false)
         end
     else
         useButton:setText("unuse")
         orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseButton_clicked")
-        if pickup:isUnusable() == false then
+        if pickup.unusable == false then
             useButton:setEnabled(false)
         end
     end
@@ -192,7 +192,7 @@
 
 function P.createDetailsWindow(pickupIndex)
     local pickup = P.pickupsList[pickupIndex]
-    local representation = orxonox.PickupManager:getInstance():getPickupRepresentation(pickup)
+    local representation = orxonox.PickupManager:getInstance():getPickupRepresentation(pickup.pickup)
 
     local index = P.getNewDetailNumber()
     local name = "orxonox/PickupInventory/Details" .. index
@@ -237,16 +237,16 @@
     local useButton = winMgr:createWindow("MenuWidgets/Button", name .. "/UseButton")
     useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.detailImageSize+10),CEGUI.UDim(1, -40)))
     useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight)))
-    if pickup:isUsed() == false then
+    if pickup.inUse == false then
         useButton:setText("use")
         orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseDetailButton_clicked")
-        if pickup:isUsable() == false then
+        if pickup.usable == false then
             useButton:setEnabled(false)
         end
     else
         useButton:setText("unuse")
         orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseDetailButton_clicked")
-        if pickup:isUnusable() == false then
+        if pickup.unusable == false then
             useButton:setEnabled(false)
         end
     end
@@ -276,17 +276,20 @@
 
 function P.InventoryUseButton_clicked(e)
     local pickupIndex = P.windowToPickupHelper(e)
-    orxonox.PickupManager:getInstance():usePickup(P.pickupsList[pickupIndex], true)
+    local pickup = P.pickupsList[pickupIndex]
+    orxonox.PickupManager:getInstance():usePickup(pickup.pickup, true)
 end
 
 function P.InventoryUnuseButton_clicked(e)
     local pickupIndex = P.windowToPickupHelper(e)
-    orxonox.PickupManager:getInstance():usePickup(P.pickupsList[pickupIndex], false)
+    local pickup = P.pickupsList[pickupIndex]
+    orxonox.PickupManager:getInstance():usePickup(pickup.pickup, false)
 end
 
 function P.InventoryDropButton_clicked(e)
     local pickupIndex = P.windowToPickupHelper(e)
-    orxonox.PickupManager:getInstance():dropPickup(P.pickupsList[pickupIndex])
+    local pickup = P.pickupsList[pickupIndex]
+    orxonox.PickupManager:getInstance():dropPickup(pickup.pickup)
 end
 
 function P.InventoryDetailsButton_clicked(e)
@@ -296,17 +299,20 @@
 
 function P.InventoryUseDetailButton_clicked(e)
     local pickupIndex = P.windowToPickupHelper(e)
-    orxonox.PickupManager:getInstance():usePickup(P.detailPickups[pickupIndex], true)
+    local pickup = P.detailPickups[pickupIndex]
+    orxonox.PickupManager:getInstance():usePickup(pickup.pickup, true)
 end
 
 function P.InventoryUnuseDetailButton_clicked(e)
     local pickupIndex = P.windowToPickupHelper(e)
-    orxonox.PickupManager:getInstance():usePickup(P.detailPickups[pickupIndex], false)
+    local pickup = P.detailPickups[pickupIndex]
+    orxonox.PickupManager:getInstance():usePickup(pickup.pickup, false)
 end
 
 function P.InventoryDropDetailButton_clicked(e)
     local pickupIndex = P.windowToPickupHelper(e)
-    orxonox.PickupManager:getInstance():dropPickup(P.detailPickups[pickupIndex])
+    local pickup = P.detailPickups[pickupIndex]
+    orxonox.PickupManager:getInstance():dropPickup(pickup.pickup)
 end
 
 function P.closeDetailWindow(e)

Modified: code/trunk/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.cc	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/src/modules/notifications/NotificationManager.cc	2010-10-06 06:00:40 UTC (rev 7504)
@@ -248,7 +248,7 @@
 
         // If all senders are the target of the NotificationListener, then the list of Notifications for that specific NotificationListener is the same as the list of all Notifications.
         bool bAll = set.find(NotificationManager::ALL) != set.end();
-        std::multimap<std::time_t, Notification*>* map;
+        std::multimap<std::time_t, Notification*>* map = NULL;
         if(bAll)
             this->notificationLists_[index] = &this->allNotificationsList_;
         // Else a new list (resp. multimap) is created and added to the list of Notification lists for NotificationListeners.

Modified: code/trunk/src/modules/pickup/PickupManager.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.cc	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/src/modules/pickup/PickupManager.cc	2010-10-06 06:00:40 UTC (rev 7504)
@@ -39,6 +39,8 @@
 #include "core/LuaState.h"
 #include "core/GUIManager.h"
 #include "core/Identifier.h"
+#include "network/Host.h"
+#include "network/NetworkFunction.h"
 #include "interfaces/PickupCarrier.h"
 #include "infos/PlayerInfo.h"
 #include "worldentities/pawns/Pawn.h"
@@ -52,20 +54,23 @@
     // Register tolua_open function when loading the library
     DeclareToluaInterface(Pickup);
 
-    ManageScopedSingleton(PickupManager, ScopeID::Graphics, false);
+    ManageScopedSingleton(PickupManager, ScopeID::Root, false);
 
     /*static*/ const std::string PickupManager::guiName_s = "PickupInventory";
 
+    registerStaticNetworkFunction(PickupManager::pickupChangedUsedNetwork);
+    registerStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork);
+    registerStaticNetworkFunction(PickupManager::dropPickupNetworked);
+    registerStaticNetworkFunction(PickupManager::usePickupNetworked);
+
     /**
     @brief
         Constructor. Registers the PickupManager and creates the default PickupRepresentation.
     */
-    PickupManager::PickupManager() : defaultRepresentation_(NULL)
+    PickupManager::PickupManager() : guiLoaded_(false), pickupIndex_(0), defaultRepresentation_(NULL)
     {
-        RegisterRootObject(PickupManager);
+        RegisterObject(PickupManager);
 
-        GUIManager::getInstance().loadGUI(PickupManager::guiName_s);
-
         this->defaultRepresentation_ = new PickupRepresentation();
 
         COUT(3) << "PickupManager created." << std::endl;
@@ -83,6 +88,8 @@
 
         this->representations_.clear();
 
+        //TODO: Destroy properly...
+
         COUT(3) << "PickupManager destroyed." << std::endl;
     }
 
@@ -102,7 +109,7 @@
         assert(identifier);
         assert(representation);
 
-        if(this->representations_.find(identifier) != this->representations_.end()) // If the Pickupable already has a Representation registered.
+        if(!this->representations_.empty() && this->representations_.find(identifier) != this->representations_.end()) // If the Pickupable already has a Representation registered.
             return false;
 
         this->representations_[identifier] = representation;
@@ -111,6 +118,17 @@
         return true;
     }
 
+    bool PickupManager::registerRepresentation(PickupRepresentation* representation)
+    {
+        assert(representation);
+
+        if(!this->representationsNetworked_.empty() && this->representationsNetworked_.find(representation->getObjectID()) != this->representationsNetworked_.end()) // If the PickupRepresentation is already registered.
+            return false;
+
+        this->representationsNetworked_[representation->getObjectID()] = representation;
+        return true;
+    }
+
     /**
     @brief
         Unegisters a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.
@@ -136,6 +154,18 @@
         return true;
     }
 
+    bool PickupManager::unregisterRepresentation(PickupRepresentation* representation)
+    {
+        assert(representation);
+
+        std::map<uint32_t, PickupRepresentation*>::iterator it = this->representationsNetworked_.find(representation->getObjectID());
+        if(it == this->representationsNetworked_.end()) //!< If the Pickupable is not registered in the first place.
+            return false;
+
+        this->representationsNetworked_.erase(it);
+        return true;
+    }
+
     /**
     @brief
         Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier.
@@ -165,12 +195,21 @@
     @return
         Returns the PickupRepresentation of the input Pickupable or NULL if an error occurred.
     */
-    orxonox::PickupRepresentation* PickupManager::getPickupRepresentation(orxonox::Pickupable* pickup)
+    orxonox::PickupRepresentation* PickupManager::getPickupRepresentation(uint64_t pickup)
     {
-        if(pickup != NULL)
-            return this->getRepresentation(pickup->getPickupIdentifier());
+        this->representationsNetworked_.clear();
+        for(ObjectList<PickupRepresentation>::iterator it = ObjectList<PickupRepresentation>::begin(); it != ObjectList<PickupRepresentation>::end(); ++it)
+            this->representationsNetworked_[it->getObjectID()] = *it;
 
-        return NULL;
+        std::map<uint64_t, PickupInventoryContainer*>::iterator it = this->pickupInventoryContainers_.find(pickup);
+        if(it == this->pickupInventoryContainers_.end())
+            return this->defaultRepresentation_;
+
+        std::map<uint32_t, PickupRepresentation*>::iterator it2 = this->representationsNetworked_.find(it->second->representationObjectId);
+        if(it2 == this->representationsNetworked_.end())
+            return this->defaultRepresentation_;
+
+        return it2->second;
     }
 
     /**
@@ -182,79 +221,42 @@
     */
     int PickupManager::getNumPickups(void)
     {
-        this->pickupsList_.clear(); // Clear the list if Pickupables.
-
-        PlayerInfo* player = GUIManager::getInstance().getPlayer(PickupManager::guiName_s);
-        PickupCarrier* carrier = NULL;
-        if (player != NULL)
-            carrier =  orxonox_cast<PickupCarrier*>(player->getControllableEntity());
-        else
-            return 0;
-
-        std::vector<PickupCarrier*>* carriers = this->getAllCarriers(carrier); // Get a list of all the entities which carry the players Pickupables.
-        // Iterate through all the carriers and add their Pickupable to the list.
-        for(std::vector<PickupCarrier*>::iterator it = carriers->begin(); it != carriers->end(); it++)
-        {
-            std::set<Pickupable*> pickups = (*it)->getPickups();
-            for(std::set<Pickupable*>::iterator pickup = pickups.begin(); pickup != pickups.end(); pickup++)
-            {
-                CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(*pickup);
-                // If the Pickupable is in a PickupCollection it is not added to the list and thus not displayed in the PickupInventory.
-                if(collectible == NULL || !collectible->isInCollection())
-                    this->pickupsList_.insert(std::pair<Pickupable*, WeakPtr<Pickupable> >(*pickup, WeakPtr<Pickupable>(*pickup)));
-            }
-        }
-        delete carriers;
-
-        this->pickupsIterator_ = this->pickupsList_.begin(); //Set the iterator to the start of the list.
-        return this->pickupsList_.size();
+        this->pickupsIterator_ = this->pickupInventoryContainers_.begin();
+        return this->pickupInventoryContainers_.size();
     }
 
     /**
     @brief
-        Helper method. Get all the PickupCarriers that carry Pickupables, recursively.
-    @param carrier
-        The PickupCarrier whose children should be added to the list of PickupCarriers.
-    @param carriers
-        The list of PickupCarriers, used in "recursive-mode".
-        For the first instance this is just NULL (which is default and can be omitted) upon which a new list is allocated.
-    @return
-        Returns the list of PickupCarriers.
-    */
-    std::vector<PickupCarrier*>* PickupManager::getAllCarriers(PickupCarrier* carrier, std::vector<PickupCarrier*>* carriers)
-    {
-        if(carriers == NULL) // Create a new list if no list was passed.
-            carriers = new std::vector<PickupCarrier*>();
-
-        carriers->insert(carriers->end(), carrier); // Add the input PickupCarrier to the list.
-
-        std::vector<PickupCarrier*>* children = carrier->getCarrierChildren(); // Get the children of the input PickupCarrier.
-        // Iterate through the children and add them (and their children) to the list by recursively executing getAllCarriers().
-        for(std::vector<PickupCarrier*>::iterator it = children->begin(); it != children->end(); it++)
-            this->getAllCarriers(*it, carriers);
-        delete children;
-
-        return carriers;
-    }
-
-    /**
-    @brief
         Drop the input Pickupable.
         This method checks whether the inout Pickupable still exists and drops it, if so.
     @param pickup
         The Pickupable to be dropped.
     */
-    void PickupManager::dropPickup(orxonox::Pickupable* pickup)
+    void PickupManager::dropPickup(uint64_t pickup)
     {
-        if(pickup == NULL)
-            return;
+        if(GameMode::isMaster() && !this->pickups_.empty())
+        {
+            Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
+            if(pickupable != NULL)
+                pickupable->drop();
+        }
+        else
+        {
+            callStaticNetworkFunction(PickupManager::dropPickupNetworked, 0, pickup);
+        }
+    }
 
-        std::map<Pickupable*, WeakPtr<Pickupable> >::iterator it = this->pickupsList_.find(pickup); // Get the WeakPointer of the Pickupable.
-        // If either the input Pickupable is not in the PickupManagers list or it no longer exists, the method returns.
-        if(it == this->pickupsList_.end() || it->second.get() == NULL)
-            return;
-
-        pickup->drop(); // The Pickupable is dropped.
+    /*static*/ void PickupManager::dropPickupNetworked(uint64_t pickup)
+    {
+        if(GameMode::isServer())
+        {
+            PickupManager& manager = PickupManager::getInstance();
+            if(manager.pickups_.empty())
+                return;
+            Pickupable* pickupable = manager.pickups_.find(pickup)->second->get();
+            if(pickupable != NULL)
+                pickupable->drop();
+        }
     }
 
     /**
@@ -266,17 +268,31 @@
     @param use
         If true the input Pickupable is used, if false it is unused.
     */
-    void PickupManager::usePickup(orxonox::Pickupable* pickup, bool use)
+    void PickupManager::usePickup(uint64_t pickup, bool use)
     {
-        if(pickup == NULL)
-            return;
+        if(GameMode::isMaster() && !this->pickups_.empty())
+        {
+            Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
+            if(pickupable != NULL)
+                pickupable->setUsed(use);
+        }
+        else
+        {
+            callStaticNetworkFunction(PickupManager::usePickupNetworked, 0, pickup, use);
+        }
+    }
 
-        std::map<Pickupable*, WeakPtr<Pickupable> >::iterator it = this->pickupsList_.find(pickup); // Get the WeakPointer of the Pickupable.
-        // If either the input Pickupable is not in the PickupManagers list or it no longer exists, the method returns.
-        if(it == this->pickupsList_.end() || it->second.get() == NULL)
-            return;
-
-        pickup->setUsed(use); // The Pickupable is used (or unused).
+    /*static*/ void PickupManager::usePickupNetworked(uint64_t pickup, bool use)
+    {
+        if(GameMode::isServer())
+        {
+            PickupManager& manager = PickupManager::getInstance();
+            if(manager.pickups_.empty())
+                return;
+            Pickupable* pickupable = manager.pickups_.find(pickup)->second->get();
+            if(pickupable != NULL)
+                pickupable->setUsed(use);
+        }
     }
 
     /**
@@ -287,12 +303,168 @@
     @return
         Returns true if the input Pickupable is still valid, false if not.
     */
-    bool PickupManager::isValidPickup(orxonox::Pickupable* pickup)
+    bool PickupManager::isValidPickup(uint64_t pickup)
     {
-        std::map<Pickupable*, WeakPtr<Pickupable> >::iterator it = this->pickupsList_.find(pickup); // Get the WeakPointer of the Pickupable.
-        if(it == this->pickupsList_.end()) // If the Pickupable is not in the PickupManager's list.
-            return false;
-        return it->second.get() != NULL; // Returns whether the Pickupable still exists.
+        return this->pickups_.find(pickup) != this->pickups_.end();
     }
 
+    void PickupManager::pickupChangedUsed(Pickupable* pickup, bool used)
+    {
+        assert(pickup);
+
+        if(!GameMode::isMaster()) // If this is neither standalone nor the server.
+            return;
+
+        CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(pickup);
+        // If the Picupable is part of a PickupCollection it isn't displayed in the PickupInventory, just the PickupCollection is.
+        if(collectible != NULL && collectible->isInCollection())
+            return;
+
+        PickupCarrier* carrier = pickup->getCarrier();
+        while(carrier->getCarrierParent() != NULL)
+            carrier = carrier->getCarrierParent();
+        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
+        if(pawn == NULL)
+            return;
+        PlayerInfo* info = pawn->getPlayer();
+        if(info == NULL)
+            return;
+        unsigned int clientId = info->getClientID();
+
+        std::map<Pickupable*, uint64_t>::iterator it = this->indexes_.find(pickup);
+        assert(it != this->indexes_.end());
+
+        uint64_t index = it->second;
+        if(GameMode::isStandalone() || Host::getPlayerID() == clientId)
+        {
+            PickupManager::pickupChangedUsedNetwork(index, used, pickup->isUsable(), pickup->isUnusable());
+        }
+        else
+        {
+            callStaticNetworkFunction(PickupManager::pickupChangedUsedNetwork, clientId, index, used, pickup->isUsable(), pickup->isUnusable());
+        }
+    }
+
+    /*static*/ void PickupManager::pickupChangedUsedNetwork(uint64_t pickup, bool inUse, bool usable, bool unusable)
+    {
+        PickupManager& manager = PickupManager::getInstance();
+        if(manager.pickupInventoryContainers_.find(pickup) == manager.pickupInventoryContainers_.end())
+        {
+            COUT(1) << "Error: Pickupable &(" << pickup << ") was not registered with PickupManager for the PickupInventory, when it changed used." << std::endl;
+            return;
+        }
+
+        manager.pickupInventoryContainers_[pickup]->inUse = inUse;
+        manager.pickupInventoryContainers_[pickup]->usable = usable;
+        manager.pickupInventoryContainers_[pickup]->unusable = unusable;
+
+        manager.updateGUI();
+    }
+
+    void PickupManager::pickupChangedPickedUp(Pickupable* pickup, bool pickedUp)
+    {
+        assert(pickup);
+
+        if(!GameMode::isMaster())
+            return;
+
+        CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(pickup);
+        // If the Picupable is part of a PickupCollection it isn't displayed in the PickupInventory, just the PickupCollection is.
+        if(collectible != NULL && collectible->isInCollection())
+            return;
+
+        PickupCarrier* carrier = pickup->getCarrier();
+        while(carrier->getCarrierParent() != NULL)
+            carrier = carrier->getCarrierParent();
+        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
+        if(pawn == NULL)
+            return;
+        PlayerInfo* info = pawn->getPlayer();
+        if(info == NULL)
+            return;
+        unsigned int clientId = info->getClientID();
+
+        uint64_t index = 0;
+        if(pickedUp)
+        {
+            index = this->getPickupIndex();
+            this->indexes_[pickup] = index;
+            this->pickups_[index] = new WeakPtr<Pickupable>(pickup);
+        }
+        else
+        {
+            std::map<Pickupable*, uint64_t>::iterator it = this->indexes_.find(pickup);
+            index = it->second;
+            WeakPtr<Pickupable>* ptr = this->pickups_[index];
+            this->indexes_.erase(it);
+            this->pickups_.erase(index);
+            delete ptr;
+        }
+
+        if(GameMode::isStandalone() || Host::getPlayerID() == clientId)
+        {
+            PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->representations_[pickup->getPickupIdentifier()]->getObjectID(), pickedUp);
+        }
+        else
+        {
+            callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getPickupIdentifier()]->getObjectID(), pickedUp);
+        }
+
+    }
+
+    /*static*/ void PickupManager::pickupChangedPickedUpNetwork(uint64_t pickup, bool usable, uint32_t representationObjectId, bool pickedUp)
+    {
+        PickupManager& manager = PickupManager::getInstance();
+        if(pickedUp)
+        {
+            PickupInventoryContainer* container = new PickupInventoryContainer;
+            container->pickup = pickup;
+            container->inUse = false;
+            container->pickedUp = pickedUp;
+            container->usable = usable;
+            container->unusable = false;
+            container->representationObjectId = representationObjectId;
+            manager.pickupInventoryContainers_.insert(std::pair<uint64_t, PickupInventoryContainer*>(pickup, container));
+
+            if(GameMode::showsGraphics())
+            {
+                if(!manager.guiLoaded_)
+                {
+                    GUIManager::getInstance().loadGUI(PickupManager::guiName_s);
+                    manager.guiLoaded_ = true;
+                }
+                GUIManager::getInstance().getLuaState()->doString(PickupManager::guiName_s + ".update()");
+            }
+        }
+        else
+        {
+            std::map<uint64_t, PickupInventoryContainer*>::iterator it = manager.pickupInventoryContainers_.find(pickup);
+            if(it != manager.pickupInventoryContainers_.end())
+                delete it->second;
+            manager.pickupInventoryContainers_.erase(pickup);
+
+            manager.updateGUI();
+        }
+    }
+
+    inline void PickupManager::updateGUI(void)
+    {
+        if(GameMode::showsGraphics())
+        {
+            if(!this->guiLoaded_)
+            {
+                GUIManager::getInstance().loadGUI(PickupManager::guiName_s);
+                this->guiLoaded_ = true;
+            }
+            GUIManager::getInstance().getLuaState()->doString(PickupManager::guiName_s + ".update()");
+        }
+    }
+
+    uint64_t PickupManager::getPickupIndex(void)
+    {
+        if(this->pickupIndex_ == uint64_t(~0x0)-1)
+            this->pickupIndex_ = 0;
+        return this->pickupIndex_++;
+    }
+
 }

Modified: code/trunk/src/modules/pickup/PickupManager.h
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.h	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/src/modules/pickup/PickupManager.h	2010-10-06 06:00:40 UTC (rev 7504)
@@ -38,16 +38,31 @@
 #include "PickupPrereqs.h"
 
 #include <map>
-#include "util/Singleton.h"
+
 #include "core/WeakPtr.h"
+
 #include "pickup/PickupIdentifier.h"
+
 #include "PickupRepresentation.h"
 
-#include "core/OrxonoxClass.h"
+#include "util/Singleton.h"
+#include "interfaces/PickupListener.h"
 
 namespace orxonox // tolua_export
 { // tolua_export
 
+    // tolua_begin
+    struct PickupInventoryContainer
+    {
+        uint64_t pickup;
+        bool inUse;
+        bool pickedUp;
+        bool usable;
+        bool unusable;
+        uint32_t representationObjectId;
+    };
+    // tolua_end
+
     /**
     @brief
         Manages Pickupables.
@@ -56,7 +71,7 @@
         Damian 'Mozork' Frick
     */
     class _PickupExport PickupManager // tolua_export
-        : public Singleton<PickupManager>, public OrxonoxClass
+        : public Singleton<PickupManager>, public PickupListener
     { // tolua_export
         friend class Singleton<PickupManager>;
 
@@ -67,11 +82,13 @@
             static PickupManager& getInstance() { return Singleton<PickupManager>::getInstance(); } // tolua_export
 
             bool registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Registers a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.
+            bool registerRepresentation(PickupRepresentation* representation);
             bool unregisterRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Unegisters a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.
+            bool unregisterRepresentation(PickupRepresentation* representation);
             PickupRepresentation* getRepresentation(const PickupIdentifier* identifier); //!< Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier.
 
             // tolua_begin
-            orxonox::PickupRepresentation* getPickupRepresentation(orxonox::Pickupable* pickup); //!< Get the PickupRepresentation of an input Pickupable.
+            orxonox::PickupRepresentation* getPickupRepresentation(uint64_t pickup); //!< Get the PickupRepresentation of an input Pickupable.
 
             int getNumPickups(void); //!< Update the list of picked up Pickupables and get the number of Pickupables in the list.
             /**
@@ -79,25 +96,40 @@
                    Use this, after having called getNumPickups() to access all the Pickupables individually and in succession.
             @return Returns the next Pickupable in the list.
             */
-            orxonox::Pickupable* popPickup(void) { return (this->pickupsIterator_++)->first; }
+            orxonox::PickupInventoryContainer* popPickup(void) { return (this->pickupsIterator_++)->second; }
 
-            void dropPickup(orxonox::Pickupable* pickup); //!< Drop the input Pickupable.
-            void usePickup(orxonox::Pickupable* pickup, bool use); //!< Use (or unuse) the input Pickupable.
-            bool isValidPickup(orxonox::Pickupable* pickup); //!< Check whether the input Pickupable is valid, meaning that it is in the PickupManager's list and still exists.
+            void dropPickup(uint64_t pickup); //!< Drop the input Pickupable.
+            void usePickup(uint64_t pickup, bool use); //!< Use (or unuse) the input Pickupable.
+            bool isValidPickup(uint64_t pickup); //!< Check whether the input Pickupable is valid, meaning that it is in the PickupManager's list and still exists.
             // tolua_end
 
+            static void dropPickupNetworked(uint64_t pickup);
+            static void usePickupNetworked(uint64_t pickup, bool use);
+
+            virtual void pickupChangedUsed(Pickupable* pickup, bool used);
+            static void pickupChangedUsedNetwork(uint64_t pickup, bool inUse, bool usable, bool unusable);
+            virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp);
+            static void pickupChangedPickedUpNetwork(uint64_t pickup, bool usable, uint32_t representationObjectId, bool pickedUp);
+
         private:
             static PickupManager* singletonPtr_s;
             static const std::string guiName_s; //!< The name of the PickupInventory
+            bool guiLoaded_;
+            uint64_t pickupIndex_;
 
             PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation.
             std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations.
+            std::map<uint32_t, PickupRepresentation*> representationsNetworked_;
 
-            std::map<Pickupable*, WeakPtr<Pickupable> > pickupsList_; //!< A list of all the picked up Pickupables.
-            std::map<Pickupable*, WeakPtr<Pickupable> >::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_.
+            std::map<uint64_t, PickupInventoryContainer*> pickupInventoryContainers_;
+            std::map<uint64_t, PickupInventoryContainer*>::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_.
 
-            std::vector<PickupCarrier*>* getAllCarriers(PickupCarrier* carrier, std::vector<PickupCarrier*>* carriers = NULL); //!< Helper method. Get all the PickupCarriers that carry Pickupables, recursively.
+            std::map<uint64_t, WeakPtr<Pickupable>*> pickups_;
+            std::map<Pickupable*, uint64_t> indexes_;
 
+            void updateGUI(void);
+            uint64_t getPickupIndex(void);
+
     }; // tolua_export
 
 } // tolua_export

Modified: code/trunk/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupRepresentation.cc	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/src/modules/pickup/PickupRepresentation.cc	2010-10-06 06:00:40 UTC (rev 7504)
@@ -34,6 +34,7 @@
 #include "PickupRepresentation.h"
 
 #include "core/CoreIncludes.h"
+#include "core/GameMode.h"
 #include "graphics/Billboard.h"
 #include "util/StringUtils.h"
 #include "PickupManager.h"
@@ -48,22 +49,26 @@
         Constructor. Registers the object and initializes its member variables.
         This is primarily for use of the PickupManager in creating a default PickupRepresentation.
     */
-    PickupRepresentation::PickupRepresentation() : BaseObject(NULL), spawnerRepresentation_(NULL), pickup_(NULL)
+    PickupRepresentation::PickupRepresentation() : BaseObject(NULL), Synchronisable(NULL), spawnerRepresentation_(NULL), pickup_(NULL)
     {
         RegisterObject(PickupRepresentation);
 
         this->initialize();
+        this->setSyncMode(0x0);
     }
 
     /**
     @brief
         Default Constructor. Registers the object and initializes its member variables.
     */
-    PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator), spawnerRepresentation_(NULL), pickup_(NULL)
+    PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator), Synchronisable(creator), spawnerRepresentation_(NULL), pickup_(NULL)
     {
         RegisterObject(PickupRepresentation);
 
         this->initialize();
+        this->registerVariables();
+
+        PickupManager::getInstance().registerRepresentation(this); //!< Registers the PickupRepresentation with the PickupManager.
     }
 
     /**
@@ -75,8 +80,17 @@
         if(this->spawnerRepresentation_ != NULL)
             this->spawnerRepresentation_->destroy();
 
-        if(this->pickup_ != NULL)
-            PickupManager::getInstance().unregisterRepresentation(this->pickup_->getPickupIdentifier(), this);
+        if(this->isInitialized())
+        {
+            if(GameMode::isMaster() && this->pickup_ != NULL)
+            {
+                PickupManager::getInstance().unregisterRepresentation(this->pickup_->getPickupIdentifier(), this);
+            }
+            if(!GameMode::isMaster())
+            {
+                PickupManager::getInstance().unregisterRepresentation(this);
+            }
+        }
     }
 
     /**
@@ -91,6 +105,13 @@
         this->inventoryRepresentation_ = "Default";
     }
 
+    void PickupRepresentation::registerVariables(void)
+    {
+        registerVariable(this->description_, VariableDirection::ToClient);
+        registerVariable(this->name_, VariableDirection::ToClient);
+        registerVariable(this->inventoryRepresentation_, VariableDirection::ToClient);
+    }
+
     /**
     @brief
         Method for creating a PickupRepresentation object through XML.
@@ -106,7 +127,10 @@
         XMLPortObject(PickupRepresentation, Pickupable, "pickup", setPickup, getPickup, xmlelement, mode);
         XMLPortObject(PickupRepresentation, StaticEntity, "spawner-representation", setSpawnerRepresentation, getSpawnerRepresentationIndex, xmlelement, mode);
 
-        PickupManager::getInstance().registerRepresentation(this->pickup_->getPickupIdentifier(), this); //!< Registers the PickupRepresentation with the PickupManager through the PickupIdentifier of the Pickupable it represents.
+        if(GameMode::isMaster())
+        {
+            PickupManager::getInstance().registerRepresentation(this->pickup_->getPickupIdentifier(), this); //!< Registers the PickupRepresentation with the PickupManager through the PickupIdentifier of the Pickupable it represents.
+        }
 
         if(this->spawnerRepresentation_ != NULL)
             this->spawnerRepresentation_->setVisible(false);

Modified: code/trunk/src/modules/pickup/PickupRepresentation.h
===================================================================
--- code/trunk/src/modules/pickup/PickupRepresentation.h	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/src/modules/pickup/PickupRepresentation.h	2010-10-06 06:00:40 UTC (rev 7504)
@@ -44,6 +44,7 @@
 #include "PickupSpawner.h"
 
 #include "core/BaseObject.h"
+#include "network/synchronisable/Synchronisable.h"
 
 namespace orxonox // tolua_export
 { // tolua_export
@@ -54,7 +55,7 @@
         They are created through XML and are registered with the PickupManager.
     */
     class _PickupExport PickupRepresentation // tolua_export
-        : public BaseObject
+        : public BaseObject, public Synchronisable
     { // tolua_export
 
         public:
@@ -145,6 +146,8 @@
             void initialize(void); //!< Initializes the member variables of this PickupRepresentation.
             StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner); //!< Get the default spawnerRepresentation for a specific PickupSpawner.
 
+            void registerVariables(void); //!< Register some variables for synchronisation.
+
             std::string name_; //!< The name of the Pickupable represented by this PickupRepresentation.
             std::string description_; //!< The description of the Pickupable represented by this PickupRepresentation.
             std::string spawnerTemplate_; //!<  The name of the template of this PickupRepresentation.

Modified: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/src/orxonox/CMakeLists.txt	2010-10-06 06:00:40 UTC (rev 7504)
@@ -60,7 +60,6 @@
     LevelManager.h
     MoodManager.h
     controllers/HumanController.h
-    interfaces/Pickupable.h
     infos/PlayerInfo.h
     sound/SoundManager.h
   PCH_FILE

Modified: code/trunk/src/orxonox/interfaces/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/interfaces/CMakeLists.txt	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/src/orxonox/interfaces/CMakeLists.txt	2010-10-06 06:00:40 UTC (rev 7504)
@@ -2,5 +2,6 @@
   InterfaceCompilation.cc
   Pickupable.cc
   PickupCarrier.cc
+  PickupListener.cc
   RadarViewable.cc
 )

Added: code/trunk/src/orxonox/interfaces/PickupListener.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/PickupListener.cc	                        (rev 0)
+++ code/trunk/src/orxonox/interfaces/PickupListener.cc	2010-10-06 06:00:40 UTC (rev 7504)
@@ -0,0 +1,97 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+*/
+
+/**
+    @file PickupListener.cc
+    @brief Implementation of the PickupListener class.
+*/
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/CoreIncludes.h"
+
+#include "PickupListener.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        Constructor. Registers the object.
+    */
+    PickupListener::PickupListener()
+    {
+        RegisterRootObject(PickupListener);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    PickupListener::~PickupListener()
+    {
+
+    }
+
+    /**
+    @brief
+        Static method that is used to notify the PickupListener itself of the change in the used status of a Pickupable.
+        This is called in Pickupable.
+    @param pickup
+        The Pickupable that has changed its used status.
+    @param used
+        Thse value the status has changed to.
+    */
+    /*static*/ void PickupListener::broadcastPickupChangedUsed(Pickupable* pickup, bool used)
+    {
+        assert(pickup);
+
+        // Iterate through all PickupListeners and notify them by calling the method they overloaded.
+        for(ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)
+            it->pickupChangedUsed(pickup, used);
+    }
+
+    /**
+    @brief
+        Static method that is used to notify the PickupListener itself of the change in the pickedUp status of a Pickupable.
+        This is called in Pickupable.
+    @param pickup
+        The Pickupable that has changed its pickedUp status.
+    @param pickedUp
+        Thse value the status has changed to.
+    */
+    /*static*/ void PickupListener::broadcastPickupChangedPickedUp(Pickupable* pickup, bool pickedUp)
+    {
+        assert(pickup);
+
+        // Iterate through all PickupListeners and notify them by calling the method they overloaded.
+        for(ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)
+            it->pickupChangedPickedUp(pickup, pickedUp);
+    }
+
+}

Added: code/trunk/src/orxonox/interfaces/PickupListener.h
===================================================================
--- code/trunk/src/orxonox/interfaces/PickupListener.h	                        (rev 0)
+++ code/trunk/src/orxonox/interfaces/PickupListener.h	2010-10-06 06:00:40 UTC (rev 7504)
@@ -0,0 +1,79 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+*/
+
+/**
+    @file PickupListener.h
+    @brief Definition of the PickupListener class.
+    @ingroup Pickup
+*/
+
+
+#ifndef _PickupListener_H__
+#define _PickupListener_H__
+
+#include "Pickupable.h"
+
+#include "core/OrxonoxClass.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        The PickupListener class facilitates the flow of information regarding the picking up, dropping, using and unusing of @ref orxonox::Pickupable "Pickupables" to interested parties (such as the @ref orxonox::PickupManager "PickupManager").
+
+        All you need to to do be notified is to inherit from PickupListener and implement the two methods pickupChangedUsed() and pickupChangedPickedUp().
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _OrxonoxExport PickupListener : virtual public OrxonoxClass
+    {
+        public:
+            PickupListener();
+            virtual ~PickupListener();
+
+            static void broadcastPickupChangedUsed(Pickupable* pickup, bool used); //!< Static method that is used to notify the PickupListener itself of the change in the used status of a Pickupable.
+            static void broadcastPickupChangedPickedUp(Pickupable* pickup, bool pickedUp); //!< Static method that is used to notify the PickupListener itself of the change in the pickedUp status of a Pickupable.
+
+            /**
+            @brief Method that can be overloaded by any PickupListener to be notified of a change in the used status of a Pickupable.
+            @param pickup The Pickupable, whose used status has changed.
+            @param used The value the used status has changed to.
+            */
+            virtual void pickupChangedUsed(Pickupable* pickup, bool used) {}
+            /**
+            @brief Method that can be overloaded by any PickupListener to be notified of a change in the pickedUp status of a Pickupable.
+            @param pickup The Pickupable, whose pickedUp status has changed.
+            @param pickedUp The value the pickedUp status has changed to.
+            */
+            virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp) {}
+    };
+
+}
+
+#endif // _PickupListener_H__

Modified: code/trunk/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/Pickupable.cc	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/src/orxonox/interfaces/Pickupable.cc	2010-10-06 06:00:40 UTC (rev 7504)
@@ -33,8 +33,6 @@
 
 #include "Pickupable.h"
 
-#include "core/LuaState.h"
-#include "core/GUIManager.h"
 #include "core/Identifier.h"
 #include "core/CoreIncludes.h"
 #include "util/Convert.h"
@@ -44,6 +42,7 @@
 #include "worldentities/pawns/Pawn.h"
 
 #include "PickupCarrier.h"
+#include "PickupListener.h"
 
 namespace orxonox
 {
@@ -129,10 +128,13 @@
         COUT(4) << "Pickupable (&" << this << ") set to used " << used << "." << std::endl;
 
         this->used_ = used;
+
+        // Notify all the PickupListeners of the change.
+        PickupListener::broadcastPickupChangedUsed(this, used);
+
         this->changedUsed();
 
-        //TODO: Synchronize & make safe for dedicated server.
-        GUIManager::getInstance().getLuaState()->doString("PickupInventory.update()");
+
         return true;
     }
 
@@ -221,7 +223,7 @@
             COUT(3) << "A Pickupable (&" << this << ") was trying to be added to a PickupCarrier, but was already present." << std::endl;
             return false;
         }
-        
+
         this->setPickedUp(true);
         COUT(4) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << std::endl;
         return true;
@@ -276,12 +278,14 @@
         COUT(4) << "Pickupable (&" << this << ") set to pickedUp " << pickedUp << "." << std::endl;
 
         this->pickedUp_ = pickedUp;
+
+        // Notify all the PickupListeners of the change.
+        PickupListener::broadcastPickupChangedPickedUp(this, pickedUp);
+
         if(!pickedUp) // if the Pickupable has been dropped it unregisters itself with its PickupCarrier.
             this->getCarrier()->removePickup(this);
         this->changedPickedUp();
 
-        //TODO: Synchronize & make safe for dedicated server.
-        GUIManager::getInstance().getLuaState()->doString("PickupInventory.update()");
         return true;
     }
 

Modified: code/trunk/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/trunk/src/orxonox/interfaces/Pickupable.h	2010-10-01 11:27:04 UTC (rev 7503)
+++ code/trunk/src/orxonox/interfaces/Pickupable.h	2010-10-06 06:00:40 UTC (rev 7504)
@@ -43,8 +43,8 @@
 #include "core/OrxonoxClass.h"
 #include "Rewardable.h"
 
-namespace orxonox // tolua_export
-{ // tolua_export
+namespace orxonox
+{
 
     /**
     @brief
@@ -57,9 +57,8 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport Pickupable  // tolua_export
-        : virtual public OrxonoxClass, public Rewardable
-    {  // tolua_export
+    class _OrxonoxExport Pickupable : virtual public OrxonoxClass, public Rewardable
+    {
         protected:
             Pickupable(); //!< Default constructor.
 
@@ -70,7 +69,8 @@
             @brief Get whether the Pickupable is currently in use or not.
             @return Returns true if the Pickupable is currently in use.
             */
-            inline bool isUsed(void) { return this->used_; }  // tolua_export
+            inline bool isUsed(void)
+                { return this->used_; }
             /**
             @brief  Should be called when the Pickupable has transited from used to unused or the other way around.
                     Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedUsed); to their changdeUsed method.
@@ -93,7 +93,8 @@
             @brief Returns whether the Pickupable is currently picked up.
             @return Returns true if the Pickupable is currently picked up, false if not.
             */
-            inline bool isPickedUp(void) { return this->pickedUp_; }  // tolua_export
+            inline bool isPickedUp(void)
+                { return this->pickedUp_; }
             /**
             @brief  Should be called when the Pickupable has transited from picked up to dropped or the other way around.
                     Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedPickedUp); to their changedPickedUp method.
@@ -104,13 +105,15 @@
             @brief Returns whether the Pickupable can be used.
             @return Returns true if it can be used.
             */
-            inline bool isUsable(void) { return this->enabled_; } // tolua_export
-            
+            inline bool isUsable(void)
+                { return this->enabled_; }
+
             /**
             @brief Returns whether the Pickupable can be unused.
             @return Returns true if it can be unused.
             */
-            inline bool isUnusable(void) { return this->enabled_; } // tolua_export
+            inline bool isUnusable(void)
+                { return this->enabled_; }
 
             /**
             @brief Returns whether the Pickupable is enabled.
@@ -189,12 +192,12 @@
         public:
             virtual bool reward(PlayerInfo* player); //!< Method to transcribe a Pickupable as a Rewardable to the player.
 
-    };  // tolua_export
+    };
 
     //! SUPER functions.
     SUPER_FUNCTION(10, Pickupable, changedUsed, false);
     SUPER_FUNCTION(12, Pickupable, changedCarrier, false);
     SUPER_FUNCTION(13, Pickupable, changedPickedUp, false);
-}  // tolua_export
+}
 
 #endif /* _Pickupable_H__ */




More information about the Orxonox-commit mailing list