[Orxonox-commit 1952] r6669 - in code/branches/pickup4: data/gui/scripts src/modules/pickup
dafrick at orxonox.net
dafrick at orxonox.net
Thu Apr 1 10:21:35 CEST 2010
Author: dafrick
Date: 2010-04-01 10:21:35 +0200 (Thu, 01 Apr 2010)
New Revision: 6669
Modified:
code/branches/pickup4/data/gui/scripts/PickupInventory.lua
code/branches/pickup4/src/modules/pickup/PickupManager.cc
code/branches/pickup4/src/modules/pickup/PickupManager.h
Log:
Committing recent changes in PickupInventory, to be able to try out some things and easily revert if they don't work out.
Modified: code/branches/pickup4/data/gui/scripts/PickupInventory.lua
===================================================================
--- code/branches/pickup4/data/gui/scripts/PickupInventory.lua 2010-03-31 22:11:49 UTC (rev 6668)
+++ code/branches/pickup4/data/gui/scripts/PickupInventory.lua 2010-04-01 08:21:35 UTC (rev 6669)
@@ -12,22 +12,23 @@
P.filename = "PickupInventory"
P.layoutString = "PickupInventory.layout"
-function P:init()
+P.carrierList = {}
+
+function P.init()
end
-function P:show()
- self.window:show() -- TODO: Do this through parent...
- self.visible = true
+function P.show()
+ P.window:show() -- TODO: Do this through parent...
+ P.visible = true
- carrierList = {}
+ table.insert(P.carrierList, 4)
- -- TODO: Nicer?
local pickupManager = orxonox.PickupManager:getInstance()
local carrier = pickupManager:getPawn()
P.getCarrierList(carrier)
- for k,v in pairs(carrierList) do
+ for k,v in pairs(P.carrierList) do
local args = {}
table.insert(args, v)
table.insert(args, k)
@@ -42,15 +43,15 @@
return
end
- table.insert(carrierList, carrier)
+ table.insert(P.carrierList, carrier)
- local numCarriers = orxonox.PickupManager.getInstance():getNumCarrierChildren(carrier)
+ local numCarriers = orxonox.PickupManager:getInstance():getNumCarrierChildren(carrier)
if numCarriers == 0 then
return
end
for i=0,numCarriers-1,1 do
- local child = orxonox.PickupManager.getInstance():getCarrierChild(i, carrier)
+ local child = orxonox.PickupManager:getInstance():getCarrierChild(i, carrier)
if child ~= nil then
P.getCarrierList(child)
end
Modified: code/branches/pickup4/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/pickup4/src/modules/pickup/PickupManager.cc 2010-03-31 22:11:49 UTC (rev 6668)
+++ code/branches/pickup4/src/modules/pickup/PickupManager.cc 2010-04-01 08:21:35 UTC (rev 6669)
@@ -128,6 +128,8 @@
unsigned int PickupManager::getNumCarrierChildren(PickupCarrier* carrier)
{
+ if(carrier == NULL)
+ return 0;
return carrier->getNumCarrierChildren();
}
Modified: code/branches/pickup4/src/modules/pickup/PickupManager.h
===================================================================
--- code/branches/pickup4/src/modules/pickup/PickupManager.h 2010-03-31 22:11:49 UTC (rev 6668)
+++ code/branches/pickup4/src/modules/pickup/PickupManager.h 2010-04-01 08:21:35 UTC (rev 6669)
@@ -46,9 +46,6 @@
namespace orxonox // tolua_export
{ // tolua_export
- //TODO: Remove after transfer to orxonox/pickup
- class PickupCarrier; // tolua_export
-
/**
@brief
Manages Pickupables.
@@ -72,15 +69,15 @@
PickupRepresentation* getRepresentation(const PickupIdentifier* identifier); //!< Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier.
// tolua_begin
- PickupCarrier* getPawn(void);
+ orxonox::PickupCarrier* getPawn(void);
- unsigned int getNumCarrierChildren(PickupCarrier* carrier);
- PickupCarrier* getCarrierChild(unsigned int index, PickupCarrier* carrier);
+ unsigned int getNumCarrierChildren(orxonox::PickupCarrier* carrier);
+ orxonox::PickupCarrier* getCarrierChild(unsigned int index, orxonox::PickupCarrier* carrier);
- unsigned int getNumPickups(PickupCarrier* carrier);
- PickupRepresentation* getPickupRepresentation(unsigned int index, PickupCarrier* carrier);
- void dropPickup(unsigned int index, PickupCarrier* carrier);
- void usePickup(unsigned int index, PickupCarrier* carrier, bool use);
+ unsigned int getNumPickups(orxonox::PickupCarrier* carrier);
+ PickupRepresentation* getPickupRepresentation(unsigned int index, orxonox::PickupCarrier* carrier);
+ void dropPickup(unsigned int index, orxonox::PickupCarrier* carrier);
+ void usePickup(unsigned int index, orxonox::PickupCarrier* carrier, bool use);
// tolua_end
private:
More information about the Orxonox-commit
mailing list