From a71299c46b7b53a5f9f11ea2851f8e5b66d2d912 Mon Sep 17 00:00:00 2001 From: Tycho Bickerstaff Date: Sun, 22 Dec 2013 15:41:01 +0000 Subject: fixed rdynamic as its not acctually needed a cmake handles it, looks like the problem was caused by the linux linker accepting the option twice and the os x linker not --- src/OSSupport/Queue.h | 31 +++++++++++++++++++++++++++++++ src/WorldStorage/WorldStorage.h | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/OSSupport/Queue.h (limited to 'src') diff --git a/src/OSSupport/Queue.h b/src/OSSupport/Queue.h new file mode 100644 index 000000000..4571272b3 --- /dev/null +++ b/src/OSSupport/Queue.h @@ -0,0 +1,31 @@ +#pragma once + +template +class cDeleter +{ + public: + static void Delete(T) {}; +}; + +template> +class cQueue +{ +public: + cQueue(int warnsize); + cQueue(cQueue& queue); + ~cQueue(); + + void EnqueueItem(T item); + bool TryDequeueItem(T& item); + T DequeueItem(); + void BlockTillEmpty(cEvent CancelationEvent); + void Clear(); + int Size(); + +private: + int warnsize; + std::list contents; +}; + +//template classes must be implemented in the header +#include "Queue.inc" diff --git a/src/WorldStorage/WorldStorage.h b/src/WorldStorage/WorldStorage.h index 007d37571..106842a22 100644 --- a/src/WorldStorage/WorldStorage.h +++ b/src/WorldStorage/WorldStorage.h @@ -16,6 +16,7 @@ #include "../ChunkDef.h" #include "../OSSupport/IsThread.h" +#include "../OSSupport/Queue.h" @@ -93,7 +94,7 @@ protected: sChunkLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ, bool a_Generate) : m_ChunkX(a_ChunkX), m_ChunkY(a_ChunkY), m_ChunkZ(a_ChunkZ), m_Generate(a_Generate) {} } ; - typedef std::list sChunkLoadQueue; + typedef cQueue sChunkLoadQueue; cWorld * m_World; AString m_StorageSchemaName; -- cgit v1.2.3 From a7a4b2886d98eb0c015421fb82c60531a8e66aaa Mon Sep 17 00:00:00 2001 From: Tycho Bickerstaff Date: Sun, 22 Dec 2013 15:55:57 +0000 Subject: fixed accedental commit --- src/WorldStorage/WorldStorage.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/WorldStorage/WorldStorage.h b/src/WorldStorage/WorldStorage.h index 106842a22..007d37571 100644 --- a/src/WorldStorage/WorldStorage.h +++ b/src/WorldStorage/WorldStorage.h @@ -16,7 +16,6 @@ #include "../ChunkDef.h" #include "../OSSupport/IsThread.h" -#include "../OSSupport/Queue.h" @@ -94,7 +93,7 @@ protected: sChunkLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ, bool a_Generate) : m_ChunkX(a_ChunkX), m_ChunkY(a_ChunkY), m_ChunkZ(a_ChunkZ), m_Generate(a_Generate) {} } ; - typedef cQueue sChunkLoadQueue; + typedef std::list sChunkLoadQueue; cWorld * m_World; AString m_StorageSchemaName; -- cgit v1.2.3 From 15a980a6169ff975628bf1d4ecd16168fe609bf4 Mon Sep 17 00:00:00 2001 From: Tycho Bickerstaff Date: Sun, 22 Dec 2013 16:11:34 +0000 Subject: merged in warnings changes --- src/Bindings/LuaState.h | 21 ++++++++++++++++++++ src/Bindings/PluginManager.h | 2 +- src/BlockEntities/BlockEntity.h | 6 +++++- src/BlockEntities/BlockEntityWithItems.h | 1 + src/BlockEntities/FurnaceEntity.h | 2 +- src/BlockEntities/JukeboxEntity.h | 2 +- src/BlockEntities/NoteEntity.h | 2 +- src/Blocks/BlockHandler.h | 6 +++++- src/Chunk.cpp | 15 ++++---------- src/Chunk.h | 23 --------------------- src/Chunk.inl.h | 34 -------------------------------- src/ChunkDef.h | 1 + src/ChunkSender.cpp | 2 +- src/CommandOutput.h | 1 + src/Entities/Entity.h | 14 +++++++++---- src/Entities/Player.h | 4 ++-- src/Entities/ProjectileEntity.h | 6 +++++- src/Items/ItemHandler.h | 8 +++++++- src/Piston.cpp | 1 + src/Root.cpp | 2 +- src/Server.h | 2 ++ src/Simulator/FireSimulator.h | 2 +- src/Simulator/RedstoneSimulator.h | 4 ++-- src/Simulator/SandSimulator.h | 2 +- src/Simulator/Simulator.h | 9 ++++++++- src/WebAdmin.h | 15 ++++++++++---- 26 files changed, 94 insertions(+), 93 deletions(-) delete mode 100644 src/Chunk.inl.h (limited to 'src') diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 40bb67e69..a6c31b6d3 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -246,6 +246,7 @@ public: > bool Call(FnT a_FnName, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -265,6 +266,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -285,6 +287,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -306,6 +309,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -328,6 +332,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -351,6 +356,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -376,6 +382,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -402,6 +409,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -429,6 +437,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -457,6 +466,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -486,6 +496,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, ArgT10 a_Arg10, const cRet & a_Mark, RetT1 & a_Ret1) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -515,6 +526,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -536,6 +548,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -559,6 +572,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -583,6 +597,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -608,6 +623,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -635,6 +651,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -663,6 +680,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -692,6 +710,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -722,6 +741,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; @@ -753,6 +773,7 @@ public: > bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3, RetT4 & a_Ret4, RetT5 & a_Ret5) { + UNUSED(a_Mark); if (!PushFunction(a_FnName)) { return false; diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 5abb8be84..e94421057 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -273,7 +273,7 @@ private: bool m_bReloadPlugins; cPluginManager(); - ~cPluginManager(); + virtual ~cPluginManager(); /// Reloads all plugins, defaulting to settings.ini for settings location void ReloadPluginsNow(void); diff --git a/src/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h index 0d358b556..7c6688f8d 100644 --- a/src/BlockEntities/BlockEntity.h +++ b/src/BlockEntities/BlockEntity.h @@ -87,7 +87,11 @@ public: virtual void SendTo(cClientHandle & a_Client) = 0; /// Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. By default does nothing. - virtual bool Tick(float a_Dt, cChunk & a_Chunk) { return false; } + virtual bool Tick(float a_Dt, cChunk & /* a_Chunk */) + { + UNUSED(a_Dt); + return false; + } protected: /// Position in absolute block coordinates diff --git a/src/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h index f35412e03..bf6289a2f 100644 --- a/src/BlockEntities/BlockEntityWithItems.h +++ b/src/BlockEntities/BlockEntityWithItems.h @@ -73,6 +73,7 @@ protected: // cItemGrid::cListener overrides: virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) { + UNUSED(a_SlotNum); ASSERT(a_Grid == &m_Contents); if (m_World != NULL) { diff --git a/src/BlockEntities/FurnaceEntity.h b/src/BlockEntities/FurnaceEntity.h index 8b695d61a..b08187300 100644 --- a/src/BlockEntities/FurnaceEntity.h +++ b/src/BlockEntities/FurnaceEntity.h @@ -95,7 +95,7 @@ public: // tolua_end - void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned) {m_FuelBurnTime = a_FuelBurnTime; m_TimeBurned = 0; } + void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned) {m_FuelBurnTime = a_FuelBurnTime; m_TimeBurned = a_TimeBurned; } void SetCookTimes(int a_NeedCookTime, int a_TimeCooked) {m_NeedCookTime = a_NeedCookTime; m_TimeCooked = a_TimeCooked; } protected: diff --git a/src/BlockEntities/JukeboxEntity.h b/src/BlockEntities/JukeboxEntity.h index fcafdc479..996de965b 100644 --- a/src/BlockEntities/JukeboxEntity.h +++ b/src/BlockEntities/JukeboxEntity.h @@ -45,7 +45,7 @@ public: // tolua_end virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle & a_Client) override { }; + virtual void SendTo(cClientHandle &) override { }; private: int m_Record; diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h index e2d088f44..cf78aeac6 100644 --- a/src/BlockEntities/NoteEntity.h +++ b/src/BlockEntities/NoteEntity.h @@ -52,7 +52,7 @@ public: // tolua_end virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle & a_Client) override { }; + virtual void SendTo(cClientHandle &) override { }; private: char m_Pitch; diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index 107d36476..a732aa797 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -99,7 +99,11 @@ public: virtual bool DoesIgnoreBuildCollision(void); /// Similar to DoesIgnoreBuildCollision(void), but is used for cases where block meta/player item-in-hand is needed to determine collision (thin snow) - virtual bool DoesIgnoreBuildCollision(cPlayer * a_Player, NIBBLETYPE a_Meta) { return DoesIgnoreBuildCollision(); } + virtual bool DoesIgnoreBuildCollision(cPlayer *, NIBBLETYPE a_Meta) + { + UNUSED(a_Meta); + return DoesIgnoreBuildCollision(); + } /// Returns if this block drops if it gets destroyed by an unsuitable situation. Default: true virtual bool DoesDropOnUnsuitable(void); diff --git a/src/Chunk.cpp b/src/Chunk.cpp index c446db9a6..b229a4aff 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -527,9 +527,10 @@ void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner) // MG TODO : check that "Level" really means Y + /* NIBBLETYPE SkyLight = 0; - NIBBLETYPE BlockLight = 0; + */ if (IsLightValid()) { @@ -2324,8 +2325,8 @@ BLOCKTYPE cChunk::GetBlock(int a_BlockIdx) const void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) { int Idx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); - a_BlockType = cChunkDef::GetBlock (m_BlockTypes, a_RelX, a_RelY, a_RelZ); - a_BlockMeta = cChunkDef::GetNibble(m_BlockMeta, a_RelX, a_RelY, a_RelZ); + a_BlockType = cChunkDef::GetBlock (m_BlockTypes, Idx); + a_BlockMeta = cChunkDef::GetNibble(m_BlockMeta, Idx); } @@ -2897,11 +2898,3 @@ NIBBLETYPE cChunk::GetTimeAlteredLight(NIBBLETYPE a_Skylight) const - -#if !C_CHUNK_USE_INLINE -# include "cChunk.inl.h" -#endif - - - - diff --git a/src/Chunk.h b/src/Chunk.h index 05a96d419..f0a50c3c4 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -12,19 +12,6 @@ -#define C_CHUNK_USE_INLINE 1 - -// Do not touch -#if C_CHUNK_USE_INLINE - #define __C_CHUNK_INLINE__ inline -#else - #define __C_CHUNK_INLINE__ -#endif - - - - - namespace Json { class Value; @@ -436,8 +423,6 @@ private: void RemoveBlockEntity(cBlockEntity * a_BlockEntity); void AddBlockEntity (cBlockEntity * a_BlockEntity); - void SpreadLightOfBlock(NIBBLETYPE * a_LightBuffer, int a_X, int a_Y, int a_Z, char a_Falloff); - /// Creates a block entity for each block that needs a block entity and doesn't have one in the list void CreateBlockEntities(void); @@ -482,11 +467,3 @@ typedef std::list cChunkPtrList; - -#if C_CHUNK_USE_INLINE - #include "Chunk.inl.h" -#endif - - - - diff --git a/src/Chunk.inl.h b/src/Chunk.inl.h deleted file mode 100644 index fb9c4dad1..000000000 --- a/src/Chunk.inl.h +++ /dev/null @@ -1,34 +0,0 @@ - -#ifndef __C_CHUNK_INL_H__ -#define __C_CHUNK_INL_H__ - -#ifndef MAX -# define MAX(a,b) (((a)>(b))?(a):(b)) -#endif - - - - - -__C_CHUNK_INLINE__ -void cChunk::SpreadLightOfBlock(NIBBLETYPE * a_LightBuffer, int a_X, int a_Y, int a_Z, char a_Falloff) -{ - unsigned char CurrentLight = cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z ); - cChunkDef::SetNibble( a_LightBuffer, a_X-1, a_Y, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X-1, a_Y, a_Z ), MAX(0,CurrentLight-a_Falloff) ) ); - cChunkDef::SetNibble( a_LightBuffer, a_X+1, a_Y, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X+1, a_Y, a_Z ), MAX(0,CurrentLight-a_Falloff) ) ); - cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y-1, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y-1, a_Z ), MAX(0,CurrentLight-a_Falloff) ) ); - cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y+1, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y+1, a_Z ), MAX(0,CurrentLight-a_Falloff) ) ); - cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y, a_Z-1, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z-1 ), MAX(0,CurrentLight-a_Falloff) ) ); - cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y, a_Z+1, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z+1 ), MAX(0,CurrentLight-a_Falloff) ) ); - MarkDirty(); -} - - - - - -#endif - - - - diff --git a/src/ChunkDef.h b/src/ChunkDef.h index 8c37e7907..7d727a4d4 100644 --- a/src/ChunkDef.h +++ b/src/ChunkDef.h @@ -182,6 +182,7 @@ public: /// Converts absolute block coords into relative (chunk + block) coords: inline static void AbsoluteToRelative(/* in-out */ int & a_X, int & a_Y, int & a_Z, /* out */ int & a_ChunkX, int & a_ChunkZ ) { + UNUSED(a_Y); BlockToChunk(a_X, a_Z, a_ChunkX, a_ChunkZ); a_X = a_X - a_ChunkX * Width; diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp index fe3ee9b42..2425adf18 100644 --- a/src/ChunkSender.cpp +++ b/src/ChunkSender.cpp @@ -264,7 +264,7 @@ void cChunkSender::BlockEntity(cBlockEntity * a_Entity) -void cChunkSender::Entity(cEntity * a_Entity) +void cChunkSender::Entity(cEntity *) { // Nothing needed yet, perhaps in the future when we save entities into chunks we'd like to send them upon load, too ;) } diff --git a/src/CommandOutput.h b/src/CommandOutput.h index bdf675238..3763d625f 100644 --- a/src/CommandOutput.h +++ b/src/CommandOutput.h @@ -38,6 +38,7 @@ class cNullCommandOutputCallback : virtual void Out(const AString & a_Text) override { // Do nothing + UNUSED(a_Text); } } ; diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 9cb36eb14..2ba1b303d 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -351,10 +351,14 @@ public: // tolua_end /// Called when the specified player right-clicks this entity - virtual void OnRightClicked(cPlayer & a_Player) {}; + virtual void OnRightClicked(cPlayer &) {}; /// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy(). - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) {} + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) + { + UNUSED(a_Drops); + UNUSED(a_Killer); + } protected: static cCriticalSection m_CSCount; @@ -420,11 +424,13 @@ protected: void Dereference( cEntity*& a_EntityPtr ); private: - // Measured in degrees (MAX 360°) + // Measured in degrees, [-180, +180) double m_HeadYaw; + // Measured in meter/second (m/s) Vector3d m_Speed; - // Measured in degrees (MAX 360°) + + // Measured in degrees, [-180, +180) Vector3d m_Rot; /// Position of the entity's XZ center and Y bottom diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 66f1c07a7..f9ce950ba 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -45,7 +45,7 @@ public: virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) override { }; + virtual void HandlePhysics(float a_Dt, cChunk &) override { UNUSED(a_Dt); }; /// Returns the curently equipped weapon; empty item if none virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); } @@ -114,7 +114,7 @@ public: double GetEyeHeight(void) const; // tolua_export Vector3d GetEyePosition(void) const; // tolua_export inline bool IsOnGround(void) const {return m_bTouchGround; } // tolua_export - inline const double GetStance(void) const { return GetPosY() + 1.62; } // tolua_export // TODO: Proper stance when crouching etc. + inline double GetStance(void) const { return GetPosY() + 1.62; } // tolua_export // TODO: Proper stance when crouching etc. inline cInventory & GetInventory(void) { return m_Inventory; } // tolua_export inline const cInventory & GetInventory(void) const { return m_Inventory; } diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h index 959e81ae5..4721409ee 100644 --- a/src/Entities/ProjectileEntity.h +++ b/src/Entities/ProjectileEntity.h @@ -52,7 +52,11 @@ public: virtual void OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFace); /// Called by the physics blocktracer when the entity hits another entity - virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) {} + virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) + { + UNUSED(a_EntityHit); + UNUSED(a_HitPos); + } /// Called by Chunk when the projectile is eligible for player collection virtual void CollectedBy(cPlayer * a_Dest); diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h index e39bb054b..db0ffc9db 100644 --- a/src/Items/ItemHandler.h +++ b/src/Items/ItemHandler.h @@ -25,7 +25,13 @@ public: virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir); /// Called when the client sends the SHOOT status in the lclk packet - virtual void OnItemShoot(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace) {} + virtual void OnItemShoot(cPlayer *, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace) + { + UNUSED(a_BlockX); + UNUSED(a_BlockY); + UNUSED(a_BlockZ); + UNUSED(a_BlockFace); + } /// Called while the player diggs a block using this item virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_HeldItem, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace); diff --git a/src/Piston.cpp b/src/Piston.cpp index b15e7d95e..75eeb5e98 100644 --- a/src/Piston.cpp +++ b/src/Piston.cpp @@ -238,6 +238,7 @@ bool cPiston::CanPush(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) bool cPiston::CanBreakPush(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { + UNUSED(a_BlockMeta); return g_BlockPistonBreakable[a_BlockType]; } diff --git a/src/Root.cpp b/src/Root.cpp index 798f965be..16a521698 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -596,10 +596,10 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac public: cCallback (const AString & a_PlayerName, cPlayerListCallback & a_Callback) : - m_Callback(a_Callback), m_BestRating(0), m_NameLength(a_PlayerName.length()), m_PlayerName(a_PlayerName), + m_Callback(a_Callback), m_BestMatch(NULL), m_NumMatches(0) {} diff --git a/src/Server.h b/src/Server.h index 0d93469a5..1f94bb3da 100644 --- a/src/Server.h +++ b/src/Server.h @@ -35,6 +35,8 @@ class cServer // tolua_export : public cListenThread::cCallback { // tolua_export public: // tolua_export + + virtual ~cServer() {} bool InitServer(cIniFile & a_SettingsIni); // tolua_begin diff --git a/src/Simulator/FireSimulator.h b/src/Simulator/FireSimulator.h index 66c31b440..9ccc3ef4f 100644 --- a/src/Simulator/FireSimulator.h +++ b/src/Simulator/FireSimulator.h @@ -22,7 +22,7 @@ public: cFireSimulator(cWorld & a_World, cIniFile & a_IniFile); ~cFireSimulator(); - virtual void Simulate(float a_Dt) override {} // not used + virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} // not used virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override; virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override; diff --git a/src/Simulator/RedstoneSimulator.h b/src/Simulator/RedstoneSimulator.h index 60c86a3c5..1080c3f81 100644 --- a/src/Simulator/RedstoneSimulator.h +++ b/src/Simulator/RedstoneSimulator.h @@ -19,7 +19,7 @@ public: cRedstoneSimulator(cWorld & a_World); ~cRedstoneSimulator(); - virtual void Simulate(float a_Dt) override {}; // Not used in this simulator + virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} // not used virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override; virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) override { return IsRedstone(a_BlockType); } @@ -271,4 +271,4 @@ private: default: return false; } } -}; \ No newline at end of file +}; diff --git a/src/Simulator/SandSimulator.h b/src/Simulator/SandSimulator.h index 6e9ea15ac..6e64aa425 100644 --- a/src/Simulator/SandSimulator.h +++ b/src/Simulator/SandSimulator.h @@ -15,7 +15,7 @@ public: cSandSimulator(cWorld & a_World, cIniFile & a_IniFile); // cSimulator overrides: - virtual void Simulate(float a_Dt) override {} // Unused in this simulator + virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} // not used virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override; virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override; diff --git a/src/Simulator/Simulator.h b/src/Simulator/Simulator.h index 5cd0e8657..a25b7f1b6 100644 --- a/src/Simulator/Simulator.h +++ b/src/Simulator/Simulator.h @@ -25,7 +25,14 @@ public: virtual void Simulate(float a_Dt) = 0; /// Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available - virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) {}; + virtual void SimulateChunk(float a_Dt, int a_ChunkX, + int a_ChunkZ, cChunk * a_Chunk) + { + UNUSED(a_Dt); + UNUSED(a_ChunkX); + UNUSED(a_ChunkZ); + UNUSED(a_Chunk); + }; /// Called when a block changes virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk); diff --git a/src/WebAdmin.h b/src/WebAdmin.h index 0907e7bc3..3eb807640 100644 --- a/src/WebAdmin.h +++ b/src/WebAdmin.h @@ -105,7 +105,7 @@ public: cWebAdmin(void); - ~cWebAdmin(); + virtual ~cWebAdmin(); /// Initializes the object. Returns true if successfully initialized and ready to start bool Init(void); @@ -169,9 +169,16 @@ protected: virtual void OnBody(const char * a_Data, int a_Size) override; // cHTTPFormParser::cCallbacks overrides. Files are ignored: - virtual void OnFileStart(cHTTPFormParser & a_Parser, const AString & a_FileName) override {} - virtual void OnFileData(cHTTPFormParser & a_Parser, const char * a_Data, int a_Size) override {} - virtual void OnFileEnd(cHTTPFormParser & a_Parser) override {} + virtual void OnFileStart(cHTTPFormParser &, const AString & a_FileName) override + { + UNUSED(a_FileName); + } + virtual void OnFileData(cHTTPFormParser &, const char * a_Data, int a_Size) override + { + UNUSED(a_Data); + UNUSED(a_Size); + } + virtual void OnFileEnd(cHTTPFormParser &) override {} } ; -- cgit v1.2.3 From 75abce905d28192ec1ad049945b160f2b64fee4a Mon Sep 17 00:00:00 2001 From: Tycho Bickerstaff Date: Sun, 22 Dec 2013 16:33:40 +0000 Subject: fixed bad merge --- src/Chunk.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 34cb6a534..fb26e983d 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -2900,10 +2900,6 @@ NIBBLETYPE cChunk::GetTimeAlteredLight(NIBBLETYPE a_Skylight) const -#if !C_CHUNK_USE_INLINE -# include "cChunk.inl.h" -#endif - -- cgit v1.2.3 From cd435ffca970f954d2ade1e81c7c4ae7df75907e Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Mon, 30 Dec 2013 22:56:08 +0100 Subject: Implented OnPlayerFishing and OnPlayerFished. --- src/Bindings/Plugin.h | 2 ++ src/Bindings/PluginLua.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ src/Bindings/PluginLua.h | 2 ++ src/Bindings/PluginManager.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ src/Bindings/PluginManager.h | 4 ++++ src/Items/ItemFishingRod.h | 8 +++++++- 6 files changed, 97 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index ee0f8a062..80356304a 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -68,6 +68,8 @@ public: virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerEating (cPlayer & a_Player) = 0; + virtual bool OnPlayerFished (cPlayer & a_Player, cItems & a_Reward) = 0; + virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) = 0; virtual bool OnPlayerJoined (cPlayer & a_Player) = 0; virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) = 0; virtual bool OnPlayerMoved (cPlayer & a_Player) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 69e83fb0a..66a60efe8 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -630,6 +630,46 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player) +bool cPluginLua::OnPlayerFished(cPlayer & a_Player, cItems & a_Reward) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHED]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, &a_Reward, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerFishing(cPlayer & a_Player, cItems & a_Reward) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, &a_Reward, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + bool cPluginLua::OnPlayerJoined(cPlayer & a_Player) { cCSLock Lock(m_CriticalSection); diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index 1b257285e..d0cb209f1 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -64,6 +64,8 @@ public: virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; + virtual bool OnPlayerFished (cPlayer & a_Player, cItems & a_Reward) override; + virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) override; virtual bool OnPlayerEating (cPlayer & a_Player) override; virtual bool OnPlayerJoined (cPlayer & a_Player) override; virtual bool OnPlayerMoved (cPlayer & a_Player) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index ffffe1a23..b863a95b5 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -694,6 +694,48 @@ bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player) +bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, cItems a_Reward) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerFished(a_Player, a_Reward)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, cItems a_Reward) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerFishing(a_Player, a_Reward)) + { + return true; + } + } + return false; +} + + + + + bool cPluginManager::CallHookPlayerJoined(cPlayer & a_Player) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_JOINED); diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index e94421057..da867c7b0 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -80,6 +80,8 @@ public: // tolua_export HOOK_PLAYER_BREAKING_BLOCK, HOOK_PLAYER_BROKEN_BLOCK, HOOK_PLAYER_EATING, + HOOK_PLAYER_FISHED, + HOOK_PLAYER_FISHING, HOOK_PLAYER_JOINED, HOOK_PLAYER_LEFT_CLICK, HOOK_PLAYER_MOVING, @@ -168,6 +170,8 @@ public: // tolua_export bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerEating (cPlayer & a_Player); + bool CallHookPlayerFished (cPlayer & a_Player, cItems a_Reward); + bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward); bool CallHookPlayerJoined (cPlayer & a_Player); bool CallHookPlayerMoving (cPlayer & a_Player); bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status); diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h index 941ce3b71..b2eaee63a 100644 --- a/src/Items/ItemFishingRod.h +++ b/src/Items/ItemFishingRod.h @@ -9,9 +9,11 @@ #pragma once +#include "../Bindings/PluginManager.h" #include "../Entities/Floater.h" #include "../Entities/Entity.h" #include "../Item.h" +#include "../Root.h" @@ -210,10 +212,14 @@ public: } } - + if (cRoot::Get()->GetPluginManager()->CallHookPlayerFishing(*a_Player, Drops)) + { + return true; + } Vector3d FloaterPos = FloaterInfo.GetPos(); Vector3d FlyDirection = a_Player->GetEyePosition() - FloaterPos; a_World->SpawnItemPickups(Drops, FloaterPos.x, FloaterPos.y, FloaterPos.z, FlyDirection.x, FlyDirection.y + 1, FlyDirection.z); + cRoot::Get()->GetPluginManager()->CallHookPlayerFished(*a_Player, Drops); } } else -- cgit v1.2.3 From 020a8b457d67a70f407482322188823af9ac7f72 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Tue, 31 Dec 2013 14:53:10 +0100 Subject: implemented the recommendations Xoft gave. --- src/Bindings/LuaState.cpp | 12 ++++++++++++ src/Bindings/LuaState.h | 1 + src/Bindings/Plugin.h | 4 ++-- src/Bindings/PluginLua.cpp | 8 ++++---- src/Bindings/PluginLua.h | 4 ++-- src/Bindings/PluginManager.cpp | 4 ++-- src/Bindings/PluginManager.h | 4 ++-- 7 files changed, 25 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 64a818a60..a684620f3 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -468,6 +468,18 @@ void cLuaState::Push(cItems * a_Items) +void cLuaState::Push(const cItems & a_Items) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, (void *)&a_Items, "cItems"); + m_NumCurrentFunctionArgs += 1; +} + + + + + void cLuaState::Push(cClientHandle * a_Client) { ASSERT(IsValid()); diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index a6c31b6d3..796559b6f 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -165,6 +165,7 @@ public: void Push(cMonster * a_Monster); void Push(cItem * a_Item); void Push(cItems * a_Items); + void Push(const cItems & a_Items); void Push(cClientHandle * a_ClientHandle); void Push(cPickup * a_Pickup); void Push(cChunkDesc * a_ChunkDesc); diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index 80356304a..80d9316e4 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -68,8 +68,8 @@ public: virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerEating (cPlayer & a_Player) = 0; - virtual bool OnPlayerFished (cPlayer & a_Player, cItems & a_Reward) = 0; - virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) = 0; + virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) = 0; + virtual bool OnPlayerFishing (cPlayer & a_Player, const cItems & a_Reward) = 0; virtual bool OnPlayerJoined (cPlayer & a_Player) = 0; virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) = 0; virtual bool OnPlayerMoved (cPlayer & a_Player) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 66a60efe8..d8108da54 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -630,14 +630,14 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player) -bool cPluginLua::OnPlayerFished(cPlayer & a_Player, cItems & a_Reward) +bool cPluginLua::OnPlayerFished(cPlayer & a_Player, const cItems & a_Reward) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHED]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Player, &a_Reward, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Player, a_Reward, cLuaState::Return, res); if (res) { return true; @@ -650,14 +650,14 @@ bool cPluginLua::OnPlayerFished(cPlayer & a_Player, cItems & a_Reward) -bool cPluginLua::OnPlayerFishing(cPlayer & a_Player, cItems & a_Reward) +bool cPluginLua::OnPlayerFishing(cPlayer & a_Player, const cItems & a_Reward) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHING]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Player, &a_Reward, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Player, a_Reward, cLuaState::Return, res); if (res) { return true; diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index d0cb209f1..ab15279da 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -64,9 +64,9 @@ public: virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual bool OnPlayerFished (cPlayer & a_Player, cItems & a_Reward) override; - virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) override; virtual bool OnPlayerEating (cPlayer & a_Player) override; + virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) override; + virtual bool OnPlayerFishing (cPlayer & a_Player, const cItems & a_Reward) override; virtual bool OnPlayerJoined (cPlayer & a_Player) override; virtual bool OnPlayerMoved (cPlayer & a_Player) override; virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index b863a95b5..027b87545 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -694,7 +694,7 @@ bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player) -bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, cItems a_Reward) +bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, const cItems a_Reward) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHED); if (Plugins == m_Hooks.end()) @@ -715,7 +715,7 @@ bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, cItems a_Reward) -bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, cItems a_Reward) +bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, const cItems a_Reward) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHING); if (Plugins == m_Hooks.end()) diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index da867c7b0..c6a8b8b9f 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -170,8 +170,8 @@ public: // tolua_export bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerEating (cPlayer & a_Player); - bool CallHookPlayerFished (cPlayer & a_Player, cItems a_Reward); - bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward); + bool CallHookPlayerFished (cPlayer & a_Player, const cItems a_Reward); + bool CallHookPlayerFishing (cPlayer & a_Player, const cItems a_Reward); bool CallHookPlayerJoined (cPlayer & a_Player); bool CallHookPlayerMoving (cPlayer & a_Player); bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status); -- cgit v1.2.3 From 852c52bee9ffcc7857ea5d112fef8a4254c57253 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 1 Jan 2014 11:18:56 +0200 Subject: Fixed GetPhysicalRAMUsage on Linux --- src/Root.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Root.cpp b/src/Root.cpp index 16a521698..fa1fdb37a 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -701,9 +701,9 @@ int cRoot::GetPhysicalRAMUsage(void) { AString Line; std::getline(StatFile, Line); - if (strncmp(Line.c_str(), "VmRSS:", 7) == 0) + if (strncmp(Line.c_str(), "VmRSS:", 6) == 0) { - int res = atoi(Line.c_str() + 8); + int res = atoi(Line.c_str() + 7); return (res == 0) ? -1 : res; // If parsing failed, return -1 } } -- cgit v1.2.3 From db00a36ff8d8f96c9554f29656196ecd4e08c6a9 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 1 Jan 2014 15:09:53 +0100 Subject: OnPlayerFishing doesn't have a const cItems anymore --- src/Bindings/Plugin.h | 2 +- src/Bindings/PluginLua.cpp | 2 +- src/Bindings/PluginLua.h | 2 +- src/Bindings/PluginManager.cpp | 2 +- src/Bindings/PluginManager.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index 80d9316e4..2c893a65d 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -69,7 +69,7 @@ public: virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerEating (cPlayer & a_Player) = 0; virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) = 0; - virtual bool OnPlayerFishing (cPlayer & a_Player, const cItems & a_Reward) = 0; + virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) = 0; virtual bool OnPlayerJoined (cPlayer & a_Player) = 0; virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) = 0; virtual bool OnPlayerMoved (cPlayer & a_Player) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index d8108da54..87212ed85 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -650,7 +650,7 @@ bool cPluginLua::OnPlayerFished(cPlayer & a_Player, const cItems & a_Reward) -bool cPluginLua::OnPlayerFishing(cPlayer & a_Player, const cItems & a_Reward) +bool cPluginLua::OnPlayerFishing(cPlayer & a_Player, cItems & a_Reward) { cCSLock Lock(m_CriticalSection); bool res = false; diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index ab15279da..a47ab32e0 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -66,7 +66,7 @@ public: virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerEating (cPlayer & a_Player) override; virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) override; - virtual bool OnPlayerFishing (cPlayer & a_Player, const cItems & a_Reward) override; + virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) override; virtual bool OnPlayerJoined (cPlayer & a_Player) override; virtual bool OnPlayerMoved (cPlayer & a_Player) override; virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 027b87545..3a6c542b1 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -715,7 +715,7 @@ bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, const cItems a_Rew -bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, const cItems a_Reward) +bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, cItems a_Reward) { HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHING); if (Plugins == m_Hooks.end()) diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index c6a8b8b9f..16c64d86f 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -171,7 +171,7 @@ public: // tolua_export bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerEating (cPlayer & a_Player); bool CallHookPlayerFished (cPlayer & a_Player, const cItems a_Reward); - bool CallHookPlayerFishing (cPlayer & a_Player, const cItems a_Reward); + bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward); bool CallHookPlayerJoined (cPlayer & a_Player); bool CallHookPlayerMoving (cPlayer & a_Player); bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status); -- cgit v1.2.3