summaryrefslogtreecommitdiffstats
path: root/source/Item.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-27 04:45:40 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-27 04:45:40 +0100
commit67048ee057d0db912b383601c0fd39412e77e836 (patch)
tree1350906976566c15adb392bdb1e4c09506e0f958 /source/Item.h
parentDebuggers: added some filtering to the API output, but still not good enough. (diff)
downloadcuberite-67048ee057d0db912b383601c0fd39412e77e836.tar
cuberite-67048ee057d0db912b383601c0fd39412e77e836.tar.gz
cuberite-67048ee057d0db912b383601c0fd39412e77e836.tar.bz2
cuberite-67048ee057d0db912b383601c0fd39412e77e836.tar.lz
cuberite-67048ee057d0db912b383601c0fd39412e77e836.tar.xz
cuberite-67048ee057d0db912b383601c0fd39412e77e836.tar.zst
cuberite-67048ee057d0db912b383601c0fd39412e77e836.zip
Diffstat (limited to 'source/Item.h')
-rw-r--r--source/Item.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/source/Item.h b/source/Item.h
index 2a8df9b33..8b78d4610 100644
--- a/source/Item.h
+++ b/source/Item.h
@@ -120,7 +120,34 @@ public:
};
// tolua_end
-typedef std::vector<cItem> cItems;
+
+
+
+// This stupid construct is here only so that Lua can access cItems in an API
+
+class cItems // tolua_export
+ : public std::vector<cItem>
+{ // tolua_export
+public:
+ // tolua_begin
+ cItem & Get (int a_Idx) {return at(a_Idx); }
+ void Set (int a_Idx, const cItem & a_Item) {at(a_Idx) = a_Item; }
+ void Add (const cItem & a_Item) {push_back(a_Item); }
+ void Delete(int a_Idx) {erase(begin() + a_Idx); }
+ void Clear (void) {clear(); }
+ int Size (void) {return size(); }
+
+ void Add (ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemHealth)
+ {
+ push_back(cItem(a_ItemType, a_ItemCount, a_ItemHealth));
+ }
+
+ void Set (int a_Idx, ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemHealth)
+ {
+ at(a_Idx) = cItem(a_ItemType, a_ItemCount, a_ItemHealth);
+ }
+ // tolua_end
+} ; // tolua_export