Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 6, 2010, 8:00:40 AM (14 years ago)
Author:
dafrick
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/interfaces/Pickupable.cc

    r7494 r7504  
    3434#include "Pickupable.h"
    3535
    36 #include "core/LuaState.h"
    37 #include "core/GUIManager.h"
    3836#include "core/Identifier.h"
    3937#include "core/CoreIncludes.h"
     
    4543
    4644#include "PickupCarrier.h"
     45#include "PickupListener.h"
    4746
    4847namespace orxonox
     
    130129
    131130        this->used_ = used;
     131
     132        // Notify all the PickupListeners of the change.
     133        PickupListener::broadcastPickupChangedUsed(this, used);
     134
    132135        this->changedUsed();
    133136
    134         //TODO: Synchronize & make safe for dedicated server.
    135         GUIManager::getInstance().getLuaState()->doString("PickupInventory.update()");
     137
    136138        return true;
    137139    }
     
    222224            return false;
    223225        }
    224        
     226
    225227        this->setPickedUp(true);
    226228        COUT(4) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << std::endl;
     
    277279
    278280        this->pickedUp_ = pickedUp;
     281
     282        // Notify all the PickupListeners of the change.
     283        PickupListener::broadcastPickupChangedPickedUp(this, pickedUp);
     284
    279285        if(!pickedUp) // if the Pickupable has been dropped it unregisters itself with its PickupCarrier.
    280286            this->getCarrier()->removePickup(this);
    281287        this->changedPickedUp();
    282288
    283         //TODO: Synchronize & make safe for dedicated server.
    284         GUIManager::getInstance().getLuaState()->doString("PickupInventory.update()");
    285289        return true;
    286290    }
Note: See TracChangeset for help on using the changeset viewer.