Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 13, 2010, 10:16:10 AM (14 years ago)
Author:
dafrick
Message:

Merged pickup4 branch back to trunk.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r6540 r6711  
    3535
    3636#include "core/CoreIncludes.h"
     37#include "core/LuaState.h"
     38#include "core/GUIManager.h"
    3739#include "core/ScopedSingletonManager.h"
    3840#include "core/Identifier.h"
    3941#include "interfaces/PickupCarrier.h"
     42#include "infos/PlayerInfo.h"
    4043#include "worldentities/pawns/Pawn.h"
    4144#include "PickupRepresentation.h"
    4245
     46#include "ToluaBindPickup.h"
     47
    4348namespace orxonox
    4449{
    45 
     50    // Register tolua_open function when loading the library
     51    DeclareToluaInterface(Pickup);
     52   
    4653    ManageScopedSingleton(PickupManager, ScopeID::Root, false);
     54   
     55    /*static*/ const std::string PickupManager::guiName_s = "PickupInventory";
    4756   
    4857    /**
     
    110119    }
    111120   
     121    PickupCarrier* PickupManager::getPawn(void)
     122    {
     123        Pawn* pawn = dynamic_cast<Pawn*>(GUIManager::getInstancePtr()->getPlayer(PickupManager::guiName_s)->getControllableEntity());
     124        if(pawn == NULL)
     125            return NULL;
     126        return dynamic_cast<PickupCarrier*>(pawn);
     127    }
     128   
     129    int PickupManager::getNumCarrierChildren(PickupCarrier* carrier)
     130    {
     131        if(carrier == NULL)
     132            return 0;
     133        return carrier->getNumCarrierChildren();
     134    }
     135           
     136    PickupCarrier* PickupManager::getCarrierChild(int index, PickupCarrier* carrier)
     137    {
     138        if(carrier == NULL)
     139            return NULL;
     140        return carrier->getCarrierChild(index);
     141    }
     142   
     143    const std::string& PickupManager::getCarrierName(orxonox::PickupCarrier* carrier)
     144    {
     145        if(carrier == NULL)
     146            return BLANKSTRING;
     147        return carrier->getCarrierName();
     148    }
     149   
     150    PickupRepresentation* PickupManager::getPickupRepresentation(int index, PickupCarrier* carrier)
     151    {
     152        Pickupable* pickup = carrier->getPickup(index);
     153        if(pickup == NULL)
     154            return NULL;
     155       
     156        return this->getRepresentation(pickup->getPickupIdentifier());
     157    }
     158   
     159    int PickupManager::getNumPickups(PickupCarrier* carrier)
     160    {
     161        if(carrier == NULL)
     162            return 0;
     163        return carrier->getNumPickups();
     164    }
     165   
     166    void PickupManager::dropPickup(int index, PickupCarrier* carrier)
     167    {
     168        Pickupable* pickup = carrier->getPickup(index);
     169        carrier->drop(pickup);
     170    }
     171   
     172    void PickupManager::usePickup(int index, PickupCarrier* carrier, bool use)
     173    {
     174        Pickupable* pickup = carrier->getPickup(index);
     175        pickup->setUsed(use);
     176    }
     177   
    112178}
Note: See TracChangeset for help on using the changeset viewer.