diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 03f19e831..7895be959 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -128,6 +128,8 @@ public: // tolua_export class cCommandEnumCallback { public: + virtual ~cCommandEnumCallback() {} + /** Called for each command; return true to abort enumeration For console commands, a_Permission is not used (set to empty string) */ diff --git a/src/Blocks/BroadcastInterface.h b/src/Blocks/BroadcastInterface.h index 01966ffbd..b1b450690 100644 --- a/src/Blocks/BroadcastInterface.h +++ b/src/Blocks/BroadcastInterface.h @@ -4,7 +4,8 @@ class cBroadcastInterface { public: - + virtual ~cBroadcastInterface() {} + virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) = 0; virtual void BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL) = 0; virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) = 0; diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index 580339d32..bfbb053d9 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -9,7 +9,8 @@ class cItems; class cWorldInterface { public: - + virtual ~cWorldInterface() {} + virtual Int64 GetTimeOfDay(void) const = 0; virtual Int64 GetWorldAge(void) const = 0; diff --git a/src/ForEachChunkProvider.h b/src/ForEachChunkProvider.h index 6017173ee..7a6e8c5c6 100644 --- a/src/ForEachChunkProvider.h +++ b/src/ForEachChunkProvider.h @@ -24,6 +24,8 @@ class cBlockArea; class cForEachChunkProvider { public: + virtual ~cForEachChunkProvider() {} + /** Calls the callback for each chunk in the specified range. */ virtual bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) = 0; diff --git a/src/Globals.h b/src/Globals.h index 3e62832b7..a1cee5c2f 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -264,11 +264,17 @@ template class SizeChecker; #define assert_test(x) ( !!(x) || (assert(!#x), exit(1), 0)) #endif -/// A generic interface used mainly in ForEach() functions + + + + +/** A generic interface used mainly in ForEach() functions */ template class cItemCallback { public: - /// Called for each item in the internal list; return true to stop the loop, or false to continue enumerating + virtual ~cItemCallback() {} + + /** Called for each item in the internal list; return true to stop the loop, or false to continue enumerating */ virtual bool Item(Type * a_Type) = 0; } ; diff --git a/src/HTTPServer/HTTPServer.h b/src/HTTPServer/HTTPServer.h index 24baf8c95..383abb4b6 100644 --- a/src/HTTPServer/HTTPServer.h +++ b/src/HTTPServer/HTTPServer.h @@ -37,6 +37,8 @@ public: class cCallbacks { public: + virtual ~cCallbacks() {} + /** Called when a new request arrives over a connection and its headers have been parsed. The request body needn't have arrived yet. */ @@ -50,7 +52,7 @@ public: } ; cHTTPServer(void); - ~cHTTPServer(); + virtual ~cHTTPServer(); /// Initializes the server on the specified ports bool Initialize(const AString & a_PortsIPv4, const AString & a_PortsIPv6); diff --git a/src/Inventory.h b/src/Inventory.h index fd2089a13..1ad7c4776 100644 --- a/src/Inventory.h +++ b/src/Inventory.h @@ -52,6 +52,8 @@ public: cInventory(cPlayer & a_Owner); + virtual ~cInventory() {} + // tolua_begin /// Removes all items from the entire inventory 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 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 diff --git a/src/OSSupport/ListenThread.h b/src/OSSupport/ListenThread.h index 4e337d814..b2d806c82 100644 --- a/src/OSSupport/ListenThread.h +++ b/src/OSSupport/ListenThread.h @@ -29,43 +29,45 @@ class cListenThread : typedef cIsThread super; public: - /// Used as the callback for connection events + /** Used as the callback for connection events */ class cCallback { public: - /// This callback is called whenever a socket connection is accepted + virtual ~cCallback() {} + + /** This callback is called whenever a socket connection is accepted */ virtual void OnConnectionAccepted(cSocket & a_Socket) = 0; } ; cListenThread(cCallback & a_Callback, cSocket::eFamily a_Family, const AString & a_ServiceName = ""); ~cListenThread(); - /// Creates all the sockets, returns trus if successful, false if not. + /** Creates all the sockets, returns trus if successful, false if not. */ bool Initialize(const AString & a_PortsString); bool Start(void); void Stop(void); - /// Call before Initialize() to set the "reuse" flag on the sockets + /** Call before Initialize() to set the "reuse" flag on the sockets */ void SetReuseAddr(bool a_Reuse = true); protected: typedef std::vector cSockets; - /// The callback which to notify of incoming connections + /** The callback which to notify of incoming connections */ cCallback & m_Callback; - /// Socket address family to use + /** Socket address family to use */ cSocket::eFamily m_Family; - /// Sockets that are being monitored + /** Sockets that are being monitored */ cSockets m_Sockets; - /// If set to true, the SO_REUSEADDR socket option is set to true + /** If set to true, the SO_REUSEADDR socket option is set to true */ bool m_ShouldReuseAddr; - /// Name of the service that's listening on the ports; for logging purposes only + /** Name of the service that's listening on the ports; for logging purposes only */ AString m_ServiceName; diff --git a/src/RCONServer.h b/src/RCONServer.h index 0e89800a2..88aac4b5f 100644 --- a/src/RCONServer.h +++ b/src/RCONServer.h @@ -29,7 +29,7 @@ class cRCONServer : { public: cRCONServer(cServer & a_Server); - ~cRCONServer(); + virtual ~cRCONServer(); void Initialize(cIniFile & a_IniFile); diff --git a/src/UI/WindowOwner.h b/src/UI/WindowOwner.h index d41abf66d..e3c73edc4 100644 --- a/src/UI/WindowOwner.h +++ b/src/UI/WindowOwner.h @@ -33,6 +33,10 @@ public: { } + virtual ~cWindowOwner() + { + } + void CloseWindow(void) { m_Window = NULL;