summaryrefslogtreecommitdiffstats
path: root/src/ItemGrid.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-04-03 22:03:18 +0200
committerHowaner <franzi.moos@googlemail.com>2014-04-03 22:03:18 +0200
commit32d054e8fdad1d486fd4edbb542daa3262220e5f (patch)
tree1094c471768b71e8cac1277c2fbea5a5d9f2caf9 /src/ItemGrid.h
parentRemove old function (diff)
parentAPIDump: Added angular specifics. (diff)
downloadcuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.gz
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.bz2
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.lz
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.xz
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.tar.zst
cuberite-32d054e8fdad1d486fd4edbb542daa3262220e5f.zip
Diffstat (limited to '')
-rw-r--r--src/ItemGrid.h46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/ItemGrid.h b/src/ItemGrid.h
index b344e3daf..c34d5e9e2 100644
--- a/src/ItemGrid.h
+++ b/src/ItemGrid.h
@@ -20,11 +20,13 @@ class cItemGrid
public:
// tolua_end
- /// This class is used as a callback for when a slot changes
+ /** This class is used as a callback for when a slot changes */
class cListener
{
public:
- /// Called whenever a slot changes
+ virtual ~cListener() {}
+
+ /** Called whenever a slot changes */
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) = 0;
} ;
typedef std::vector<cListener *> cListeners;
@@ -38,12 +40,12 @@ public:
int GetHeight (void) const { return m_Height; }
int GetNumSlots(void) const { return m_NumSlots; }
- /// Converts XY coords into slot number; returns -1 on invalid coords
+ /** Converts XY coords into slot number; returns -1 on invalid coords */
int GetSlotNum(int a_X, int a_Y) const;
// tolua_end
- /// Converts slot number into XY coords; sets coords to -1 on invalid slot number. Exported in ManualBindings.cpp
+ /** Converts slot number into XY coords; sets coords to -1 on invalid slot number. Exported in ManualBindings.cpp */
void GetSlotCoords(int a_SlotNum, int & a_X, int & a_Y) const;
// tolua_begin
@@ -62,16 +64,16 @@ public:
void EmptySlot(int a_X, int a_Y);
void EmptySlot(int a_SlotNum);
- /// Returns true if the specified slot is empty or the slot doesn't exist
+ /** Returns true if the specified slot is empty or the slot doesn't exist */
bool IsSlotEmpty(int a_SlotNum) const;
- /// Returns true if the specified slot is empty or the slot doesn't exist
+ /** Returns true if the specified slot is empty or the slot doesn't exist */
bool IsSlotEmpty(int a_X, int a_Y) const;
- /// Sets all items as empty
+ /** Sets all items as empty */
void Clear(void);
- /// Returns number of items out of a_ItemStack that can fit in the storage
+ /** Returns number of items out of a_ItemStack that can fit in the storage */
int HowManyCanFit(const cItem & a_ItemStack, bool a_AllowNewStacks = true);
/** Adds as many items out of a_ItemStack as can fit.
@@ -117,37 +119,37 @@ public:
*/
cItem RemoveOneItem(int a_X, int a_Y);
- /// Returns the number of items of type a_Item that are stored
+ /** Returns the number of items of type a_Item that are stored */
int HowManyItems(const cItem & a_Item);
- /// Returns true if there are at least as many items of type a_ItemStack as in a_ItemStack
+ /** Returns true if there are at least as many items of type a_ItemStack as in a_ItemStack */
bool HasItems(const cItem & a_ItemStack);
- /// Returns the index of the first empty slot; -1 if all full
+ /** Returns the index of the first empty slot; -1 if all full */
int GetFirstEmptySlot(void) const;
- /// Returns the index of the first non-empty slot; -1 if all empty
+ /** Returns the index of the first non-empty slot; -1 if all empty */
int GetFirstUsedSlot(void) const;
- /// Returns the index of the last empty slot; -1 if all full
+ /** Returns the index of the last empty slot; -1 if all full */
int GetLastEmptySlot(void) const;
- /// Returns the index of the last used slot; -1 if all empty
+ /** Returns the index of the last used slot; -1 if all empty */
int GetLastUsedSlot(void) const;
- /// Returns the index of the first empty slot following a_StartFrom (a_StartFrom is not checked)
+ /** Returns the index of the first empty slot following a_StartFrom (a_StartFrom is not checked) */
int GetNextEmptySlot(int a_StartFrom) const;
- /// Returns the index of the first used slot following a_StartFrom (a_StartFrom is not checked)
+ /** Returns the index of the first used slot following a_StartFrom (a_StartFrom is not checked) */
int GetNextUsedSlot(int a_StartFrom) const;
- /// Copies the contents into a cItems object; preserves the original a_Items contents
+ /** Copies the contents into a cItems object; preserves the original a_Items contents */
void CopyToItems(cItems & a_Items) const;
- /// Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact)
+ /** Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact) */
bool DamageItem(int a_SlotNum, short a_Amount);
- /// Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact)
+ /** Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact) */
bool DamageItem(int a_X, int a_Y, short a_Amount);
// tolua_end
@@ -159,10 +161,10 @@ public:
*/
void GenerateRandomLootWithBooks(const cLootProbab * a_LootProbabs, size_t a_CountLootProbabs, int a_NumSlots, int a_Seed);
- /// Adds a callback that gets called whenever a slot changes. Must not be called from within the listener callback!
+ /** Adds a callback that gets called whenever a slot changes. Must not be called from within the listener callback! */
void AddListener(cListener & a_Listener);
- /// Removes a slot-change-callback. Must not be called from within the listener callback!
+ /** Removes a slot-change-callback. Must not be called from within the listener callback! */
void RemoveListener(cListener & a_Listener);
// tolua_begin
@@ -177,7 +179,7 @@ protected:
cCriticalSection m_CSListeners; ///< CS that guards the m_Listeners against multi-thread access
bool m_IsInTriggerListeners; ///< Set to true while TriggerListeners is running, to detect attempts to manipulate listener list while triggerring
- /// Calls all m_Listeners for the specified slot number
+ /** Calls all m_Listeners for the specified slot number */
void TriggerListeners(int a_SlotNum);
/** Adds up to a_Num items out of a_ItemStack, as many as can fit, in specified slot