diff options
419 files changed, 7110 insertions, 3793 deletions
diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core -Subproject bd23915df763b182610c6163c5ff2d64a075656 +Subproject 1b16c23c216d359e9fe0334c63deeecc347e69b diff --git a/lib/SQLiteCpp b/lib/SQLiteCpp -Subproject 203c2fb68bbf871eaf4ca98756a113d74d620de +Subproject 27b9d111818af3b05bcf4153bb6e380fe1dd681 diff --git a/src/AllocationPool.h b/src/AllocationPool.h index 61431a548..060cd2918 100644 --- a/src/AllocationPool.h +++ b/src/AllocationPool.h @@ -63,7 +63,7 @@ class cListAllocationPool : public cAllocationPool<T> } } - virtual T * Allocate() override + virtual T * Allocate() /*override*/ { if (m_FreeList.size() <= NumElementsInReserve) { @@ -88,7 +88,7 @@ class cListAllocationPool : public cAllocationPool<T> m_FreeList.pop_front(); return ret; } - virtual void Free(T * a_ptr) override + virtual void Free(T * a_ptr) /*override*/ { if (a_ptr == NULL) { diff --git a/src/Bindings/AllToLua.sh b/src/Bindings/AllToLua.sh index 887c2490c..887c2490c 100644..100755 --- a/src/Bindings/AllToLua.sh +++ b/src/Bindings/AllToLua.sh diff --git a/src/Bindings/LuaChunkStay.h b/src/Bindings/LuaChunkStay.h index 49ab9a0ad..13a9e3e58 100644 --- a/src/Bindings/LuaChunkStay.h +++ b/src/Bindings/LuaChunkStay.h @@ -54,10 +54,10 @@ protected: cLuaState::cRef m_OnAllChunksAvailable; - // cChunkStay overrides: - virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkZ) override; - virtual bool OnAllChunksAvailable(void) override; - virtual void OnDisabled(void) override; + // cChunkStay /*override*/s: + virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkZ) /*override*/; + virtual bool OnAllChunksAvailable(void) /*override*/; + virtual void OnDisabled(void) /*override*/; /** Adds a single chunk coord from the table at the top of the Lua stack. Expects the top element to be a table, checks that it contains two numbers. diff --git a/src/Bindings/LuaWindow.h b/src/Bindings/LuaWindow.h index dab99a2e2..26ce9d0da 100644 --- a/src/Bindings/LuaWindow.h +++ b/src/Bindings/LuaWindow.h @@ -81,12 +81,12 @@ protected: /// The Lua reference for the callback to call when a slot has changed int m_OnSlotChangedFnRef; - // cWindow overrides: - virtual bool ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse) override; - virtual void Destroy(void) override; + // cWindow /*override*/s: + virtual bool ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse) /*override*/; + virtual void Destroy(void) /*override*/; - // cItemGrid::cListener overrides: - virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override; + // cItemGrid::cListener /*override*/s: + virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) /*override*/; } ; // tolua_export diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index b7ea65759..603098bc6 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -354,7 +354,7 @@ static int tolua_DoWith(lua_State* tolua_S) {} private: - virtual bool Item(Ty2 * a_Item) override + virtual bool Item(Ty2 * a_Item) /*override*/ { lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ tolua_pushusertype(LuaState, a_Item, Ty2::GetClassStatic()); @@ -444,7 +444,7 @@ static int tolua_DoWithID(lua_State* tolua_S) {} private: - virtual bool Item(Ty2 * a_Item) override + virtual bool Item(Ty2 * a_Item) /*override*/ { lua_rawgeti(LuaState, LUA_REGISTRYINDEX, FuncRef); // Push function to call tolua_pushusertype(LuaState, a_Item, Ty2::GetClassStatic()); // Push the item @@ -540,7 +540,7 @@ static int tolua_DoWithXYZ(lua_State* tolua_S) {} private: - virtual bool Item(Ty2 * a_Item) override + virtual bool Item(Ty2 * a_Item) /*override*/ { lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ tolua_pushusertype(LuaState, a_Item, Ty2::GetClassStatic()); @@ -635,7 +635,7 @@ static int tolua_ForEachInChunk(lua_State * tolua_S) {} private: - virtual bool Item(Ty2 * a_Item) override + virtual bool Item(Ty2 * a_Item) /*override*/ { lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ tolua_pushusertype(LuaState, a_Item, Ty2::GetClassStatic()); @@ -797,7 +797,7 @@ static int tolua_ForEach(lua_State * tolua_S) {} private: - virtual bool Item(Ty2 * a_Item) override + virtual bool Item(Ty2 * a_Item) /*override*/ { lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ tolua_pushusertype( LuaState, a_Item, Ty2::GetClassStatic()); @@ -1116,8 +1116,8 @@ protected: cPluginLua & m_Plugin; int m_FnRef; - // cWorld::cTask overrides: - virtual void Run(cWorld & a_World) override + // cWorld::cTask /*override*/s: + virtual void Run(cWorld & a_World) /*override*/ { m_Plugin.Call(m_FnRef, &a_World); } @@ -1180,8 +1180,8 @@ protected: cPluginLua & m_Plugin; int m_FnRef; - // cWorld::cTask overrides: - virtual void Run(cWorld & a_World) override + // cWorld::cTask /*override*/s: + virtual void Run(cWorld & a_World) /*override*/ { m_Plugin.Call(m_FnRef, &a_World); } @@ -1492,7 +1492,7 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S) {} private: - virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override + virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) /*override*/ { UNUSED(a_Plugin); @@ -1569,7 +1569,7 @@ static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S) {} private: - virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override + virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) /*override*/ { UNUSED(a_Plugin); UNUSED(a_Permission); @@ -1801,7 +1801,7 @@ static int tolua_cPluginManager_CallPlugin(lua_State * tolua_S) const AString & m_FunctionName; cLuaState & m_SrcLuaState; - virtual bool Item(cPlugin * a_Plugin) override + virtual bool Item(cPlugin * a_Plugin) /*override*/ { m_NumReturns = ((cPluginLua *)a_Plugin)->CallFunctionFromForeignState( m_FunctionName, m_SrcLuaState, 4, lua_gettop(m_SrcLuaState) @@ -2586,7 +2586,7 @@ public: { } - virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) override + virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) /*override*/ { bool res = false; if (!m_LuaState.Call( @@ -2601,7 +2601,7 @@ public: return res; } - virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace) override + virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace) /*override*/ { bool res = false; if (!m_LuaState.Call( @@ -2616,7 +2616,7 @@ public: return res; } - virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override + virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) /*override*/ { bool res = false; if (!m_LuaState.Call( @@ -2631,7 +2631,7 @@ public: return res; } - virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override + virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) /*override*/ { bool res = false; if (!m_LuaState.Call( @@ -2646,12 +2646,12 @@ public: return res; } - virtual void OnNoMoreHits(void) override + virtual void OnNoMoreHits(void) /*override*/ { m_LuaState.Call(cLuaState::cTableRef(m_TableRef, "OnNoMoreHits")); } - virtual void OnNoChunk(void) override + virtual void OnNoChunk(void) /*override*/ { m_LuaState.Call(cLuaState::cTableRef(m_TableRef, "OnNoChunk")); } diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index eda65b76c..3bd55823d 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -64,88 +64,92 @@ public: cPluginLua(const AString & a_PluginDirectory); ~cPluginLua(); - virtual void OnDisable(void) override; - virtual bool Initialize(void) override; - - virtual void Tick(float a_Dt) override; - - virtual bool OnBlockSpread (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, eSpreadSource a_Source) override; - virtual bool OnBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) override; - virtual bool OnChat (cPlayer * a_Player, AString & a_Message) override; - virtual bool OnChunkAvailable (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override; - virtual bool OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) override; - virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) override; - virtual bool OnChunkUnloaded (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override; - virtual bool OnChunkUnloading (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override; - virtual bool OnCollectingPickup (cPlayer * a_Player, cPickup * a_Pickup) override; - virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override; - virtual bool OnDisconnect (cClientHandle & a_Client, const AString & a_Reason) override; - virtual bool OnEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) override; - virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split) override; - virtual bool OnExploded (cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) override; - virtual bool OnExploding (cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) override; - virtual bool OnHandshake (cClientHandle * a_Client, const AString & a_Username) override; - virtual bool OnHopperPullingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) override; - virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) override; - virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI) override; - virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) override; - 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 OnPlayerDestroyed (cPlayer & a_Player) 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, cItems & a_Reward) override; - virtual bool OnPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel) override; - virtual bool OnPlayerJoined (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; - virtual bool OnPlayerMoving (cPlayer & a_Player, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition) override; - virtual bool OnPlayerPlacedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual bool OnPlayerPlacingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual bool OnPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override; - virtual bool OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) override; - virtual bool OnPlayerShooting (cPlayer & a_Player) override; - virtual bool OnPlayerSpawned (cPlayer & a_Player) override; - virtual bool OnPlayerTossingItem (cPlayer & a_Player) override; - virtual bool OnPlayerUsedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override; - virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override; - virtual bool OnPluginMessage (cClientHandle & a_Client, const AString & a_Channel, const AString & a_Message) override; - virtual bool OnPluginsLoaded (void) override; - virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override; - virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override; - virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) override; - virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) override; + virtual void OnDisable(void) /*override*/; + virtual bool Initialize(void) /*override*/; + + virtual void Tick(float a_Dt) /*override*/; + + virtual bool OnBlockSpread (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, eSpreadSource a_Source) /*override*/; + virtual bool OnBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) /*override*/; + virtual bool OnChat (cPlayer * a_Player, AString & a_Message) /*override*/; + virtual bool OnChunkAvailable (cWorld * a_World, int a_ChunkX, int a_ChunkZ) /*override*/; + virtual bool OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) /*override*/; + virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) /*override*/; + virtual bool OnChunkUnloaded (cWorld * a_World, int a_ChunkX, int a_ChunkZ) /*override*/; + virtual bool OnChunkUnloading (cWorld * a_World, int a_ChunkX, int a_ChunkZ) /*override*/; + virtual bool OnCollectingPickup (cPlayer * a_Player, cPickup * a_Pickup) /*override*/; + virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) /*override*/; + + virtual bool OnDisconnect (cClientHandle & a_Client, const AString & a_Reason) /*override*/; + virtual bool OnEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) /*override*/; + virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split) /*override*/; + virtual bool OnExploded (cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) /*override*/; + virtual bool OnExploding (cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) /*override*/; + virtual bool OnHandshake (cClientHandle * a_Client, const AString & a_Username) /*override*/; + virtual bool OnHopperPullingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) /*override*/; + virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) /*override*/; + virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer, TakeDamageInfo & a_TDI) /*override*/; + virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) /*override*/; + + 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 OnPlayerDestroyed (cPlayer & a_Player) /*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, cItems & a_Reward) /*override*/; + virtual bool OnPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel) /*override*/; + virtual bool OnPlayerJoined (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*/; + virtual bool OnPlayerMoving (cPlayer & a_Player, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition) /*override*/; + virtual bool OnPlayerPlacedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/; + virtual bool OnPlayerPlacingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/; + virtual bool OnPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/; + virtual bool OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) /*override*/; + virtual bool OnPlayerShooting (cPlayer & a_Player) /*override*/; + virtual bool OnPlayerSpawned (cPlayer & a_Player) /*override*/; + virtual bool OnPlayerTossingItem (cPlayer & a_Player) /*override*/; + virtual bool OnPlayerUsedBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/; + virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/; + virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/; + virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/; + + virtual bool OnPluginMessage (cClientHandle & a_Client, const AString & a_Channel, const AString & a_Message) /*override*/; + virtual bool OnPluginsLoaded (void) /*override*/; + virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) /*override*/; + virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) /*override*/; + virtual bool OnProjectileHitBlock (cProjectileEntity & a_Projectile, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Face, const Vector3d & a_BlockHitPos) /*override*/; + virtual bool OnProjectileHitEntity (cProjectileEntity & a_Projectile, cEntity & a_HitEntity) /*override*/; + virtual bool OnServerPing (cClientHandle & a_ClientHandle, AString & a_ServerDescription, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon) override; - virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) override; - virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) override; - virtual bool OnSpawningEntity (cWorld & a_World, cEntity & a_Entity) override; - virtual bool OnSpawningMonster (cWorld & a_World, cMonster & a_Monster) override; - virtual bool OnTakeDamage (cEntity & a_Receiver, TakeDamageInfo & a_TakeDamageInfo) override; - virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) override; - virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) override; - virtual bool OnWeatherChanged (cWorld & a_World) override; - virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather) override; - virtual bool OnWorldStarted (cWorld & a_World) override; - virtual bool OnWorldTick (cWorld & a_World, float a_Dt, int a_LastTickDurationMSec) override; + virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) /*override*/; + virtual bool OnSpawnedMonster (cWorld & a_World, cMonster & a_Monster) /*override*/; + virtual bool OnSpawningEntity (cWorld & a_World, cEntity & a_Entity) /*override*/; + virtual bool OnSpawningMonster (cWorld & a_World, cMonster & a_Monster) /*override*/; + virtual bool OnTakeDamage (cEntity & a_Receiver, TakeDamageInfo & a_TakeDamageInfo) /*override*/; + virtual bool OnUpdatedSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) /*override*/; + virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) /*override*/; + virtual bool OnWeatherChanged (cWorld & a_World) /*override*/; + virtual bool OnWeatherChanging (cWorld & a_World, eWeather & a_NewWeather) /*override*/; + virtual bool OnWorldStarted (cWorld & a_World) /*override*/; + virtual bool OnWorldTick (cWorld & a_World, float a_Dt, int a_LastTickDurationMSec) /*override*/; - virtual bool HandleCommand(const AStringVector & a_Split, cPlayer * a_Player) override; + virtual bool HandleCommand(const AStringVector & a_Split, cPlayer * a_Player) /*override*/; - virtual bool HandleConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) override; + virtual bool HandleConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) /*override*/; - virtual void ClearCommands(void) override; + virtual void ClearCommands(void) /*override*/; - virtual void ClearConsoleCommands(void) override; + virtual void ClearConsoleCommands(void) /*override*/; /** Returns true if the plugin contains the function for the specified hook type, using the old-style registration (#121) */ bool CanAddOldStyleHook(int a_HookType); - // cWebPlugin override + // cWebPlugin /*override*/ virtual const AString GetWebTitle(void) const {return GetName(); } // cWebPlugin and WebAdmin stuff - virtual AString HandleWebRequest(const HTTPRequest * a_Request) override; + virtual AString HandleWebRequest(const HTTPRequest * a_Request) /*override*/; bool AddWebTab(const AString & a_Title, lua_State * a_LuaState, int a_FunctionReference); // >> EXPORTED IN MANUALBINDINGS << /** Binds the command to call the function specified by a Lua function reference. Simply adds to CommandMap. */ diff --git a/src/BlockArea.h b/src/BlockArea.h index 86f7c4f2d..dbf7b345d 100644 --- a/src/BlockArea.h +++ b/src/BlockArea.h @@ -316,9 +316,9 @@ protected: void CopyNibbles(NIBBLETYPE * a_AreaDst, const NIBBLETYPE * a_ChunkSrc); - // cChunkDataCallback overrides: - virtual bool Coords(int a_ChunkX, int a_ChunkZ) override; - virtual void ChunkData(const cChunkData & a_BlockTypes) override; + // cChunkDataCallback /*override*/s: + virtual bool Coords(int a_ChunkX, int a_ChunkZ) /*override*/; + virtual void ChunkData(const cChunkData & a_BlockTypes) /*override*/; } ; typedef NIBBLETYPE * NIBBLEARRAY; diff --git a/src/BlockEntities/BeaconEntity.h b/src/BlockEntities/BeaconEntity.h index 0d7150aef..ebd6cf9be 100644 --- a/src/BlockEntities/BeaconEntity.h +++ b/src/BlockEntities/BeaconEntity.h @@ -35,11 +35,11 @@ public: cBeaconEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); bool LoadFromJson(const Json::Value & a_Value); - // cBlockEntity overrides: - virtual void SaveToJson(Json::Value& a_Value) override; - virtual void SendTo(cClientHandle & a_Client) override; - virtual bool Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void UsedBy(cPlayer * a_Player) override; + // cBlockEntity /*override*/s: + virtual void SaveToJson(Json::Value& a_Value) /*override*/; + virtual void SendTo(cClientHandle & a_Client) /*override*/; + virtual bool Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void UsedBy(cPlayer * a_Player) /*override*/; /** Modify the beacon level. (It is needed to load the beacon corectly) */ void SetBeaconLevel(char a_Level) { m_BeaconLevel = a_Level; } diff --git a/src/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h index 5f1639d45..d70535e08 100644 --- a/src/BlockEntities/BlockEntityWithItems.h +++ b/src/BlockEntities/BlockEntityWithItems.h @@ -43,7 +43,7 @@ public: m_Contents.AddListener(*this); } - virtual void Destroy(void) override + virtual void Destroy(void) /*override*/ { // Drop the contents as pickups: ASSERT(m_World != NULL); @@ -72,7 +72,7 @@ public: protected: cItemGrid m_Contents; - // cItemGrid::cListener overrides: + // cItemGrid::cListener /*override*/s: virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) { UNUSED(a_SlotNum); diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp index 21e1f6ba2..602aed609 100644 --- a/src/BlockEntities/ChestEntity.cpp +++ b/src/BlockEntities/ChestEntity.cpp @@ -141,7 +141,7 @@ void cChestEntity::OpenNewWindow(void) { } - virtual bool Item(cChestEntity * a_Chest) override + virtual bool Item(cChestEntity * a_Chest) /*override*/ { if ((a_Chest->GetPosY() + 1 < cChunkDef::Height) && cBlockInfo::IsSolid(a_Chest->GetWorld()->GetBlock(a_Chest->GetPosX(), a_Chest->GetPosY() + 1, a_Chest->GetPosZ()))) { diff --git a/src/BlockEntities/ChestEntity.h b/src/BlockEntities/ChestEntity.h index cd06b3e2c..4bb7cdf33 100644 --- a/src/BlockEntities/ChestEntity.h +++ b/src/BlockEntities/ChestEntity.h @@ -44,10 +44,10 @@ public: bool LoadFromJson(const Json::Value & a_Value); - // cBlockEntity overrides: - virtual void SaveToJson(Json::Value & a_Value) override; - virtual void SendTo(cClientHandle & a_Client) override; - virtual void UsedBy(cPlayer * a_Player) override; + // cBlockEntity /*override*/s: + virtual void SaveToJson(Json::Value & a_Value) /*override*/; + virtual void SendTo(cClientHandle & a_Client) /*override*/; + virtual void UsedBy(cPlayer * a_Player) /*override*/; /** Opens a new chest window for this chest. Scans for neighbors to open a double chest window, if appropriate. */ diff --git a/src/BlockEntities/CommandBlockEntity.h b/src/BlockEntities/CommandBlockEntity.h index d02bf7d7b..7c6f195b5 100644 --- a/src/BlockEntities/CommandBlockEntity.h +++ b/src/BlockEntities/CommandBlockEntity.h @@ -39,11 +39,11 @@ public: cCommandBlockEntity(int a_X, int a_Y, int a_Z, cWorld * a_World); bool LoadFromJson( const Json::Value& a_Value); - virtual void SaveToJson(Json::Value& a_Value) override; + virtual void SaveToJson(Json::Value& a_Value) /*override*/; - virtual bool Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void SendTo(cClientHandle & a_Client) override; - virtual void UsedBy(cPlayer * a_Player) override; + virtual bool Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void SendTo(cClientHandle & a_Client) /*override*/; + virtual void UsedBy(cPlayer * a_Player) /*override*/; void SetLastOutput(const AString & a_LastOut); diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index b33d08342..ec21791dc 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -33,8 +33,8 @@ public: // tolua_end private: - // cDropSpenser overrides: - virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override; + // cDropSpenser /*override*/s: + virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) /*override*/; /** If such a bucket can fit, adds it to m_Contents and returns true */ bool ScoopUpLiquid(int a_SlotNum, short a_BucketItemType); diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp index dc38e3e9b..3fe8ae390 100644 --- a/src/BlockEntities/DropSpenserEntity.cpp +++ b/src/BlockEntities/DropSpenserEntity.cpp @@ -2,7 +2,7 @@ // DropSpenserEntity.cpp // Declares the cDropSpenserEntity class representing a common ancestor to the cDispenserEntity and cDropperEntity -// The dropper and dispenser only needs to override the DropSpenseFromSlot() function to provide the specific item behavior +// The dropper and dispenser only needs to /*override*/ the DropSpenseFromSlot() function to provide the specific item behavior #include "Globals.h" #include "DropSpenserEntity.h" diff --git a/src/BlockEntities/DropSpenserEntity.h b/src/BlockEntities/DropSpenserEntity.h index be56447aa..497e52d14 100644 --- a/src/BlockEntities/DropSpenserEntity.h +++ b/src/BlockEntities/DropSpenserEntity.h @@ -2,7 +2,7 @@ // DropSpenser.h // Declares the cDropSpenser class representing a common ancestor to the cDispenserEntity and cDropperEntity -// The dropper and dispenser only needs to override the DropSpenseFromSlot() function to provide the specific item behavior +// The dropper and dispenser only needs to /*override*/ the DropSpenseFromSlot() function to provide the specific item behavior @@ -53,11 +53,11 @@ public: bool LoadFromJson(const Json::Value & a_Value); - // cBlockEntity overrides: - virtual void SaveToJson(Json::Value & a_Value) override; - virtual bool Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void SendTo(cClientHandle & a_Client) override; - virtual void UsedBy(cPlayer * a_Player) override; + // cBlockEntity /*override*/s: + virtual void SaveToJson(Json::Value & a_Value) /*override*/; + virtual bool Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void SendTo(cClientHandle & a_Client) /*override*/; + virtual void UsedBy(cPlayer * a_Player) /*override*/; // tolua_begin @@ -70,7 +70,7 @@ public: // tolua_end /// Sets the internal redstone power flag to "on" or "off", depending on the parameter. Calls Activate() if appropriate - virtual void SetRedstonePower(bool a_IsPowered) override; + virtual void SetRedstonePower(bool a_IsPowered) /*override*/; protected: bool m_ShouldDropSpense; ///< If true, the dropspenser will dropspense an item in the next tick diff --git a/src/BlockEntities/DropperEntity.h b/src/BlockEntities/DropperEntity.h index 8e07bc6f8..c87b42cf4 100644 --- a/src/BlockEntities/DropperEntity.h +++ b/src/BlockEntities/DropperEntity.h @@ -31,8 +31,8 @@ public: static const char * GetClassStatic(void) { return "cDropperEntity"; } protected: - // cDropSpenserEntity overrides: - virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override; + // cDropSpenserEntity /*override*/s: + virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) /*override*/; /** Takes an item from slot a_SlotNum and puts it into the container in front of the dropper. Called when there's a container directly in front of the dropper, diff --git a/src/BlockEntities/EnderChestEntity.h b/src/BlockEntities/EnderChestEntity.h index ed178f6fc..d3d494b20 100644 --- a/src/BlockEntities/EnderChestEntity.h +++ b/src/BlockEntities/EnderChestEntity.h @@ -24,10 +24,10 @@ public: static const char * GetClassStatic(void) { return "cEnderChestEntity"; } - // cBlockEntity overrides: - virtual void UsedBy(cPlayer * a_Player) override; - virtual void SaveToJson(Json::Value & a_Value) override { UNUSED(a_Value); } - virtual void SendTo(cClientHandle & a_Client) override { UNUSED(a_Client); } + // cBlockEntity /*override*/s: + virtual void UsedBy(cPlayer * a_Player) /*override*/; + virtual void SaveToJson(Json::Value & a_Value) /*override*/ { UNUSED(a_Value); } + virtual void SendTo(cClientHandle & a_Client) /*override*/ { UNUSED(a_Client); } static void LoadFromJson(const Json::Value & a_Value, cItemGrid & a_Grid); static void SaveToJson(Json::Value & a_Value, const cItemGrid & a_Grid); diff --git a/src/BlockEntities/FlowerPotEntity.h b/src/BlockEntities/FlowerPotEntity.h index 89901cf2d..478c54270 100644 --- a/src/BlockEntities/FlowerPotEntity.h +++ b/src/BlockEntities/FlowerPotEntity.h @@ -40,9 +40,9 @@ public: cFlowerPotEntity(int a_BlocX, int a_BlockY, int a_BlockZ, cWorld * a_World); bool LoadFromJson( const Json::Value& a_Value); - virtual void SaveToJson(Json::Value& a_Value) override; + virtual void SaveToJson(Json::Value& a_Value) /*override*/; - virtual void Destroy(void) override; + virtual void Destroy(void) /*override*/; // tolua_begin @@ -57,8 +57,8 @@ public: // tolua_end - virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle & a_Client) override; + virtual void UsedBy(cPlayer * a_Player) /*override*/; + virtual void SendTo(cClientHandle & a_Client) /*override*/; static bool IsFlower(short m_ItemType, short m_ItemData); diff --git a/src/BlockEntities/FurnaceEntity.h b/src/BlockEntities/FurnaceEntity.h index cf1a755e0..474c0c973 100644 --- a/src/BlockEntities/FurnaceEntity.h +++ b/src/BlockEntities/FurnaceEntity.h @@ -48,11 +48,11 @@ public: bool LoadFromJson(const Json::Value & a_Value); - // cBlockEntity overrides: - virtual void SaveToJson(Json::Value & a_Value) override; - virtual void SendTo(cClientHandle & a_Client) override; - virtual bool Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void UsedBy(cPlayer * a_Player) override; + // cBlockEntity /*override*/s: + virtual void SaveToJson(Json::Value & a_Value) /*override*/; + virtual void SendTo(cClientHandle & a_Client) /*override*/; + virtual bool Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void UsedBy(cPlayer * a_Player) /*override*/; /// Restarts cooking. Used after the furnace is loaded from storage to set up the internal variables so that cooking continues, if it was active. Returns true if cooking. bool ContinueCooking(void); @@ -152,8 +152,8 @@ protected: /// Sets the m_IsCooking variable, updates the furnace block type based on the value void SetIsCooking(bool a_IsCooking); - // cItemGrid::cListener overrides: - virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override; + // cItemGrid::cListener /*override*/s: + virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) /*override*/; } ; // tolua_export diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp index 88e7b8e1b..59695d5b0 100644 --- a/src/BlockEntities/HopperEntity.cpp +++ b/src/BlockEntities/HopperEntity.cpp @@ -209,7 +209,7 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick) { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { ASSERT(a_Entity != NULL); diff --git a/src/BlockEntities/HopperEntity.h b/src/BlockEntities/HopperEntity.h index 8e856fcda..5474eb623 100644 --- a/src/BlockEntities/HopperEntity.h +++ b/src/BlockEntities/HopperEntity.h @@ -47,11 +47,11 @@ protected: Int64 m_LastMoveItemsInTick; Int64 m_LastMoveItemsOutTick; - // cBlockEntity overrides: - virtual bool Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void SaveToJson(Json::Value & a_Value) override; - virtual void SendTo(cClientHandle & a_Client) override; - virtual void UsedBy(cPlayer * a_Player) override; + // cBlockEntity /*override*/s: + virtual bool Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void SaveToJson(Json::Value & a_Value) /*override*/; + virtual void SendTo(cClientHandle & a_Client) /*override*/; + virtual void UsedBy(cPlayer * a_Player) /*override*/; /// Opens a new chest window for this chest. Scans for neighbors to open a double chest window, if appropriate. void OpenNewWindow(void); diff --git a/src/BlockEntities/JukeboxEntity.h b/src/BlockEntities/JukeboxEntity.h index d677d340f..725585eb3 100644 --- a/src/BlockEntities/JukeboxEntity.h +++ b/src/BlockEntities/JukeboxEntity.h @@ -31,7 +31,7 @@ public: virtual ~cJukeboxEntity(); bool LoadFromJson(const Json::Value & a_Value); - virtual void SaveToJson(Json::Value & a_Value) override; + virtual void SaveToJson(Json::Value & a_Value) /*override*/; // tolua_begin @@ -57,8 +57,8 @@ public: static const char * GetClassStatic(void) { return "cJukeboxEntity"; } - virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle &) override {} + virtual void UsedBy(cPlayer * a_Player) /*override*/; + virtual void SendTo(cClientHandle &) /*override*/ {} private: int m_Record; diff --git a/src/BlockEntities/MobHeadEntity.h b/src/BlockEntities/MobHeadEntity.h index f91a3cc9e..6fa156d52 100644 --- a/src/BlockEntities/MobHeadEntity.h +++ b/src/BlockEntities/MobHeadEntity.h @@ -38,7 +38,7 @@ public: cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); bool LoadFromJson( const Json::Value& a_Value); - virtual void SaveToJson(Json::Value& a_Value) override; + virtual void SaveToJson(Json::Value& a_Value) /*override*/; // tolua_begin @@ -62,8 +62,8 @@ public: // tolua_end - virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle & a_Client) override; + virtual void UsedBy(cPlayer * a_Player) /*override*/; + virtual void SendTo(cClientHandle & a_Client) /*override*/; static const char * GetClassStatic(void) { return "cMobHeadEntity"; } diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h index f538de060..d7b28754c 100644 --- a/src/BlockEntities/NoteEntity.h +++ b/src/BlockEntities/NoteEntity.h @@ -45,7 +45,7 @@ public: virtual ~cNoteEntity() {} bool LoadFromJson(const Json::Value & a_Value); - virtual void SaveToJson(Json::Value & a_Value) override; + virtual void SaveToJson(Json::Value & a_Value) /*override*/; // tolua_begin @@ -56,8 +56,8 @@ public: // tolua_end - virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle &) override {} + virtual void UsedBy(cPlayer * a_Player) /*override*/; + virtual void SendTo(cClientHandle &) /*override*/ {} virtual void SetRedstonePower(bool a_Value) { diff --git a/src/BlockEntities/SignEntity.h b/src/BlockEntities/SignEntity.h index 33af100a4..a8e388c47 100644 --- a/src/BlockEntities/SignEntity.h +++ b/src/BlockEntities/SignEntity.h @@ -38,7 +38,7 @@ public: cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World); bool LoadFromJson( const Json::Value& a_Value); - virtual void SaveToJson(Json::Value& a_Value) override; + virtual void SaveToJson(Json::Value& a_Value) /*override*/; // tolua_begin @@ -53,8 +53,8 @@ public: // tolua_end - virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle & a_Client) override; + virtual void UsedBy(cPlayer * a_Player) /*override*/; + virtual void SendTo(cClientHandle & a_Client) /*override*/; static const char * GetClassStatic(void) { return "cSignEntity"; } diff --git a/src/BlockInServerPluginInterface.h b/src/BlockInServerPluginInterface.h index e82435364..3ea063a23 100644 --- a/src/BlockInServerPluginInterface.h +++ b/src/BlockInServerPluginInterface.h @@ -10,7 +10,7 @@ class cBlockInServerPluginInterface : public cBlockPluginInterface { public: cBlockInServerPluginInterface(cWorld & a_World) : m_World(a_World) {} - virtual bool CallHookBlockToPickups(cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) override + virtual bool CallHookBlockToPickups(cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) /*override*/ { return cRoot::Get()->GetPluginManager()->CallHookBlockToPickups(&m_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_Pickups); } diff --git a/src/Blocks/BlockAnvil.h b/src/Blocks/BlockAnvil.h index 20514580e..6607ce5d4 100644 --- a/src/Blocks/BlockAnvil.h +++ b/src/Blocks/BlockAnvil.h @@ -19,13 +19,13 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_BLOCK_ANVIL, 1, a_BlockMeta >> 2)); } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { cWindow * Window = new cAnvilWindow(a_BlockX, a_BlockY, a_BlockZ); a_Player->OpenWindow(Window); @@ -37,7 +37,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; NIBBLETYPE Meta = (NIBBLETYPE)a_Player->GetEquippedItem().m_ItemDamage; @@ -58,7 +58,7 @@ public: } - virtual bool IsUseable() override + virtual bool IsUseable() /*override*/ { return true; } diff --git a/src/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp index cd5783f58..4b56639db 100644 --- a/src/Blocks/BlockBed.cpp +++ b/src/Blocks/BlockBed.cpp @@ -54,7 +54,7 @@ void cBlockBedHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInt class cTimeFastForwardTester : public cPlayerListCallback { - virtual bool Item(cPlayer * a_Player) override + virtual bool Item(cPlayer * a_Player) /*override*/ { if (!a_Player->IsInBed()) { @@ -78,7 +78,7 @@ public: { } - virtual bool Item(cPlayer * a_Player) override + virtual bool Item(cPlayer * a_Player) /*override*/ { a_Player->SetIsInBed(false); m_WorldInterface.GetBroadcastManager().BroadcastEntityAnimation(*a_Player, 2); diff --git a/src/Blocks/BlockBed.h b/src/Blocks/BlockBed.h index bf9d9c01d..4b3a7fc18 100644 --- a/src/Blocks/BlockBed.h +++ b/src/Blocks/BlockBed.h @@ -21,25 +21,25 @@ public: } - virtual void OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override; + virtual void OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/; + virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/; - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to zero a_Pickups.push_back(cItem(E_ITEM_BED, 1, 0)); } - virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override + virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) /*override*/ { return true; } diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h index 72e552dee..6afb46866 100644 --- a/src/Blocks/BlockBigFlower.h +++ b/src/Blocks/BlockBigFlower.h @@ -19,7 +19,7 @@ public: } - virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop, bool a_DropVerbatim) override + virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop, bool a_DropVerbatim) /*override*/ { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); if (Meta & 0x8) @@ -33,7 +33,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { NIBBLETYPE Meta = a_BlockMeta & 0x7; @@ -46,7 +46,7 @@ public: } - virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); if (Meta & 0x8) @@ -79,7 +79,7 @@ public: } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR) && (a_RelY < cChunkDef::Height) && ((a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ) == E_BLOCK_AIR) || (a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ) == E_BLOCK_BIG_FLOWER))); } @@ -90,14 +90,14 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta - ) override + ) /*override*/ { int Meta = (((int)floor(a_Player->GetYaw() * 4.0 / 360.0 + 0.5) & 0x3) + 2) % 4; a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, 0x8 | Meta); } - virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); @@ -120,7 +120,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } diff --git a/src/Blocks/BlockBrewingStand.h b/src/Blocks/BlockBrewingStand.h index 57642bcb6..7f8c9e1a4 100644 --- a/src/Blocks/BlockBrewingStand.h +++ b/src/Blocks/BlockBrewingStand.h @@ -16,12 +16,12 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_ITEM_BREWING_STAND, 1, 0)); } - virtual bool IsUseable() override + virtual bool IsUseable() /*override*/ { return true; } diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index 3b45afff8..fb37ac7ef 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -17,7 +17,7 @@ public: } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { // Set p the ON bit to on NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x08); @@ -31,14 +31,14 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to 0 a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } @@ -49,7 +49,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = BlockFaceToMetaData(a_BlockFace); @@ -57,7 +57,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return m_BlockType == E_BLOCK_WOODEN_BUTTON ? "step.wood" : "step.stone"; } @@ -95,7 +95,7 @@ public: } } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { NIBBLETYPE Meta; a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); diff --git a/src/Blocks/BlockCactus.h b/src/Blocks/BlockCactus.h index ed441517d..2061812d6 100644 --- a/src/Blocks/BlockCactus.h +++ b/src/Blocks/BlockCactus.h @@ -17,14 +17,14 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to 0 a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { if (a_RelY <= 0) { @@ -65,13 +65,13 @@ public: } - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { a_Chunk.GetWorld()->GrowCactus(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.cloth"; } diff --git a/src/Blocks/BlockCake.h b/src/Blocks/BlockCake.h index f05f468e5..ae5f40810 100644 --- a/src/Blocks/BlockCake.h +++ b/src/Blocks/BlockCake.h @@ -15,7 +15,7 @@ public: { } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); @@ -34,17 +34,17 @@ public: } } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Give nothing } - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.cloth"; } diff --git a/src/Blocks/BlockCarpet.h b/src/Blocks/BlockCarpet.h index d1aa52687..567671a23 100644 --- a/src/Blocks/BlockCarpet.h +++ b/src/Blocks/BlockCarpet.h @@ -24,7 +24,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.cloth"; } @@ -35,7 +35,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = a_Player->GetEquippedItem().m_ItemDamage & 0x0f; @@ -43,13 +43,13 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_BLOCK_CARPET, 1, a_BlockMeta)); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return (a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR); } diff --git a/src/Blocks/BlockCauldron.h b/src/Blocks/BlockCauldron.h index e0f86f4cb..1274d7f72 100644 --- a/src/Blocks/BlockCauldron.h +++ b/src/Blocks/BlockCauldron.h @@ -16,12 +16,12 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_ITEM_CAULDRON, 1, 0)); } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); switch (a_Player->GetEquippedItem().m_ItemType) @@ -54,12 +54,12 @@ public: } } - virtual bool IsUseable() override + virtual bool IsUseable() /*override*/ { return true; } - virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width; int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width; diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h index 28adbed4f..d36f50d3b 100644 --- a/src/Blocks/BlockChest.h +++ b/src/Blocks/BlockChest.h @@ -25,7 +25,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; @@ -72,7 +72,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta - ) override + ) /*override*/ { // Check if this forms a doublechest, if so, need to adjust the meta: cBlockArea Area; @@ -107,12 +107,12 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width; int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width; @@ -226,7 +226,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } diff --git a/src/Blocks/BlockCloth.h b/src/Blocks/BlockCloth.h index 3c1ae7c25..75082c8a6 100644 --- a/src/Blocks/BlockCloth.h +++ b/src/Blocks/BlockCloth.h @@ -16,7 +16,7 @@ public: { } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.cloth"; } diff --git a/src/Blocks/BlockCobWeb.h b/src/Blocks/BlockCobWeb.h index 982bfaa30..c26935319 100644 --- a/src/Blocks/BlockCobWeb.h +++ b/src/Blocks/BlockCobWeb.h @@ -19,7 +19,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) /*override*/ { a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0)); } diff --git a/src/Blocks/BlockCommandBlock.h b/src/Blocks/BlockCommandBlock.h index cf0103765..88461ed65 100644 --- a/src/Blocks/BlockCommandBlock.h +++ b/src/Blocks/BlockCommandBlock.h @@ -16,12 +16,12 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_BLOCK_AIR, 8, 0)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.stone"; } diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h index 6caaaab13..e65dbd275 100644 --- a/src/Blocks/BlockComparator.h +++ b/src/Blocks/BlockComparator.h @@ -19,7 +19,7 @@ public: } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); Meta ^= 0x04; // Toggle 3rd (addition/subtraction) bit with XOR @@ -27,27 +27,27 @@ public: } - virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { UNUSED(a_ChunkInterface); a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to 0 a_Pickups.push_back(cItem(E_ITEM_COMPARATOR, 1, 0)); } - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR)); } @@ -58,7 +58,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetYaw()); @@ -66,7 +66,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h index ae6e490e1..0108b3c87 100644 --- a/src/Blocks/BlockCrops.h +++ b/src/Blocks/BlockCrops.h @@ -19,7 +19,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) /*override*/ { cFastRandom rand; @@ -74,7 +74,7 @@ public: } - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { NIBBLETYPE Meta = a_Chunk.GetMeta (a_RelX, a_RelY, a_RelZ); NIBBLETYPE Light = a_Chunk.GetBlockLight(a_RelX, a_RelY, a_RelZ); @@ -96,13 +96,13 @@ public: } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } diff --git a/src/Blocks/BlockDeadBush.h b/src/Blocks/BlockDeadBush.h index 5b687c710..198a49948 100644 --- a/src/Blocks/BlockDeadBush.h +++ b/src/Blocks/BlockDeadBush.h @@ -17,13 +17,13 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Don't drop anything } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return (a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_SAND); } diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h index d458c6062..836b51df7 100644 --- a/src/Blocks/BlockDirt.h +++ b/src/Blocks/BlockDirt.h @@ -19,13 +19,13 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0)); } - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { if (m_BlockType != E_BLOCK_GRASS) { @@ -90,7 +90,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.gravel"; } diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h index c86fe829b..468b44dfa 100644 --- a/src/Blocks/BlockDoor.h +++ b/src/Blocks/BlockDoor.h @@ -16,22 +16,22 @@ class cBlockDoorHandler : public: cBlockDoorHandler(BLOCKTYPE a_BlockType); - virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override; - virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override; - virtual const char * GetStepSound(void) override; + virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/; + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/; + virtual const char * GetStepSound(void) /*override*/; - virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override; - virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override; - virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override; - virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override; + virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) /*override*/; + virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) /*override*/; + virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) /*override*/; + virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) /*override*/; virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { // If clicking a bottom face, place the door one block lower: if (a_BlockFace == BLOCK_FACE_BOTTOM) @@ -53,7 +53,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem((m_BlockType == E_BLOCK_WOODEN_DOOR) ? E_ITEM_WOODEN_DOOR : E_ITEM_IRON_DOOR, 1, 0)); } @@ -64,16 +64,16 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta - ) override; + ) /*override*/; - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR)); } diff --git a/src/Blocks/BlockDropSpenser.h b/src/Blocks/BlockDropSpenser.h index ba96c716a..ebcabc066 100644 --- a/src/Blocks/BlockDropSpenser.h +++ b/src/Blocks/BlockDropSpenser.h @@ -27,7 +27,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; @@ -36,7 +36,7 @@ public: return true; } - virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) /*override*/ { // Bit 0x08 is a flag. Lowest three bits are position. 0x08 == 1000 NIBBLETYPE OtherMeta = a_Meta & 0x08; diff --git a/src/Blocks/BlockEnchantmentTable.h b/src/Blocks/BlockEnchantmentTable.h index 81d2cb9a0..274858ff5 100644 --- a/src/Blocks/BlockEnchantmentTable.h +++ b/src/Blocks/BlockEnchantmentTable.h @@ -19,14 +19,14 @@ public: } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { cWindow * Window = new cEnchantingWindow(a_BlockX, a_BlockY, a_BlockZ); a_Player->OpenWindow(Window); } - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } diff --git a/src/Blocks/BlockEnderchest.h b/src/Blocks/BlockEnderchest.h index 4672f1459..aed855ac8 100644 --- a/src/Blocks/BlockEnderchest.h +++ b/src/Blocks/BlockEnderchest.h @@ -16,7 +16,7 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // todo: Drop Ender Chest if using silk touch pickaxe a_Pickups.push_back(cItem(E_BLOCK_OBSIDIAN, 8, 0)); @@ -27,14 +27,14 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = RotationToMetaData(a_Player->GetYaw()); return true; } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.stone"; } diff --git a/src/Blocks/BlockEntity.h b/src/Blocks/BlockEntity.h index 7f86a22b2..876e62312 100644 --- a/src/Blocks/BlockEntity.h +++ b/src/Blocks/BlockEntity.h @@ -15,12 +15,12 @@ public: { } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { a_ChunkInterface.UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ); } - virtual bool IsUseable() override + virtual bool IsUseable() /*override*/ { return true; } diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h index bb624e54f..e26b7f45a 100644 --- a/src/Blocks/BlockFarmland.h +++ b/src/Blocks/BlockFarmland.h @@ -26,7 +26,7 @@ public: { } - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { bool Found = false; @@ -101,7 +101,7 @@ public: } } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.Add(E_BLOCK_DIRT, 1, 0); // Reset meta } diff --git a/src/Blocks/BlockFenceGate.h b/src/Blocks/BlockFenceGate.h index ae99a4f94..ed1deffdc 100644 --- a/src/Blocks/BlockFenceGate.h +++ b/src/Blocks/BlockFenceGate.h @@ -22,7 +22,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = PlayerYawToMetaData(a_Player->GetYaw()); @@ -30,7 +30,7 @@ public: } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { NIBBLETYPE OldMetaData = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetYaw()); @@ -50,13 +50,13 @@ public: } - virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); } - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } diff --git a/src/Blocks/BlockFire.h b/src/Blocks/BlockFire.h index b9f211042..469247fc1 100644 --- a/src/Blocks/BlockFire.h +++ b/src/Blocks/BlockFire.h @@ -21,7 +21,7 @@ public: int XZP, XZM; NIBBLETYPE Dir; - virtual void OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override + virtual void OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/ { /* PORTAL FINDING ALGORITH @@ -40,17 +40,17 @@ public: FindAndSetPortalFrame(a_BlockX, a_BlockY - 1, a_BlockZ, a_ChunkInterface, a_WorldInterface); } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // No pickups from this block } - virtual bool IsClickedThrough(void) override + virtual bool IsClickedThrough(void) /*override*/ { return true; } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockFlower.h b/src/Blocks/BlockFlower.h index 6f64c062b..7439d6641 100644 --- a/src/Blocks/BlockFlower.h +++ b/src/Blocks/BlockFlower.h @@ -17,20 +17,20 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to zero a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } diff --git a/src/Blocks/BlockFlowerPot.h b/src/Blocks/BlockFlowerPot.h index fc75ef638..b052d4715 100644 --- a/src/Blocks/BlockFlowerPot.h +++ b/src/Blocks/BlockFlowerPot.h @@ -17,7 +17,7 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_ITEM_FLOWER_POT, 1, 0)); } diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index 8c0aae041..c94d8e399 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -20,19 +20,19 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // No pickups } - virtual bool DoesIgnoreBuildCollision(void) override + virtual bool DoesIgnoreBuildCollision(void) /*override*/ { return true; } - virtual void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override + virtual void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) /*override*/ { switch (m_BlockType) { @@ -51,7 +51,7 @@ public: } - virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override + virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) /*override*/ { return false; } @@ -74,7 +74,7 @@ public: /// Called to tick the block - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { if (a_Chunk.GetWorld()->ShouldLavaSpawnFire()) { diff --git a/src/Blocks/BlockFurnace.h b/src/Blocks/BlockFurnace.h index 2c7310ac9..e88d8fc53 100644 --- a/src/Blocks/BlockFurnace.h +++ b/src/Blocks/BlockFurnace.h @@ -19,7 +19,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_BLOCK_FURNACE, 1, 0)); } @@ -30,7 +30,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; diff --git a/src/Blocks/BlockGlass.h b/src/Blocks/BlockGlass.h index f6958bbb6..f3435b199 100644 --- a/src/Blocks/BlockGlass.h +++ b/src/Blocks/BlockGlass.h @@ -16,7 +16,7 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { } } ; diff --git a/src/Blocks/BlockGlowstone.h b/src/Blocks/BlockGlowstone.h index d1353e29a..b94cdaa25 100644 --- a/src/Blocks/BlockGlowstone.h +++ b/src/Blocks/BlockGlowstone.h @@ -17,7 +17,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to 0 cFastRandom Random; diff --git a/src/Blocks/BlockGravel.h b/src/Blocks/BlockGravel.h index e1c9ff390..a09ad159a 100644 --- a/src/Blocks/BlockGravel.h +++ b/src/Blocks/BlockGravel.h @@ -16,7 +16,7 @@ public: { } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.gravel"; } diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 6767d4de4..73a1deecf 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -409,7 +409,7 @@ void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_Bl void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) { - // Setting the meta to a_BlockMeta keeps most textures. The few other blocks have to override this. + // Setting the meta to a_BlockMeta keeps most textures. The few other blocks have to /*override*/ this. a_Pickups.push_back(cItem(m_BlockType, 1, a_BlockMeta)); } diff --git a/src/Blocks/BlockHayBale.h b/src/Blocks/BlockHayBale.h index 3c6472adb..d00bf79fe 100644 --- a/src/Blocks/BlockHayBale.h +++ b/src/Blocks/BlockHayBale.h @@ -17,7 +17,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } diff --git a/src/Blocks/BlockHopper.h b/src/Blocks/BlockHopper.h index 4a5d32dd5..62c47a999 100644 --- a/src/Blocks/BlockHopper.h +++ b/src/Blocks/BlockHopper.h @@ -22,7 +22,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; @@ -41,7 +41,7 @@ public: } - virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) /*override*/ { // Bit 0x08 is a flag. Lowest three bits are position. 0x08 == 1000 NIBBLETYPE OtherMeta = a_Meta & 0x08; diff --git a/src/Blocks/BlockIce.h b/src/Blocks/BlockIce.h index 47a84e5a7..9aa769a5a 100644 --- a/src/Blocks/BlockIce.h +++ b/src/Blocks/BlockIce.h @@ -18,13 +18,13 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // No pickups } - virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { if (a_Player->IsGameModeCreative() || (a_BlockY <= 0)) { diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h index 284d1d732..6dbb41c5d 100644 --- a/src/Blocks/BlockLadder.h +++ b/src/Blocks/BlockLadder.h @@ -25,7 +25,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { if (!LadderCanBePlacedAt(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace)) { @@ -43,7 +43,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.Add(m_BlockType, 1, 0); // Reset meta } @@ -103,7 +103,7 @@ public: } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { // TODO: Use AdjustCoordsByMeta(), then cChunk::UnboundedRelGetBlock() and finally some comparison eBlockFace BlockFace = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ)); @@ -113,7 +113,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index a8aa28a0f..7c804367a 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -36,7 +36,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { cFastRandom rand; @@ -63,14 +63,14 @@ public: } - virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay } - virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); if ((Meta & 0x04) != 0) @@ -114,7 +114,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index 4316fd06b..5e4e6056b 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -17,7 +17,7 @@ public: { } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { // Flip the ON bit on/off using the XOR bitwise operation NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08); @@ -28,14 +28,14 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to 0 a_Pickups.push_back(cItem(E_BLOCK_LEVER, 1, 0)); } - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } @@ -46,7 +46,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = LeverDirectionToMetaData(a_BlockFace); @@ -70,7 +70,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } @@ -97,7 +97,7 @@ public: } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { NIBBLETYPE Meta; a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); @@ -109,7 +109,7 @@ public: } - virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) /*override*/ { switch (a_Meta) { @@ -124,7 +124,7 @@ public: } - virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) /*override*/ { switch (a_Meta) { diff --git a/src/Blocks/BlockMelon.h b/src/Blocks/BlockMelon.h index 60202d66e..fab06bccc 100644 --- a/src/Blocks/BlockMelon.h +++ b/src/Blocks/BlockMelon.h @@ -17,14 +17,14 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { cFastRandom Random; a_Pickups.push_back(cItem(E_ITEM_MELON_SLICE, (char)(3 + Random.NextInt(5)), 0)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockMobHead.h b/src/Blocks/BlockMobHead.h index ff1ef97bf..18a3e2b61 100644 --- a/src/Blocks/BlockMobHead.h +++ b/src/Blocks/BlockMobHead.h @@ -17,12 +17,12 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // The drop spawn is in OnDestroyed method } - virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { if (a_Player->IsGameModeCreative()) { @@ -197,7 +197,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta - ) override + ) /*override*/ { class cCallback : public cBlockEntityCallback { diff --git a/src/Blocks/BlockMushroom.h b/src/Blocks/BlockMushroom.h index 135d418d7..9996b8d73 100644 --- a/src/Blocks/BlockMushroom.h +++ b/src/Blocks/BlockMushroom.h @@ -20,14 +20,14 @@ public: // TODO: Add Mushroom Spread - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to 0 a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { if (a_RelY <= 0) { @@ -52,7 +52,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } diff --git a/src/Blocks/BlockMycelium.h b/src/Blocks/BlockMycelium.h index 2a8ef5fca..c8f601171 100644 --- a/src/Blocks/BlockMycelium.h +++ b/src/Blocks/BlockMycelium.h @@ -18,12 +18,12 @@ public: // TODO: Add Mycel Spread - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.gravel"; } diff --git a/src/Blocks/BlockNetherWart.h b/src/Blocks/BlockNetherWart.h index 812cf906f..e606637f6 100644 --- a/src/Blocks/BlockNetherWart.h +++ b/src/Blocks/BlockNetherWart.h @@ -19,7 +19,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) /*override*/ { cFastRandom rand; @@ -35,7 +35,7 @@ public: } - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); if (Meta < 7) @@ -45,7 +45,7 @@ public: } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { // Needs to be placed on top of a Soulsand block: return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_SOULSAND)); diff --git a/src/Blocks/BlockOre.h b/src/Blocks/BlockOre.h index 0067d475f..d9342193d 100644 --- a/src/Blocks/BlockOre.h +++ b/src/Blocks/BlockOre.h @@ -17,7 +17,7 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { cFastRandom Random; diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 0bec603e3..b71ef5db6 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -13,14 +13,14 @@ class cBlockPistonHandler : public: cBlockPistonHandler(BLOCKTYPE a_BlockType); - virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override; + virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override; + ) /*override*/; static NIBBLETYPE RotationPitchToMetaData(double a_Rotation, double a_Pitch) { @@ -155,9 +155,9 @@ class cBlockPistonHeadHandler : public: cBlockPistonHeadHandler(void); - virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override; + virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // No pickups // Also with 1.7, the item forms of these technical blocks have been removed, so giving someone this will crash their client... diff --git a/src/Blocks/BlockPlanks.h b/src/Blocks/BlockPlanks.h index 4c5bb4860..8b3e34a4b 100644 --- a/src/Blocks/BlockPlanks.h +++ b/src/Blocks/BlockPlanks.h @@ -21,7 +21,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage); @@ -29,7 +29,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index 8fac2a126..84db103e6 100644 --- a/src/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h @@ -22,7 +22,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { // We set to zero so MCS doesn't stop you from building weird portals like vanilla does // CanBeAt doesn't do anything if meta is zero @@ -34,12 +34,12 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // No pickups } - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { cFastRandom Random; if (Random.NextInt(2000) != 0) @@ -53,7 +53,7 @@ public: a_WorldInterface.SpawnMob(PosX, a_RelY, PosZ, cMonster::mtZombiePigman); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { if ((a_RelY <= 0) || (a_RelY >= cChunkDef::Height)) { diff --git a/src/Blocks/BlockPressurePlate.h b/src/Blocks/BlockPressurePlate.h index a5c34a776..b23fa2bb5 100644 --- a/src/Blocks/BlockPressurePlate.h +++ b/src/Blocks/BlockPressurePlate.h @@ -15,13 +15,13 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to zero a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { if (a_RelY <= 0) { diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h index 15ac80fd7..e0cfa4579 100644 --- a/src/Blocks/BlockPumpkin.h +++ b/src/Blocks/BlockPumpkin.h @@ -17,7 +17,7 @@ public: } - virtual void OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override + virtual void OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/ { // Check whether the pumpkin is a part of a golem or a snowman @@ -86,7 +86,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = PlayerYawToMetaData(a_Player->GetYaw()); diff --git a/src/Blocks/BlockQuartz.h b/src/Blocks/BlockQuartz.h index edc4fb9c5..f36d384e0 100644 --- a/src/Blocks/BlockQuartz.h +++ b/src/Blocks/BlockQuartz.h @@ -21,7 +21,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage); diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 87ce069ab..10f585ea2 100644 --- a/src/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h @@ -34,7 +34,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = FindMeta(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ); @@ -42,7 +42,7 @@ public: } - virtual void OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override + virtual void OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/ { super::OnPlaced(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); @@ -59,7 +59,7 @@ public: } - virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { super::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ); @@ -76,7 +76,7 @@ public: } - virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); if (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ) && (Meta != FindMeta(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ))) @@ -86,13 +86,13 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { super::ConvertToPickups(a_Pickups, 0); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { if (a_RelY <= 0) { @@ -437,7 +437,7 @@ public: } - virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) /*override*/ { // Bit 0x08 is a flag when a_Meta is in the range 0x00--0x05 and 0x0A--0x0F. // Bit 0x08 specifies direction when a_Meta is in the range 0x06-0x09. @@ -474,7 +474,7 @@ public: } - virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) /*override*/ { // Bit 0x08 is a flag for value in the range 0x00--0x05 and specifies direction for values withint 0x006--0x09. if ((a_Meta < 0x06) || (a_Meta > 0x09)) @@ -510,7 +510,7 @@ public: } - virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) /*override*/ { // Bit 0x08 is a flag for value in the range 0x00--0x05 and specifies direction for values withint 0x006--0x09. if ((a_Meta < 0x06) || (a_Meta > 0x09)) @@ -541,7 +541,7 @@ public: } - virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) /*override*/ { // Bit 0x08 is a flag for value in the range 0x00--0x05 and specifies direction for values withint 0x006--0x09. if ((a_Meta < 0x06) || (a_Meta > 0x09)) diff --git a/src/Blocks/BlockRedstone.h b/src/Blocks/BlockRedstone.h index 37d61ed73..651736aa4 100644 --- a/src/Blocks/BlockRedstone.h +++ b/src/Blocks/BlockRedstone.h @@ -18,13 +18,13 @@ public: } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))); } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to zero a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, 1, 0)); diff --git a/src/Blocks/BlockRedstoneLamp.h b/src/Blocks/BlockRedstoneLamp.h index 69a2b27c2..e4f290fdd 100644 --- a/src/Blocks/BlockRedstoneLamp.h +++ b/src/Blocks/BlockRedstoneLamp.h @@ -16,7 +16,7 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_BLOCK_REDSTONE_LAMP_OFF, 1, 0)); } diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h index 4b18add12..44b9e6197 100644 --- a/src/Blocks/BlockRedstoneRepeater.h +++ b/src/Blocks/BlockRedstoneRepeater.h @@ -23,7 +23,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = RepeaterRotationToMetaData(a_Player->GetYaw()); @@ -31,39 +31,39 @@ public: } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, ((a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) + 0x04) & 0x0f)); } - virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { UNUSED(a_ChunkInterface); a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to zero a_Pickups.push_back(cItem(E_ITEM_REDSTONE_REPEATER, 1, 0)); } - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return ((a_RelY > 0) && cBlockInfo::IsSolid(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockRedstoneTorch.h b/src/Blocks/BlockRedstoneTorch.h index cb897ba3f..4d55cff28 100644 --- a/src/Blocks/BlockRedstoneTorch.h +++ b/src/Blocks/BlockRedstoneTorch.h @@ -18,14 +18,14 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Always drop the ON torch, meta 0 a_Pickups.push_back(cItem(E_BLOCK_REDSTONE_TORCH_ON, 1, 0)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockSand.h b/src/Blocks/BlockSand.h index 3fc271483..e99b0098d 100644 --- a/src/Blocks/BlockSand.h +++ b/src/Blocks/BlockSand.h @@ -16,7 +16,7 @@ public: { } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.sand"; } diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h index de28273d5..8abb35046 100644 --- a/src/Blocks/BlockSapling.h +++ b/src/Blocks/BlockSapling.h @@ -18,20 +18,20 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Only the first 2 bits contain the display information and the 4th bit is for the growth indicator, but, we use 0x07 for forward compatibility a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x07)); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)); } - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); @@ -48,7 +48,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } diff --git a/src/Blocks/BlockSideways.h b/src/Blocks/BlockSideways.h index f5f10899d..7cfe3043d 100644 --- a/src/Blocks/BlockSideways.h +++ b/src/Blocks/BlockSideways.h @@ -21,7 +21,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage); @@ -30,7 +30,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.Add(m_BlockType, 1, a_BlockMeta & 0x3); // Reset meta } @@ -67,7 +67,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockSignPost.h b/src/Blocks/BlockSignPost.h index d0cc760b0..dabd8369b 100644 --- a/src/Blocks/BlockSignPost.h +++ b/src/Blocks/BlockSignPost.h @@ -21,19 +21,19 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_ITEM_SIGN, 1, 0)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { if (a_RelY <= 0) { @@ -64,25 +64,25 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta - ) override + ) /*override*/ { a_Player->GetClientHandle()->SendEditSign(a_BlockX, a_BlockY, a_BlockZ); } - virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) /*override*/ { return (a_Meta + 4) & 0x0f; } - virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) /*override*/ { return (a_Meta + 12) & 0x0f; } - virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) /*override*/ { // Mirrors signs over the XY plane (North-South Mirroring) @@ -92,7 +92,7 @@ public: } - virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) /*override*/ { // Mirrors signs over the YZ plane (East-West Mirroring) diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h index e67f0e8b3..611b7653b 100644 --- a/src/Blocks/BlockSlab.h +++ b/src/Blocks/BlockSlab.h @@ -25,7 +25,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(m_BlockType, 1, a_BlockMeta & 0x7)); } @@ -36,7 +36,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; NIBBLETYPE Meta = (NIBBLETYPE) a_Player->GetEquippedItem().m_ItemDamage; @@ -87,7 +87,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { switch (m_BlockType) { @@ -99,7 +99,7 @@ public: } - virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override + virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) /*override*/ { return ((a_Meta & 0x8) != 0); } @@ -112,7 +112,7 @@ public: } - virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != (short)m_BlockType)) { @@ -137,7 +137,7 @@ public: } - virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) /*override*/ { // Toggle the 4th bit - up / down: return (a_Meta ^ 0x08); @@ -158,7 +158,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { BLOCKTYPE Block = GetSingleSlabType(m_BlockType); a_Pickups.push_back(cItem(Block, 2, a_BlockMeta & 0x7)); @@ -175,7 +175,7 @@ public: return a_BlockType; } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { switch (m_BlockType) { diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h index 977f19a16..057dda48c 100644 --- a/src/Blocks/BlockSnow.h +++ b/src/Blocks/BlockSnow.h @@ -22,7 +22,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; @@ -43,7 +43,7 @@ public: } - virtual bool DoesIgnoreBuildCollision(cPlayer * a_Player, NIBBLETYPE a_Meta) override + virtual bool DoesIgnoreBuildCollision(cPlayer * a_Player, NIBBLETYPE a_Meta) /*override*/ { if ((a_Player->GetEquippedItem().m_ItemType == E_BLOCK_SNOW) && (a_Meta < 7)) { @@ -59,13 +59,13 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_ITEM_SNOWBALL, 1, 0)); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { if (a_RelY > 0) { @@ -83,13 +83,13 @@ public: } - virtual bool DoesDropOnUnsuitable(void) override + virtual bool DoesDropOnUnsuitable(void) /*override*/ { return false; } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.cloth"; } diff --git a/src/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h index 417969a82..5e9d9a117 100644 --- a/src/Blocks/BlockStairs.h +++ b/src/Blocks/BlockStairs.h @@ -23,7 +23,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { UNUSED(a_ChunkInterface); UNUSED(a_BlockX); @@ -55,7 +55,7 @@ public: } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { if ( (m_BlockType == E_BLOCK_WOODEN_STAIRS) || @@ -73,14 +73,14 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to zero a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } - virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override + virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) /*override*/ { return true; } @@ -111,7 +111,7 @@ public: } } - virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) /*override*/ { // Toggle bit 3: return (a_Meta & 0x0b) | ((~a_Meta) & 0x04); diff --git a/src/Blocks/BlockStems.h b/src/Blocks/BlockStems.h index b726a0901..979972256 100644 --- a/src/Blocks/BlockStems.h +++ b/src/Blocks/BlockStems.h @@ -18,14 +18,14 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { short ItemType = (m_BlockType == E_BLOCK_MELON_STEM) ? E_ITEM_MELON_SEEDS : E_ITEM_PUMPKIN_SEEDS; a_Pickups.push_back(cItem(ItemType, 1, 0)); } - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); if (Meta >= 7) @@ -43,13 +43,13 @@ public: } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockStone.h b/src/Blocks/BlockStone.h index cd5230f49..2247f3aa8 100644 --- a/src/Blocks/BlockStone.h +++ b/src/Blocks/BlockStone.h @@ -16,7 +16,7 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_BLOCK_COBBLESTONE, 1, 0)); } diff --git a/src/Blocks/BlockSugarcane.h b/src/Blocks/BlockSugarcane.h index 5902c791b..519ec3836 100644 --- a/src/Blocks/BlockSugarcane.h +++ b/src/Blocks/BlockSugarcane.h @@ -17,13 +17,13 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_ITEM_SUGARCANE, 1, 0)); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { if (a_RelY <= 0) { @@ -74,13 +74,13 @@ public: } - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/ { a_Chunk.GetWorld()->GrowSugarcane(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } diff --git a/src/Blocks/BlockTNT.h b/src/Blocks/BlockTNT.h index 283a03730..a2cbedbef 100644 --- a/src/Blocks/BlockTNT.h +++ b/src/Blocks/BlockTNT.h @@ -16,12 +16,12 @@ public: { } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } - virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); } diff --git a/src/Blocks/BlockTallGrass.h b/src/Blocks/BlockTallGrass.h index 9c008f793..badabfa4d 100644 --- a/src/Blocks/BlockTallGrass.h +++ b/src/Blocks/BlockTallGrass.h @@ -17,13 +17,13 @@ public: } - virtual bool DoesIgnoreBuildCollision(void) override + virtual bool DoesIgnoreBuildCollision(void) /*override*/ { return true; } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Drop seeds, sometimes MTRand r1; @@ -34,7 +34,7 @@ public: } - virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); @@ -49,13 +49,13 @@ public: } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index df5574d5d..d8def598e 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -22,7 +22,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { // Find proper placement of torch @@ -145,7 +145,7 @@ public: } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { eBlockFace Face = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ)); @@ -179,14 +179,14 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Always drop meta = 0 a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h index a6327b5c2..2c8ab4010 100644 --- a/src/Blocks/BlockTrapdoor.h +++ b/src/Blocks/BlockTrapdoor.h @@ -16,23 +16,23 @@ public: { } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to zero a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { // Flip the ON bit on/off using the XOR bitwise operation NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04); @@ -42,7 +42,7 @@ public: World->BroadcastSoundParticleEffect(1003, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player->GetClientHandle()); } - virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { UNUSED(a_ChunkInterface); a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); @@ -53,7 +53,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = BlockFaceToMetaData(a_BlockFace); @@ -97,7 +97,7 @@ public: } } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { NIBBLETYPE Meta; a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); diff --git a/src/Blocks/BlockTripwire.h b/src/Blocks/BlockTripwire.h index 3ab17bf4a..eac586847 100644 --- a/src/Blocks/BlockTripwire.h +++ b/src/Blocks/BlockTripwire.h @@ -16,12 +16,12 @@ public: { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return ""; } diff --git a/src/Blocks/BlockTripwireHook.h b/src/Blocks/BlockTripwireHook.h index 4f9d79483..4dc6460fe 100644 --- a/src/Blocks/BlockTripwireHook.h +++ b/src/Blocks/BlockTripwireHook.h @@ -21,7 +21,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = m_BlockType; a_BlockMeta = DirectionToMetadata(a_BlockFace); @@ -53,13 +53,13 @@ public: } } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to zero a_Pickups.push_back(cItem(E_BLOCK_TRIPWIRE_HOOK, 1, 0)); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { NIBBLETYPE Meta; a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); @@ -71,7 +71,7 @@ public: return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h index 578224c61..93d61d80f 100644 --- a/src/Blocks/BlockVine.h +++ b/src/Blocks/BlockVine.h @@ -21,7 +21,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { UNUSED(a_Player); UNUSED(a_CursorX); @@ -44,7 +44,7 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { // Reset meta to zero a_Pickups.push_back(cItem(E_BLOCK_VINES, 1, 0)); @@ -115,7 +115,7 @@ public: } - void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override + void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) /*override*/ { NIBBLETYPE CurMeta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); NIBBLETYPE MaxMeta = GetMaxMeta(a_Chunk, a_RelX, a_RelY, a_RelZ); @@ -155,19 +155,19 @@ public: } - virtual bool DoesIgnoreBuildCollision(void) override + virtual bool DoesIgnoreBuildCollision(void) /*override*/ { return true; } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.grass"; } - virtual bool DoesDropOnUnsuitable(void) override + virtual bool DoesDropOnUnsuitable(void) /*override*/ { return false; } @@ -189,26 +189,26 @@ public: } } - virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) /*override*/ { return ((a_Meta >> 1) | (a_Meta << 3)) & 0x0f; // Rotate bits to the right } - virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) /*override*/ { return ((a_Meta << 1) | (a_Meta >> 3)) & 0x0f; // Rotate bits to the left } - virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) /*override*/ { // Bits 2 and 4 stay, bits 1 and 3 swap return (NIBBLETYPE)((a_Meta & 0x0a) | ((a_Meta & 0x01) << 2) | ((a_Meta & 0x04) >> 2)); } - virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override + virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) /*override*/ { // Bits 1 and 3 stay, bits 2 and 4 swap return (NIBBLETYPE)((a_Meta & 0x05) | ((a_Meta & 0x02) << 2) | ((a_Meta & 0x08) >> 2)); diff --git a/src/Blocks/BlockWallSign.h b/src/Blocks/BlockWallSign.h index 47649379e..26e63b1b5 100644 --- a/src/Blocks/BlockWallSign.h +++ b/src/Blocks/BlockWallSign.h @@ -21,13 +21,13 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(E_ITEM_SIGN, 1, 0)); } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } @@ -38,13 +38,13 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta - ) override + ) /*override*/ { a_Player->GetClientHandle()->SendEditSign(a_BlockX, a_BlockY, a_BlockZ); } - virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) /*override*/ { int BlockX = (a_Chunk.GetPosX() * cChunkDef::Width) + a_RelX; int BlockZ = (a_Chunk.GetPosZ() * cChunkDef::Width) + a_RelZ; diff --git a/src/Blocks/BlockWorkbench.h b/src/Blocks/BlockWorkbench.h index 70468369c..3c1336779 100644 --- a/src/Blocks/BlockWorkbench.h +++ b/src/Blocks/BlockWorkbench.h @@ -19,20 +19,20 @@ public: } - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) /*override*/ { cWindow * Window = new cCraftingWindow(a_BlockX, a_BlockY, a_BlockZ); a_Player->OpenWindow(Window); } - virtual bool IsUseable(void) override + virtual bool IsUseable(void) /*override*/ { return true; } - virtual const char * GetStepSound(void) override + virtual const char * GetStepSound(void) /*override*/ { return "step.wood"; } diff --git a/src/Blocks/ChunkInterface.h b/src/Blocks/ChunkInterface.h index dea9d7c7e..57aded66d 100644 --- a/src/Blocks/ChunkInterface.h +++ b/src/Blocks/ChunkInterface.h @@ -71,12 +71,12 @@ public: m_ChunkMap->UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ); } - virtual bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) override + virtual bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) /*override*/ { return m_ChunkMap->ForEachChunkInRect(a_MinChunkX, a_MaxChunkX, a_MinChunkZ, a_MaxChunkZ, a_Callback); } - virtual bool WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) override + virtual bool WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) /*override*/ { return m_ChunkMap->WriteBlockArea(a_Area, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes); } diff --git a/src/Blocks/ClearMetaOnDrop.h b/src/Blocks/ClearMetaOnDrop.h index aa4f23848..68381de34 100644 --- a/src/Blocks/ClearMetaOnDrop.h +++ b/src/Blocks/ClearMetaOnDrop.h @@ -17,7 +17,7 @@ public: {} virtual ~cClearMetaOnDrop() {} - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) /*override*/ { a_Pickups.push_back(cItem(this->m_BlockType)); } diff --git a/src/Blocks/MetaRotator.h b/src/Blocks/MetaRotator.h index 4c268077a..0bf450e9c 100644 --- a/src/Blocks/MetaRotator.h +++ b/src/Blocks/MetaRotator.h @@ -31,10 +31,10 @@ public: virtual ~cMetaRotator() {} - virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override; - virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override; - virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override; - virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override; + virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) /*override*/; + virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) /*override*/; + virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) /*override*/; + virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) /*override*/; }; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2d96662a9..53765685b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,7 +8,7 @@ include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/polarssl/include set(FOLDERS OSSupport HTTPServer Items Blocks Protocol Generating PolarSSL++ Bindings - WorldStorage Mobs Entities Simulator UI BlockEntities Generating/Prefabs + WorldStorage Mobs Entities Simulator UI BlockEntities Generating/Prefabs Mobs/Components ) SET (SRCS @@ -310,7 +310,7 @@ endif () if (NOT MSVC) target_link_libraries(${EXECUTABLE} OSSupport HTTPServer Bindings Items Blocks - Protocol Generating Generating_Prefabs WorldStorage + Protocol Generating Generating_Prefabs WorldStorage Components Mobs Entities Simulator UI BlockEntities PolarSSL++ ) endif () diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 9fb178bc3..782229f52 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -669,12 +669,12 @@ void cChunk::MoveEntityToNewChunk(cEntity * a_Entity) class cMover : public cClientDiffCallback { - virtual void Removed(cClientHandle * a_Client) override + virtual void Removed(cClientHandle * a_Client) /*override*/ { a_Client->SendDestroyEntity(*m_Entity); } - virtual void Added(cClientHandle * a_Client) override + virtual void Added(cClientHandle * a_Client) /*override*/ { m_Entity->SpawnOn(*a_Client); } diff --git a/src/ChunkDataCallback.h b/src/ChunkDataCallback.h index 804299816..f9ff9915a 100644 --- a/src/ChunkDataCallback.h +++ b/src/ChunkDataCallback.h @@ -65,7 +65,7 @@ public: protected: - virtual void ChunkData(const cChunkData & a_BlockData) override + virtual void ChunkData(const cChunkData & a_BlockData) /*override*/ { m_BlockData = a_BlockData.Copy(); } @@ -87,7 +87,7 @@ public: protected: - virtual void ChunkData(const cChunkData & a_ChunkBuffer) override + virtual void ChunkData(const cChunkData & a_ChunkBuffer) /*override*/ { a_ChunkBuffer.CopyBlockTypes(m_BlockData); a_ChunkBuffer.CopyMetas(m_BlockData + cChunkDef::NumBlocks); @@ -113,7 +113,7 @@ public: protected: - virtual void ChunkData(const cChunkData & a_ChunkBuffer) override + virtual void ChunkData(const cChunkData & a_ChunkBuffer) /*override*/ { a_ChunkBuffer.CopyBlockTypes(m_BlockTypes); a_ChunkBuffer.CopyMetas(m_BlockMetas); diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 8c765c8c9..f6373bc37 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1944,7 +1944,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { if (a_Entity->IsPickup() && (a_Entity->GetTicksAlive() < 20)) { diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 8c564d0de..dd72e0b39 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -416,15 +416,15 @@ private: class cStarvationCallbacks : public cAllocationPool<cChunkData::sChunkSection>::cStarvationCallbacks { - virtual void OnStartUsingReserve() override + virtual void OnStartUsingReserve() /*override*/ { LOG("Using backup memory buffer"); } - virtual void OnEndUsingReserve() override + virtual void OnEndUsingReserve() /*override*/ { LOG("Stoped using backup memory buffer"); } - virtual void OnOutOfReserve() override + virtual void OnOutOfReserve() /*override*/ { LOG("Out of Memory"); } diff --git a/src/ChunkSender.h b/src/ChunkSender.h index a0e9087a9..91ca28f05 100644 --- a/src/ChunkSender.h +++ b/src/ChunkSender.h @@ -51,7 +51,7 @@ class cChunkSender; class cNotifyChunkSender : public cChunkCoordCallback { - virtual void Call(int a_ChunkX, int a_ChunkZ) override; + virtual void Call(int a_ChunkX, int a_ChunkZ) /*override*/; cChunkSender * m_ChunkSender; public: @@ -154,9 +154,9 @@ protected: // cChunkDataCollector overrides: // (Note that they are called while the ChunkMap's CS is locked - don't do heavy calculations here!) - virtual void BiomeData (const cChunkDef::BiomeMap * a_BiomeMap) override; - virtual void Entity (cEntity * a_Entity) override; - virtual void BlockEntity (cBlockEntity * a_Entity) override; + virtual void BiomeData (const cChunkDef::BiomeMap * a_BiomeMap) /*override*/; + virtual void Entity (cEntity * a_Entity) /*override*/; + virtual void BlockEntity (cBlockEntity * a_Entity) /*override*/; /// Sends the specified chunk to a_Client, or to all chunk clients if a_Client == NULL void SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client); diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 6b31bfa64..88dc15d04 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1627,7 +1627,7 @@ void cClientHandle::HandleUseEntity(int a_TargetEntityID, bool a_IsLeftClick) class cRclkEntity : public cEntityCallback { cPlayer & m_Player; - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { if (cPluginManager::Get()->CallHookPlayerRightClickingEntity(m_Player, *a_Entity)) { @@ -1648,7 +1648,7 @@ void cClientHandle::HandleUseEntity(int a_TargetEntityID, bool a_IsLeftClick) // If it is a left click, attack the entity: class cDamageEntity : public cEntityCallback { - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { if (!a_Entity->GetWorld()->IsPVPEnabled()) { diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 593d0780d..f5ee357b3 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -415,10 +415,10 @@ private: /** Handles the "MC|ItemName" plugin message */ void HandleAnvilItemName(const char * a_Data, size_t a_Length); - // cSocketThreads::cCallback overrides: - virtual bool DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client - virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client - virtual void SocketClosed (void) override; // The socket has been closed for any reason + // cSocketThreads::cCallback /*override*/s: + virtual bool DataReceived (const char * a_Data, size_t a_Size) /*override*/; // Data is received from the client + virtual void GetOutgoingData(AString & a_Data) /*override*/; // Data can be sent to client + virtual void SocketClosed (void) /*override*/; // The socket has been closed for any reason }; // tolua_export diff --git a/src/CommandOutput.h b/src/CommandOutput.h index daa9430c0..391d5a868 100644 --- a/src/CommandOutput.h +++ b/src/CommandOutput.h @@ -34,8 +34,8 @@ public: class cNullCommandOutputCallback : public cCommandOutputCallback { - // cCommandOutputCallback overrides: - virtual void Out(const AString & a_Text) override + // cCommandOutputCallback /*override*/s: + virtual void Out(const AString & a_Text) /*override*/ { // Do nothing UNUSED(a_Text); @@ -52,9 +52,9 @@ class cLogCommandOutputCallback : public cCommandOutputCallback { public: - // cCommandOutputCallback overrides: - virtual void Out(const AString & a_Text) override; - virtual void Finished(void) override; + // cCommandOutputCallback /*override*/s: + virtual void Out(const AString & a_Text) /*override*/; + virtual void Finished(void) /*override*/; protected: /// Output is stored here until the command finishes processing @@ -71,7 +71,7 @@ class cLogCommandDeleteSelfOutputCallback : { typedef cLogCommandOutputCallback super; - virtual void Finished(void) override + virtual void Finished(void) /*override*/ { super::Finished(); delete this; diff --git a/src/DeadlockDetect.cpp b/src/DeadlockDetect.cpp index 7f703416c..d8c1ffd34 100644 --- a/src/DeadlockDetect.cpp +++ b/src/DeadlockDetect.cpp @@ -44,7 +44,7 @@ bool cDeadlockDetect::Start(int a_IntervalSec) { } - virtual bool Item(cWorld * a_World) override + virtual bool Item(cWorld * a_World) /*override*/ { m_Detect->SetWorldAge(a_World->GetName(), a_World->GetWorldAge()); return false; @@ -79,7 +79,7 @@ void cDeadlockDetect::Execute(void) protected: cDeadlockDetect * m_Detect; - virtual bool Item(cWorld * a_World) override + virtual bool Item(cWorld * a_World) /*override*/ { m_Detect->CheckWorldAge(a_World->GetName(), a_World->GetWorldAge()); return false; diff --git a/src/DeadlockDetect.h b/src/DeadlockDetect.h index 6aa98acbb..e397dd997 100644 --- a/src/DeadlockDetect.h +++ b/src/DeadlockDetect.h @@ -50,8 +50,8 @@ protected: int m_IntervalSec; - // cIsThread overrides: - virtual void Execute(void) override; + // cIsThread /*override*/s: + virtual void Execute(void) /*override*/; /// Sets the initial world age void SetWorldAge(const AString & a_WorldName, Int64 a_Age); diff --git a/src/Entities/ArrowEntity.h b/src/Entities/ArrowEntity.h index a1e7a17e7..10d530a55 100644 --- a/src/Entities/ArrowEntity.h +++ b/src/Entities/ArrowEntity.h @@ -94,10 +94,10 @@ protected: /// Stores the block position that arrow is lodged into, sets m_IsInGround to false if it becomes air Vector3i m_HitBlockPos; - // cProjectileEntity overrides: - virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; - virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override; - virtual void CollectedBy(cPlayer * a_Player) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + // cProjectileEntity /*override*/s: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) /*override*/; + virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) /*override*/; + virtual void CollectedBy(cPlayer * a_Player) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; }; // tolua_export diff --git a/src/Entities/Boat.h b/src/Entities/Boat.h index 8de88d165..835adc889 100644 --- a/src/Entities/Boat.h +++ b/src/Entities/Boat.h @@ -23,12 +23,12 @@ class cBoat : public: CLASS_PROTODEF(cBoat) - // cEntity overrides: - virtual void SpawnOn(cClientHandle & a_ClientHandle) override; - virtual void OnRightClicked(cPlayer & a_Player) override; - virtual bool DoTakeDamage(TakeDamageInfo & TDI) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways) override; + // cEntity /*override*/s: + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + virtual bool DoTakeDamage(TakeDamageInfo & TDI) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways) /*override*/; cBoat(double a_X, double a_Y, double a_Z); } ; diff --git a/src/Entities/EnderCrystal.h b/src/Entities/EnderCrystal.h index c98c3b681..f6024af86 100644 --- a/src/Entities/EnderCrystal.h +++ b/src/Entities/EnderCrystal.h @@ -21,10 +21,10 @@ public: private: - // cEntity overrides: - virtual void SpawnOn(cClientHandle & a_ClientHandle) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void KilledBy(TakeDamageInfo & a_TDI) override; + // cEntity /*override*/s: + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void KilledBy(TakeDamageInfo & a_TDI) /*override*/; }; // tolua_export diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index b9c280b6b..4754eb92c 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -10,11 +10,11 @@ // Place this macro in the public section of each cEntity descendant class and you're done :) #define CLASS_PROTODEF(classname) \ - virtual bool IsA(const char * a_ClassName) const override\ + virtual bool IsA(const char * a_ClassName) const /*override*/\ { \ return ((strcmp(a_ClassName, #classname) == 0) || super::IsA(a_ClassName)); \ } \ - virtual const char * GetClass(void) const override \ + virtual const char * GetClass(void) const /*override*/ \ { \ return #classname; \ } \ @@ -22,7 +22,7 @@ { \ return #classname; \ } \ - virtual const char * GetParentClass(void) const override \ + virtual const char * GetParentClass(void) const /*override*/ \ { \ return super::GetClass(); \ } @@ -420,7 +420,7 @@ public: // tolua_begin - // COMMON metadata flags; descendants may override the defaults: + // COMMON metadata flags; descendants may /*override*/ the defaults: virtual bool IsOnFire (void) const {return (m_TicksLeftBurning > 0); } virtual bool IsCrouched (void) const {return false; } virtual bool IsRiding (void) const {return false; } diff --git a/src/Entities/EntityEffect.h b/src/Entities/EntityEffect.h index 47c298f57..4ce155f4a 100644 --- a/src/Entities/EntityEffect.h +++ b/src/Entities/EntityEffect.h @@ -213,7 +213,7 @@ public: { } - virtual void OnActivate(cPawn & a_Target) override; + virtual void OnActivate(cPawn & a_Target) /*override*/; }; @@ -230,7 +230,7 @@ public: { } - virtual void OnActivate(cPawn & a_Target) override; + virtual void OnActivate(cPawn & a_Target) /*override*/; }; @@ -277,7 +277,7 @@ public: { } - virtual void OnTick(cPawn & a_Target) override; + virtual void OnTick(cPawn & a_Target) /*override*/; }; @@ -384,8 +384,8 @@ public: { } - // cEntityEffect overrides: - virtual void OnTick(cPawn & a_Target) override; + // cEntityEffect /*override*/s: + virtual void OnTick(cPawn & a_Target) /*override*/; }; @@ -402,8 +402,8 @@ public: { } - // cEntityEffect overrides: - virtual void OnTick(cPawn & a_Target) override; + // cEntityEffect /*override*/s: + virtual void OnTick(cPawn & a_Target) /*override*/; }; @@ -420,8 +420,8 @@ public: { } - // cEntityEffect overrides: - virtual void OnTick(cPawn & a_Target) override; + // cEntityEffect /*override*/s: + virtual void OnTick(cPawn & a_Target) /*override*/; }; @@ -438,8 +438,8 @@ public: { } - // cEntityEffect overrides: - virtual void OnTick(cPawn & a_Target) override; + // cEntityEffect /*override*/s: + virtual void OnTick(cPawn & a_Target) /*override*/; }; @@ -486,7 +486,7 @@ public: { } - virtual void OnTick(cPawn & a_Target) override; + virtual void OnTick(cPawn & a_Target) /*override*/; }; diff --git a/src/Entities/ExpBottleEntity.h b/src/Entities/ExpBottleEntity.h index d62a84469..95f10becd 100644 --- a/src/Entities/ExpBottleEntity.h +++ b/src/Entities/ExpBottleEntity.h @@ -27,7 +27,7 @@ public: protected: - // cProjectileEntity overrides: - virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; + // cProjectileEntity /*override*/s: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) /*override*/; }; // tolua_export diff --git a/src/Entities/ExpOrb.h b/src/Entities/ExpOrb.h index bdb9a5b19..eb18d95c5 100644 --- a/src/Entities/ExpOrb.h +++ b/src/Entities/ExpOrb.h @@ -22,8 +22,8 @@ public: cExpOrb(const Vector3d & a_Pos, int a_Reward); // Override functions - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void SpawnOn(cClientHandle & a_Client) override; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void SpawnOn(cClientHandle & a_Client) /*override*/; /** Returns the number of ticks that this entity has existed */ int GetAge(void) const { return (int)(m_Timer / 50); } // tolua_export diff --git a/src/Entities/FallingBlock.h b/src/Entities/FallingBlock.h index c20fe8eb9..58190e9e9 100644 --- a/src/Entities/FallingBlock.h +++ b/src/Entities/FallingBlock.h @@ -28,9 +28,9 @@ public: BLOCKTYPE GetBlockType(void) const { return m_BlockType; } NIBBLETYPE GetBlockMeta(void) const { return m_BlockMeta; } - // cEntity overrides: - virtual void SpawnOn(cClientHandle & a_ClientHandle) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + // cEntity /*override*/s: + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; private: BLOCKTYPE m_BlockType; diff --git a/src/Entities/FireChargeEntity.h b/src/Entities/FireChargeEntity.h index 5df55bec4..3dafe12c1 100644 --- a/src/Entities/FireChargeEntity.h +++ b/src/Entities/FireChargeEntity.h @@ -29,8 +29,8 @@ protected: void Explode(int a_BlockX, int a_BlockY, int a_BlockZ); - // cProjectileEntity overrides: - virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; - virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override; + // cProjectileEntity /*override*/s: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) /*override*/; + virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) /*override*/; } ; // tolua_export diff --git a/src/Entities/FireworkEntity.h b/src/Entities/FireworkEntity.h index 20f18b6dc..70915f4d0 100644 --- a/src/Entities/FireworkEntity.h +++ b/src/Entities/FireworkEntity.h @@ -28,9 +28,9 @@ public: protected: - // cProjectileEntity overrides: - virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + // cProjectileEntity /*override*/s: + virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; private: diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp index 159429147..1a107d2f4 100644 --- a/src/Entities/Floater.cpp +++ b/src/Entities/Floater.cpp @@ -25,7 +25,7 @@ public: m_HitEntity(NULL) { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { if (!a_Entity->IsMob()) // Floaters can only pull mobs not other entities. { @@ -86,7 +86,7 @@ public: { } - bool Item(cEntity * a_Entity) override + bool Item(cEntity * a_Entity) /*override*/ { m_EntityExists = true; return false; diff --git a/src/Entities/Floater.h b/src/Entities/Floater.h index 96d77ac82..0bc231bb2 100644 --- a/src/Entities/Floater.h +++ b/src/Entities/Floater.h @@ -20,8 +20,8 @@ public: cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, int a_PlayerID, int a_CountDownTime); - virtual void SpawnOn(cClientHandle & a_Client) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + virtual void SpawnOn(cClientHandle & a_Client) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; // tolua_begin bool CanPickup(void) const { return m_CanPickupItem; } diff --git a/src/Entities/GhastFireballEntity.h b/src/Entities/GhastFireballEntity.h index 3ed72d9ef..35f5136dd 100644 --- a/src/Entities/GhastFireballEntity.h +++ b/src/Entities/GhastFireballEntity.h @@ -29,9 +29,9 @@ protected: void Explode(int a_BlockX, int a_BlockY, int a_BlockZ); - // cProjectileEntity overrides: - virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; - virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) override; + // cProjectileEntity /*override*/s: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) /*override*/; + virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) /*override*/; // TODO: Deflecting the fireballs by arrow- or sword- hits diff --git a/src/Entities/HangingEntity.h b/src/Entities/HangingEntity.h index 3593f9ede..44c9d29c3 100644 --- a/src/Entities/HangingEntity.h +++ b/src/Entities/HangingEntity.h @@ -37,8 +37,8 @@ public: private: - virtual void SpawnOn(cClientHandle & a_ClientHandle) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override {} + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/ {} eBlockFace m_BlockFace; diff --git a/src/Entities/ItemFrame.h b/src/Entities/ItemFrame.h index a63b78b70..09652bf84 100644 --- a/src/Entities/ItemFrame.h +++ b/src/Entities/ItemFrame.h @@ -34,9 +34,9 @@ public: private: - virtual void OnRightClicked(cPlayer & a_Player) override; - virtual void KilledBy(TakeDamageInfo & a_TDI) override; - virtual void GetDrops(cItems & a_Items, cEntity * a_Killer) override; + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + virtual void KilledBy(TakeDamageInfo & a_TDI) /*override*/; + virtual void GetDrops(cItems & a_Items, cEntity * a_Killer) /*override*/; cItem m_Item; Byte m_Rotation; diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index 1501eea84..d1f56867d 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -2,7 +2,7 @@ // Minecart.cpp // Implements the cMinecart class representing a minecart in the world -// Handles physics when a minecart is on any type of rail (overrides simulator in Entity.cpp) +// Handles physics when a minecart is on any type of rail (/*override*/s simulator in Entity.cpp) // Indiana Jones! #include "Globals.h" @@ -34,7 +34,7 @@ public: { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { ASSERT(a_Entity != NULL); @@ -177,7 +177,7 @@ void cMinecart::HandlePhysics(float a_Dt, cChunk & a_Chunk) else { // Not on rail, default physics - SetPosY(floor(GetPosY()) + 0.35); // HandlePhysics overrides this if minecart can fall, else, it is to stop ground clipping minecart bottom when off-rail + SetPosY(floor(GetPosY()) + 0.35); // HandlePhysics /*override*/s this if minecart can fall, else, it is to stop ground clipping minecart bottom when off-rail super::HandlePhysics(a_Dt, *Chunk); } diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h index 410d3c77d..b9779f531 100644 --- a/src/Entities/Minecart.h +++ b/src/Entities/Minecart.h @@ -34,11 +34,11 @@ public: // TODO: Spawner minecarts, (and possibly any block in a minecart with NBT editing) } ; - // cEntity overrides: - virtual void SpawnOn(cClientHandle & a_ClientHandle) override; - virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) override; - virtual bool DoTakeDamage(TakeDamageInfo & TDI) override; - virtual void Destroyed() override; + // cEntity /*override*/s: + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; + virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual bool DoTakeDamage(TakeDamageInfo & TDI) /*override*/; + virtual void Destroyed() /*override*/; int LastDamage(void) const { return m_LastDamage; } ePayload GetPayload(void) const { return m_Payload; } @@ -95,8 +95,8 @@ public: const cItem & GetContent(void) const {return m_Content;} int GetBlockHeight(void) const {return m_Height;} - // cEntity overrides: - virtual void OnRightClicked(cPlayer & a_Player) override; + // cEntity /*override*/s: + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; protected: cItem m_Content; @@ -130,8 +130,8 @@ protected: /// The chest contents: cItem m_Items[NumSlots]; - // cEntity overrides: - virtual void OnRightClicked(cPlayer & a_Player) override; + // cEntity /*override*/s: + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; } ; @@ -148,9 +148,9 @@ public: cMinecartWithFurnace(double a_X, double a_Y, double a_Z); - // cEntity overrides: - virtual void OnRightClicked(cPlayer & a_Player) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + // cEntity /*override*/s: + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; // Set functions. void SetIsFueled(bool a_IsFueled, int a_FueledTimeLeft = -1) {m_IsFueled = a_IsFueled; m_FueledTimeLeft = a_FueledTimeLeft;} diff --git a/src/Entities/Painting.h b/src/Entities/Painting.h index 9877c95c5..3bb4b0bbf 100644 --- a/src/Entities/Painting.h +++ b/src/Entities/Painting.h @@ -23,10 +23,10 @@ public: private: - virtual void SpawnOn(cClientHandle & a_Client) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void GetDrops(cItems & a_Items, cEntity * a_Killer) override; - virtual void KilledBy(TakeDamageInfo & a_TDI) override + virtual void SpawnOn(cClientHandle & a_Client) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void GetDrops(cItems & a_Items, cEntity * a_Killer) /*override*/; + virtual void KilledBy(TakeDamageInfo & a_TDI) /*override*/ { super::KilledBy(a_TDI); Destroy(); diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index d50bcd8af..120b44ed4 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -20,8 +20,8 @@ public: cPawn(eEntityType a_EntityType, double a_Width, double a_Height); - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void KilledBy(TakeDamageInfo & a_TDI) override; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void KilledBy(TakeDamageInfo & a_TDI) /*override*/; // tolua_begin diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp index 87b5bed07..20d0f2c6e 100644 --- a/src/Entities/Pickup.cpp +++ b/src/Entities/Pickup.cpp @@ -28,7 +28,7 @@ public: { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { if (!a_Entity->IsPickup() || (a_Entity->GetUniqueID() <= m_Pickup->GetUniqueID()) || a_Entity->IsDestroyed()) { diff --git a/src/Entities/Pickup.h b/src/Entities/Pickup.h index 4d5250819..5b2986c92 100644 --- a/src/Entities/Pickup.h +++ b/src/Entities/Pickup.h @@ -30,11 +30,11 @@ public: cItem & GetItem(void) {return m_Item; } // tolua_export const cItem & GetItem(void) const {return m_Item; } - virtual void SpawnOn(cClientHandle & a_ClientHandle) override; + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; bool CollectedBy(cPlayer * a_Dest); // tolua_export - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; /** Returns the number of ticks that this entity has existed */ int GetAge(void) const { return (int)(m_Timer / 50); } // tolua_export diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 756410989..ee06b49e9 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1911,7 +1911,7 @@ void cPlayer::HandleFloater() public cEntityCallback { public: - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { a_Entity->Destroy(true); return true; diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 9821cc6d9..9bcb0c2ef 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -44,26 +44,26 @@ public: virtual ~cPlayer(); - virtual void SpawnOn(cClientHandle & a_Client) override; + virtual void SpawnOn(cClientHandle & a_Client) /*override*/; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; - virtual void HandlePhysics(float a_Dt, cChunk &) override { UNUSED(a_Dt); } + 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(); } + virtual cItem GetEquippedWeapon(void) const /*override*/ { return m_Inventory.GetEquippedItem(); } /** Returns the currently equipped helmet; empty item if none */ - virtual cItem GetEquippedHelmet(void) const override { return m_Inventory.GetEquippedHelmet(); } + virtual cItem GetEquippedHelmet(void) const /*override*/ { return m_Inventory.GetEquippedHelmet(); } /** Returns the currently equipped chestplate; empty item if none */ - virtual cItem GetEquippedChestplate(void) const override { return m_Inventory.GetEquippedChestplate(); } + virtual cItem GetEquippedChestplate(void) const /*override*/ { return m_Inventory.GetEquippedChestplate(); } /** Returns the currently equipped leggings; empty item if none */ - virtual cItem GetEquippedLeggings(void) const override { return m_Inventory.GetEquippedLeggings(); } + virtual cItem GetEquippedLeggings(void) const /*override*/ { return m_Inventory.GetEquippedLeggings(); } /** Returns the currently equipped boots; empty item if none */ - virtual cItem GetEquippedBoots(void) const override { return m_Inventory.GetEquippedBoots(); } + virtual cItem GetEquippedBoots(void) const /*override*/ { return m_Inventory.GetEquippedBoots(); } // tolua_begin @@ -134,7 +134,7 @@ public: /** Returns whether the player is climbing (ladders, vines etc.) */ bool IsClimbing(void) const; - virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) override; + virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) /*override*/; // tolua_begin @@ -261,7 +261,7 @@ public: void TossPickup(const cItem & a_Item); /** Heals the player by the specified amount of HPs (positive only); sends health update */ - virtual void Heal(int a_Health) override; + virtual void Heal(int a_Health) /*override*/; int GetFoodLevel (void) const { return m_FoodLevel; } double GetFoodSaturationLevel (void) const { return m_FoodSaturationLevel; } @@ -312,9 +312,9 @@ public: /** Aborts the current eating operation */ void AbortEating(void); - virtual void KilledBy(TakeDamageInfo & a_TDI) override; + virtual void KilledBy(TakeDamageInfo & a_TDI) /*override*/; - virtual void Killed(cEntity * a_Victim) override; + virtual void Killed(cEntity * a_Victim) /*override*/; void Respawn(void); // tolua_export @@ -323,7 +323,7 @@ public: /** Moves the player to the specified world. Returns true if successful, false on failure (world not found). */ - virtual bool DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn) override; + virtual bool DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn) /*override*/; /** Saves all player data, such as inventory, to JSON */ bool SaveToDisk(void); @@ -422,7 +422,7 @@ public: // tolua_end - // cEntity overrides: + // cEntity /*override*/s: virtual bool IsCrouched (void) const { return m_IsCrouched; } virtual bool IsSprinting(void) const { return m_IsSprinting; } virtual bool IsRclking (void) const { return IsEating() || IsChargingBow(); } @@ -563,7 +563,7 @@ protected: AString m_UUID; /** Sets the speed and sends it to the client, so that they are forced to move so. */ - virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override; + virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) /*override*/; void ResolvePermissions(void); void ResolveGroups(void); @@ -571,10 +571,10 @@ protected: virtual void Destroyed(void); /** Filters out damage for creative mode/friendly fire */ - virtual bool DoTakeDamage(TakeDamageInfo & TDI) override; + virtual bool DoTakeDamage(TakeDamageInfo & TDI) /*override*/; /** Stops players from burning in creative mode */ - virtual void TickBurning(cChunk & a_Chunk) override; + virtual void TickBurning(cChunk & a_Chunk) /*override*/; /** Called in each tick to handle food-related processing */ void HandleFood(void); diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index acc9bd674..6356ab036 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -55,8 +55,8 @@ protected: cProjectileEntity * m_Projectile; double m_SlowdownCoeff; - // cCallbacks overrides: - virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) override + // cCallbacks /*override*/s: + virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) /*override*/ { /* // DEBUG: @@ -140,7 +140,7 @@ public: } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { if ( (a_Entity == m_Projectile) || // Do not check collisions with self diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h index 990136a32..46b61d097 100644 --- a/src/Entities/ProjectileEntity.h +++ b/src/Entities/ProjectileEntity.h @@ -117,9 +117,9 @@ protected: /// True if the projectile has hit the ground and is stuck there bool m_IsInGround; - // cEntity overrides: - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) override; - virtual void SpawnOn(cClientHandle & a_Client) override; + // cEntity /*override*/s: + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void SpawnOn(cClientHandle & a_Client) /*override*/; } ; // tolua_export diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp index fd1a0179b..73addfc85 100644 --- a/src/Entities/SplashPotionEntity.cpp +++ b/src/Entities/SplashPotionEntity.cpp @@ -31,7 +31,7 @@ public: } /** Called by cWorld::ForEachEntity(), adds the stored entity effect to the entity, if it is close enough. */ - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { if (!a_Entity->IsPawn()) { diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index 4afc5f204..97e847b2c 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -47,10 +47,10 @@ protected: int m_PotionColor; - // cProjectileEntity overrides: - virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; - virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override; - virtual void Tick (float a_Dt, cChunk & a_Chunk) override + // cProjectileEntity /*override*/s: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) /*override*/; + virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) /*override*/; + virtual void Tick (float a_Dt, cChunk & a_Chunk) /*override*/ { if (m_DestroyTimer > 0) { @@ -71,7 +71,7 @@ protected: @param a_HitPos The position where the potion will splash */ void Splash(const Vector3d & a_HitPos); - virtual void SpawnOn(cClientHandle & a_Client) override; + virtual void SpawnOn(cClientHandle & a_Client) /*override*/; private: /** Time in ticks to wait for the hit animation to begin before destroying */ diff --git a/src/Entities/TNTEntity.h b/src/Entities/TNTEntity.h index 48503cf76..a51307484 100644 --- a/src/Entities/TNTEntity.h +++ b/src/Entities/TNTEntity.h @@ -19,9 +19,9 @@ public: cTNTEntity(double a_X, double a_Y, double a_Z, int a_FuseTicks = 80); cTNTEntity(const Vector3d & a_Pos, int a_FuseTicks = 80); - // cEntity overrides: - virtual void SpawnOn(cClientHandle & a_ClientHandle) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + // cEntity /*override*/s: + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; // tolua_begin diff --git a/src/Entities/ThrownEggEntity.h b/src/Entities/ThrownEggEntity.h index a0b7d5340..187a05eab 100644 --- a/src/Entities/ThrownEggEntity.h +++ b/src/Entities/ThrownEggEntity.h @@ -27,10 +27,10 @@ public: protected: - // cProjectileEntity overrides: - virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; - virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override; - virtual void Tick (float a_Dt, cChunk & a_Chunk) override + // cProjectileEntity /*override*/s: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) /*override*/; + virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) /*override*/; + virtual void Tick (float a_Dt, cChunk & a_Chunk) /*override*/ { if (m_DestroyTimer > 0) { diff --git a/src/Entities/ThrownEnderPearlEntity.cpp b/src/Entities/ThrownEnderPearlEntity.cpp index c7407e6ae..8209e0f47 100644 --- a/src/Entities/ThrownEnderPearlEntity.cpp +++ b/src/Entities/ThrownEnderPearlEntity.cpp @@ -61,7 +61,7 @@ void cThrownEnderPearlEntity::TeleportCreator(const Vector3d & a_HitPos) { } - virtual bool Item(cPlayer * a_Entity) override + virtual bool Item(cPlayer * a_Entity) /*override*/ { // Teleport the creator here, make them take 5 damage: a_Entity->TeleportToCoords(m_HitPos.x, m_HitPos.y + 0.2, m_HitPos.z); diff --git a/src/Entities/ThrownEnderPearlEntity.h b/src/Entities/ThrownEnderPearlEntity.h index 436450013..88a02a90e 100644 --- a/src/Entities/ThrownEnderPearlEntity.h +++ b/src/Entities/ThrownEnderPearlEntity.h @@ -27,10 +27,10 @@ public: protected: - // cProjectileEntity overrides: - virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; - virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override; - virtual void Tick (float a_Dt, cChunk & a_Chunk) override + // cProjectileEntity /*override*/s: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) /*override*/; + virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) /*override*/; + virtual void Tick (float a_Dt, cChunk & a_Chunk) /*override*/ { if (m_DestroyTimer > 0) { diff --git a/src/Entities/ThrownSnowballEntity.h b/src/Entities/ThrownSnowballEntity.h index 8d195ced1..811ea4ff1 100644 --- a/src/Entities/ThrownSnowballEntity.h +++ b/src/Entities/ThrownSnowballEntity.h @@ -27,10 +27,10 @@ public: protected: - // cProjectileEntity overrides: - virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; - virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override; - virtual void Tick (float a_Dt, cChunk & a_Chunk) override + // cProjectileEntity /*override*/s: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) /*override*/; + virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) /*override*/; + virtual void Tick (float a_Dt, cChunk & a_Chunk) /*override*/ { if (m_DestroyTimer > 0) { diff --git a/src/Entities/WitherSkullEntity.h b/src/Entities/WitherSkullEntity.h index c59acd807..a9e0cd575 100644 --- a/src/Entities/WitherSkullEntity.h +++ b/src/Entities/WitherSkullEntity.h @@ -28,8 +28,8 @@ public: protected: - // cProjectileEntity overrides: - virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; - virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override; + // cProjectileEntity /*override*/s: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) /*override*/; + virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) /*override*/; } ; // tolua_export diff --git a/src/Generating/BioGen.h b/src/Generating/BioGen.h index a4cf95a72..f6946a5a8 100644 --- a/src/Generating/BioGen.h +++ b/src/Generating/BioGen.h @@ -32,9 +32,9 @@ protected: EMCSBiome m_Biome; - // cBiomeGen overrides: - virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; - virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; + // cBiomeGen /*override*/s: + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) /*override*/; + virtual void InitializeBiomeGen(cIniFile & a_IniFile) /*override*/; } ; @@ -72,8 +72,8 @@ protected: int m_NumMisses; int m_TotalChain; // Number of cache items walked to get to a hit (only added for hits) - virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; - virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) /*override*/; + virtual void InitializeBiomeGen(cIniFile & a_IniFile) /*override*/; } ; @@ -134,9 +134,9 @@ class cBioGenCheckerboard : protected: int m_BiomeSize; - // cBiomeGen overrides: - virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; - virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; + // cBiomeGen /*override*/s: + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) /*override*/; + virtual void InitializeBiomeGen(cIniFile & a_IniFile) /*override*/; } ; @@ -157,9 +157,9 @@ public: protected: cVoronoiMap m_Voronoi; - // cBiomeGen overrides: - virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; - virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; + // cBiomeGen /*override*/s: + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) /*override*/; + virtual void InitializeBiomeGen(cIniFile & a_IniFile) /*override*/; EMCSBiome VoronoiBiome(int a_BlockX, int a_BlockZ); } ; @@ -191,9 +191,9 @@ protected: /// Size of the Voronoi cells, also used for distortion amplitude int m_CellSize; - // cBiomeGen overrides: - virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; - virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; + // cBiomeGen /*override*/s: + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) /*override*/; + virtual void InitializeBiomeGen(cIniFile & a_IniFile) /*override*/; /// Distorts the coords using a Perlin-like noise void Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ); @@ -230,9 +230,9 @@ protected: typedef int IntMap[17 * 17]; // x + 17 * z, expected trimmed into [0..255] range typedef double DblMap[17 * 17]; // x + 17 * z, expected trimmed into [0..1] range - // cBiomeGen overrides: - virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; - virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; + // cBiomeGen /*override*/s: + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) /*override*/; + virtual void InitializeBiomeGen(cIniFile & a_IniFile) /*override*/; /** Step 1: Decides between ocean, land and mushroom, using a DistVoronoi with special conditions and post-processing for mushroom islands Sets biomes to biOcean, -1 (i.e. land), biMushroomIsland or biMushroomShore @@ -295,9 +295,9 @@ protected: cNoise m_Noise6; - // cBiomeGen overrides: - virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; - virtual void InitializeBiomeGen(cIniFile & a_IniFile) override; + // cBiomeGen /*override*/s: + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) /*override*/; + virtual void InitializeBiomeGen(cIniFile & a_IniFile) /*override*/; /// Selects biome from the specified biome group, based on the specified index. /// Note that both params may overflow diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp index 71154dff9..13fe2d3ed 100644 --- a/src/Generating/Caves.cpp +++ b/src/Generating/Caves.cpp @@ -143,8 +143,8 @@ protected: /// Returns a radius based on the location provided. int GetRadius(cNoise & a_Noise, int a_OriginX, int a_OriginY, int a_OriginZ); - // cGridStructGen::cStructure overrides: - virtual void DrawIntoChunk(cChunkDesc & a_ChunkDesc) override; + // cGridStructGen::cStructure /*override*/s: + virtual void DrawIntoChunk(cChunkDesc & a_ChunkDesc) /*override*/; } ; diff --git a/src/Generating/Caves.h b/src/Generating/Caves.h index 0e17acf9e..4783a6ff9 100644 --- a/src/Generating/Caves.h +++ b/src/Generating/Caves.h @@ -29,8 +29,8 @@ protected: int m_Seed; - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -55,8 +55,8 @@ protected: int m_Seed; float m_Threshold; - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -85,8 +85,8 @@ protected: int m_MaxOffset; // maximum offset of the cave nest origin from the grid cell the nest belongs to int m_Grid; // average spacing of the nests - // cGridStructGen override: - virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; + // cGridStructGen /*override*/: + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) /*override*/; } ; diff --git a/src/Generating/ChunkGenerator.h b/src/Generating/ChunkGenerator.h index e880a6766..07711eef2 100644 --- a/src/Generating/ChunkGenerator.h +++ b/src/Generating/ChunkGenerator.h @@ -71,7 +71,7 @@ public: virtual ~cPluginInterface() {} /** Called when the chunk is about to be generated. - The generator may be partly or fully overriden by the implementation + The generator may be partly or fully overridden by the implementation */ virtual void CallHookChunkGenerating(cChunkDesc & a_ChunkDesc) = 0; @@ -151,8 +151,8 @@ private: cChunkSink * m_ChunkSink; - // cIsThread override: - virtual void Execute(void) override; + // cIsThread /*override*/: + virtual void Execute(void) /*override*/; void DoGenerate(int a_ChunkX, int a_ChunkZ); }; diff --git a/src/Generating/CompoGen.h b/src/Generating/CompoGen.h index 096b0fb5a..b2de70d5b 100644 --- a/src/Generating/CompoGen.h +++ b/src/Generating/CompoGen.h @@ -37,9 +37,9 @@ protected: BLOCKTYPE m_BlockType; bool m_IsBedrocked; - // cTerrainCompositionGen overrides: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; - virtual void InitializeCompoGen(cIniFile & a_IniFile) override; + // cTerrainCompositionGen /*override*/s: + virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) /*override*/; + virtual void InitializeCompoGen(cIniFile & a_IniFile) /*override*/; } ; @@ -54,8 +54,8 @@ public: protected: - // cTerrainCompositionGen overrides: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; + // cTerrainCompositionGen /*override*/s: + virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -80,9 +80,9 @@ protected: BLOCKTYPE m_BlockBeachBottom; BLOCKTYPE m_BlockSea; - // cTerrainCompositionGen overrides: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; - virtual void InitializeCompoGen(cIniFile & a_IniFile) override; + // cTerrainCompositionGen /*override*/s: + virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) /*override*/; + virtual void InitializeCompoGen(cIniFile & a_IniFile) /*override*/; } ; @@ -104,9 +104,9 @@ protected: cNoise m_Noise; int m_SeaLevel; - // cTerrainCompositionGen overrides: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; - virtual void InitializeCompoGen(cIniFile & a_IniFile) override; + // cTerrainCompositionGen /*override*/s: + virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) /*override*/; + virtual void InitializeCompoGen(cIniFile & a_IniFile) /*override*/; void FillColumnGrass (int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes); void FillColumnClay (int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes); @@ -135,9 +135,9 @@ protected: int m_Threshold; - // cTerrainCompositionGen overrides: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; - virtual void InitializeCompoGen(cIniFile & a_IniFile) override; + // cTerrainCompositionGen /*override*/s: + virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) /*override*/; + virtual void InitializeCompoGen(cIniFile & a_IniFile) /*override*/; } ; @@ -152,9 +152,9 @@ public: cCompoGenCache(cTerrainCompositionGen & a_Underlying, int a_CacheSize); // Doesn't take ownership of a_Underlying ~cCompoGenCache(); - // cTerrainCompositionGen override: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; - virtual void InitializeCompoGen(cIniFile & a_IniFile) override; + // cTerrainCompositionGen /*override*/: + virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) /*override*/; + virtual void InitializeCompoGen(cIniFile & a_IniFile) /*override*/; protected: diff --git a/src/Generating/ComposableGenerator.h b/src/Generating/ComposableGenerator.h index 6b7627d2e..8cd209059 100644 --- a/src/Generating/ComposableGenerator.h +++ b/src/Generating/ComposableGenerator.h @@ -146,9 +146,9 @@ public: cComposableGenerator(cChunkGenerator & a_ChunkGenerator); virtual ~cComposableGenerator(); - virtual void Initialize(cIniFile & a_IniFile) override; - virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; - virtual void DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) override; + virtual void Initialize(cIniFile & a_IniFile) /*override*/; + virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) /*override*/; + virtual void DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) /*override*/; protected: // The generation composition: diff --git a/src/Generating/DistortedHeightmap.h b/src/Generating/DistortedHeightmap.h index e6b3c9d3f..8ae272012 100644 --- a/src/Generating/DistortedHeightmap.h +++ b/src/Generating/DistortedHeightmap.h @@ -126,11 +126,11 @@ protected: const sBlockInfo * ChooseOceanFloorPattern(int a_RelX, int a_RelZ); - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - virtual void InitializeHeightGen(cIniFile & a_IniFile) override; + // cTerrainHeightGen /*override*/s: + virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) /*override*/; + virtual void InitializeHeightGen(cIniFile & a_IniFile) /*override*/; - // cTerrainCompositionGen overrides: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; - virtual void InitializeCompoGen(cIniFile & a_IniFile) override; + // cTerrainCompositionGen /*override*/s: + virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) /*override*/; + virtual void InitializeCompoGen(cIniFile & a_IniFile) /*override*/; } ; diff --git a/src/Generating/EndGen.h b/src/Generating/EndGen.h index 322061810..5bcedbde3 100644 --- a/src/Generating/EndGen.h +++ b/src/Generating/EndGen.h @@ -59,10 +59,10 @@ protected: /// Returns true if the chunk is outside of the island's dimensions bool IsChunkOutsideRange(int a_ChunkX, int a_ChunkZ); - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; + // cTerrainHeightGen /*override*/s: + virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) /*override*/; - // cTerrainCompositionGen overrides: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; - virtual void InitializeCompoGen(cIniFile & a_IniFile) override; + // cTerrainCompositionGen /*override*/s: + virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) /*override*/; + virtual void InitializeCompoGen(cIniFile & a_IniFile) /*override*/; } ; diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h index 4a08d70c8..314f9e1f0 100644 --- a/src/Generating/FinishGen.h +++ b/src/Generating/FinishGen.h @@ -27,8 +27,8 @@ class cFinishGenSnow : public cFinishGen { protected: - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -39,8 +39,8 @@ class cFinishGenIce : public cFinishGen { protected: - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -62,7 +62,7 @@ protected: int m_Seed; void TryPlaceClump(cChunkDesc & a_ChunkDesc, int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_Block); - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -79,8 +79,8 @@ protected: cNoise m_Noise; int m_Seed; - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; int GetBiomeDensity(EMCSBiome a_Biome) { @@ -130,8 +130,8 @@ protected: /// Tries to place sugarcane at the coords specified, returns true if successful bool TryAddSugarcane(cChunkDesc & a_ChunkDesc, int a_RelX, int a_RelY, int a_RelZ); - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -207,8 +207,8 @@ protected: } - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -228,8 +228,8 @@ public: protected: int m_Level; - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -265,8 +265,8 @@ protected: BLOCKTYPE a_StationaryFluid ); - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -286,8 +286,8 @@ protected: BLOCKTYPE m_Fluid; int m_Chance; ///< Chance, [0..100], that a spring will be generated in a chunk - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; /// Tries to place a spring at the specified coords, checks neighbors. Returns true if successful bool TryPlaceSpring(cChunkDesc & a_ChunkDesc, int x, int y, int z); diff --git a/src/Generating/GridStructGen.cpp b/src/Generating/GridStructGen.cpp index 7090f14b1..f8ea94900 100644 --- a/src/Generating/GridStructGen.cpp +++ b/src/Generating/GridStructGen.cpp @@ -27,7 +27,7 @@ public: } protected: - virtual void DrawIntoChunk(cChunkDesc & a_ChunkDesc) override + virtual void DrawIntoChunk(cChunkDesc & a_ChunkDesc) /*override*/ { // Do nothing } diff --git a/src/Generating/GridStructGen.h b/src/Generating/GridStructGen.h index 03131fce9..e731319f0 100644 --- a/src/Generating/GridStructGen.h +++ b/src/Generating/GridStructGen.h @@ -131,10 +131,10 @@ protected: around their gridpoint intersects the chunk. */ void GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructurePtrs & a_Structures); - // cFinishGen overrides: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/s: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; - // Functions for the descendants to override: + // Functions for the descendants to /*override*/: /** Create a new structure at the specified gridpoint */ virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) = 0; } ; diff --git a/src/Generating/HeiGen.h b/src/Generating/HeiGen.h index 5c106c7d9..35c8fd1b1 100644 --- a/src/Generating/HeiGen.h +++ b/src/Generating/HeiGen.h @@ -31,9 +31,9 @@ protected: int m_Height; - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - virtual void InitializeHeightGen(cIniFile & a_IniFile) override; + // cTerrainHeightGen /*override*/s: + virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) /*override*/; + virtual void InitializeHeightGen(cIniFile & a_IniFile) /*override*/; } ; @@ -48,9 +48,9 @@ public: cHeiGenCache(cTerrainHeightGen & a_HeiGenToCache, int a_CacheSize); // Doesn't take ownership of a_HeiGenToCache ~cHeiGenCache(); - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - virtual void InitializeHeightGen(cIniFile & a_IniFile) override; + // cTerrainHeightGen /*override*/s: + virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) /*override*/; + virtual void InitializeHeightGen(cIniFile & a_IniFile) /*override*/; /// Retrieves height at the specified point in the cache, returns true if found, false if not found bool GetHeightAt(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelZ, HEIGHTTYPE & a_Height); @@ -97,9 +97,9 @@ protected: float GetNoise(float x, float y); - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - virtual void InitializeHeightGen(cIniFile & a_IniFile) override; + // cTerrainHeightGen /*override*/s: + virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) /*override*/; + virtual void InitializeHeightGen(cIniFile & a_IniFile) /*override*/; } ; @@ -118,9 +118,9 @@ protected: cRidgedMultiNoise m_Noise; cPerlinNoise m_Perlin; - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - virtual void InitializeHeightGen(cIniFile & a_IniFile) override; + // cTerrainHeightGen /*override*/s: + virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) /*override*/; + virtual void InitializeHeightGen(cIniFile & a_IniFile) /*override*/; } ; @@ -154,9 +154,9 @@ protected: } ; static const sGenParam m_GenParam[256]; - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - virtual void InitializeHeightGen(cIniFile & a_IniFile) override; + // cTerrainHeightGen /*override*/s: + virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) /*override*/; + virtual void InitializeHeightGen(cIniFile & a_IniFile) /*override*/; NOISE_DATATYPE GetHeightAt(int a_RelX, int a_RelZ, int a_ChunkX, int a_ChunkZ, const BiomeNeighbors & a_BiomeNeighbors); } ; diff --git a/src/Generating/MineShafts.cpp b/src/Generating/MineShafts.cpp index 0532aff39..d70233248 100644 --- a/src/Generating/MineShafts.cpp +++ b/src/Generating/MineShafts.cpp @@ -95,9 +95,9 @@ class cMineShaftDirtRoom : public: cMineShaftDirtRoom(cStructGenMineShafts::cMineShaftSystem & a_Parent, cNoise & a_Noise); - // cMineShaft overrides: - virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) override; - virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) override; + // cMineShaft /*override*/s: + virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) /*override*/; + virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -136,9 +136,9 @@ protected: cNoise & a_Noise ); - // cMineShaft overrides: - virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) override; - virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) override; + // cMineShaft /*override*/s: + virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) /*override*/; + virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) /*override*/; /// Places a chest, if the corridor has one void PlaceChest(cChunkDesc & a_ChunkDesc); @@ -176,9 +176,9 @@ public: protected: cMineShaftCrossing(cStructGenMineShafts::cMineShaftSystem & a_ParentSystem, const cCuboid & a_BoundingBox); - // cMineShaft overrides: - virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) override; - virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) override; + // cMineShaft /*override*/s: + virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) /*override*/; + virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -219,9 +219,9 @@ protected: eSlope a_Slope ); - // cMineShaft overrides: - virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) override; - virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) override; + // cMineShaft /*override*/s: + virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) /*override*/; + virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -267,7 +267,7 @@ public: /** Returns true if none of the objects in m_MineShafts intersect with the specified bounding box and the bounding box is valid */ bool CanAppend(const cCuboid & a_BoundingBox); - // cGridStructGen::cStructure overrides: + // cGridStructGen::cStructure /*override*/s: virtual void DrawIntoChunk(cChunkDesc & a_Chunk); } ; diff --git a/src/Generating/MineShafts.h b/src/Generating/MineShafts.h index 2850db571..610dbab87 100644 --- a/src/Generating/MineShafts.h +++ b/src/Generating/MineShafts.h @@ -42,8 +42,8 @@ protected: int m_ProbLevelCrossing; ///< Probability level of a branch object being the crossing, minus Corridor int m_ProbLevelStaircase; ///< Probability level of a branch object being the staircase, minus Crossing - // cGridStructGen overrides: - virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; + // cGridStructGen /*override*/s: + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) /*override*/; } ; diff --git a/src/Generating/NetherFortGen.h b/src/Generating/NetherFortGen.h index 9b31aa0e2..965f50059 100644 --- a/src/Generating/NetherFortGen.h +++ b/src/Generating/NetherFortGen.h @@ -36,8 +36,8 @@ protected: static cPrefabPiecePool m_PiecePool; - // cGridStructGen overrides: - virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; + // cGridStructGen /*override*/s: + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) /*override*/; } ; diff --git a/src/Generating/Noise3DGenerator.h b/src/Generating/Noise3DGenerator.h index 42f61a854..e06d1587f 100644 --- a/src/Generating/Noise3DGenerator.h +++ b/src/Generating/Noise3DGenerator.h @@ -24,9 +24,9 @@ public: cNoise3DGenerator(cChunkGenerator & a_ChunkGenerator); virtual ~cNoise3DGenerator(); - virtual void Initialize(cIniFile & a_IniFile) override; - virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; - virtual void DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) override; + virtual void Initialize(cIniFile & a_IniFile) /*override*/; + virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) /*override*/; + virtual void DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) /*override*/; protected: // Linear interpolation step sizes, must be divisors of cChunkDef::Width and cChunkDef::Height, respectively: @@ -94,11 +94,11 @@ protected: /// Generates the 3D noise array used for terrain generation, unless the LastChunk coords are equal to coords given void GenerateNoiseArrayIfNeeded(int a_ChunkX, int a_ChunkZ); - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; + // cTerrainHeightGen /*override*/s: + virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) /*override*/; - // cTerrainCompositionGen overrides: - virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) override; + // cTerrainCompositionGen /*override*/s: + virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) /*override*/; } ; diff --git a/src/Generating/POCPieceGenerator.cpp b/src/Generating/POCPieceGenerator.cpp index 6e7e74d7a..cfd8ed9bd 100644 --- a/src/Generating/POCPieceGenerator.cpp +++ b/src/Generating/POCPieceGenerator.cpp @@ -105,23 +105,23 @@ protected: int m_Height; cConnectors m_Connectors; - // cPiece overrides: - virtual cConnectors GetConnectors(void) const override + // cPiece /*override*/s: + virtual cConnectors GetConnectors(void) const /*override*/ { return m_Connectors; } - virtual Vector3i GetSize(void) const override + virtual Vector3i GetSize(void) const /*override*/ { return Vector3i(m_SizeXZ, m_Height, m_SizeXZ); } - virtual cCuboid GetHitBox(void) const override + virtual cCuboid GetHitBox(void) const /*override*/ { return cCuboid(0, 0, 0, m_SizeXZ - 1, m_Height - 1, m_SizeXZ - 1); } - virtual bool CanRotateCCW(int a_NumRotations) const override + virtual bool CanRotateCCW(int a_NumRotations) const /*override*/ { return true; } diff --git a/src/Generating/POCPieceGenerator.h b/src/Generating/POCPieceGenerator.h index de3114ce0..b353d2e16 100644 --- a/src/Generating/POCPieceGenerator.h +++ b/src/Generating/POCPieceGenerator.h @@ -38,14 +38,14 @@ protected: cCuboid m_Bounds; - // cFinishGen overrides: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/s: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; - // cPiecePool overrides: - virtual cPieces GetPiecesWithConnector(int a_ConnectorType) override; - virtual cPieces GetStartingPieces(void) override; - virtual void PiecePlaced(const cPiece & a_Piece) override; - virtual void Reset(void) override; + // cPiecePool /*override*/s: + virtual cPieces GetPiecesWithConnector(int a_ConnectorType) /*override*/; + virtual cPieces GetStartingPieces(void) /*override*/; + virtual void PiecePlaced(const cPiece & a_Piece) /*override*/; + virtual void Reset(void) /*override*/; } ; diff --git a/src/Generating/PieceGenerator.cpp b/src/Generating/PieceGenerator.cpp index ae4b6e36c..54c71cf70 100644 --- a/src/Generating/PieceGenerator.cpp +++ b/src/Generating/PieceGenerator.cpp @@ -73,7 +73,7 @@ protected: { } - virtual cConnectors GetConnectors(void) const override + virtual cConnectors GetConnectors(void) const /*override*/ { // Each piece has 4 connectors, one of each type, plus one extra, at the center of its walls: cConnectors res; @@ -84,17 +84,17 @@ protected: return res; } - virtual Vector3i GetSize(void) const override + virtual Vector3i GetSize(void) const /*override*/ { return Vector3i(m_Size, 5, m_Size); } - virtual cCuboid GetHitBox(void) const override + virtual cCuboid GetHitBox(void) const /*override*/ { return cCuboid(0, 0, 0, m_Size - 1, 4, m_Size - 1); } - virtual bool CanRotateCCW(int a_NumCCWRotations) const override + virtual bool CanRotateCCW(int a_NumCCWRotations) const /*override*/ { return true; } @@ -102,26 +102,26 @@ protected: cPieces m_Pieces; - virtual cPieces GetPiecesWithConnector(int a_ConnectorType) override + virtual cPieces GetPiecesWithConnector(int a_ConnectorType) /*override*/ { // Each piece contains each connector return m_Pieces; } - virtual cPieces GetStartingPieces(void) override + virtual cPieces GetStartingPieces(void) /*override*/ { return m_Pieces; } - virtual void PiecePlaced(const cPiece & a_Piece) override + virtual void PiecePlaced(const cPiece & a_Piece) /*override*/ { UNUSED(a_Piece); } - virtual void Reset(void) override + virtual void Reset(void) /*override*/ { } diff --git a/src/Generating/Prefab.h b/src/Generating/Prefab.h index eb905e78e..11e27bd6b 100644 --- a/src/Generating/Prefab.h +++ b/src/Generating/Prefab.h @@ -183,11 +183,11 @@ protected: bool m_MoveToGround; - // cPiece overrides: - virtual cConnectors GetConnectors(void) const override; - virtual Vector3i GetSize(void) const override; - virtual cCuboid GetHitBox(void) const override; - virtual bool CanRotateCCW(int a_NumRotations) const override; + // cPiece /*override*/s: + virtual cConnectors GetConnectors(void) const /*override*/; + virtual Vector3i GetSize(void) const /*override*/; + virtual cCuboid GetHitBox(void) const /*override*/; + virtual bool CanRotateCCW(int a_NumRotations) const /*override*/; /** Based on the m_AllowedRotations, adds rotated cBlockAreas to the m_BlockArea array. To be called only from this class's constructor! */ diff --git a/src/Generating/PrefabPiecePool.h b/src/Generating/PrefabPiecePool.h index b9c1f0483..df5db3cd2 100644 --- a/src/Generating/PrefabPiecePool.h +++ b/src/Generating/PrefabPiecePool.h @@ -71,13 +71,13 @@ protected: /** Adds the prefab to the m_PiecesByConnector map for all its connectors. */ void AddToPerConnectorMap(cPrefab * a_Prefab); - // cPiecePool overrides: - virtual cPieces GetPiecesWithConnector(int a_ConnectorType) override; - virtual cPieces GetStartingPieces(void) override; - virtual int GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece) override; - virtual int GetStartingPieceWeight(const cPiece & a_NewPiece) override; - virtual void PiecePlaced(const cPiece & a_Piece) override; - virtual void Reset(void) override; + // cPiecePool /*override*/s: + virtual cPieces GetPiecesWithConnector(int a_ConnectorType) /*override*/; + virtual cPieces GetStartingPieces(void) /*override*/; + virtual int GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece) /*override*/; + virtual int GetStartingPieceWeight(const cPiece & a_NewPiece) /*override*/; + virtual void PiecePlaced(const cPiece & a_Piece) /*override*/; + virtual void Reset(void) /*override*/; } ; diff --git a/src/Generating/RainbowRoadsGen.cpp b/src/Generating/RainbowRoadsGen.cpp index c3c07cdec..2422bd33e 100644 --- a/src/Generating/RainbowRoadsGen.cpp +++ b/src/Generating/RainbowRoadsGen.cpp @@ -71,8 +71,8 @@ protected: cPlacedPieces m_Pieces; - // cGridStructGen::cStructure overrides: - virtual void DrawIntoChunk(cChunkDesc & a_Chunk) override + // cGridStructGen::cStructure /*override*/s: + virtual void DrawIntoChunk(cChunkDesc & a_Chunk) /*override*/ { for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr) { diff --git a/src/Generating/RainbowRoadsGen.h b/src/Generating/RainbowRoadsGen.h index 5813e1d14..e08e7bf97 100644 --- a/src/Generating/RainbowRoadsGen.h +++ b/src/Generating/RainbowRoadsGen.h @@ -38,8 +38,8 @@ protected: int m_MaxSize; - // cGridStructGen overrides: - virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; + // cGridStructGen /*override*/s: + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) /*override*/; } ; diff --git a/src/Generating/Ravines.cpp b/src/Generating/Ravines.cpp index 70b9d0b62..5402c2ced 100644 --- a/src/Generating/Ravines.cpp +++ b/src/Generating/Ravines.cpp @@ -69,8 +69,8 @@ public: #endif // _DEBUG protected: - // cGridStructGen::cStructure overrides: - virtual void DrawIntoChunk(cChunkDesc & a_ChunkDesc) override; + // cGridStructGen::cStructure /*override*/s: + virtual void DrawIntoChunk(cChunkDesc & a_ChunkDesc) /*override*/; } ; diff --git a/src/Generating/Ravines.h b/src/Generating/Ravines.h index 3e41c5ce6..ab94c28a0 100644 --- a/src/Generating/Ravines.h +++ b/src/Generating/Ravines.h @@ -31,8 +31,8 @@ protected: int m_Size; // Max size, in blocks, of the ravines generated - // cGridStructGen overrides: - virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; + // cGridStructGen /*override*/s: + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) /*override*/; } ; diff --git a/src/Generating/RoughRavines.cpp b/src/Generating/RoughRavines.cpp index 2ee3704b3..1953e1a23 100644 --- a/src/Generating/RoughRavines.cpp +++ b/src/Generating/RoughRavines.cpp @@ -152,7 +152,7 @@ protected: } - virtual void DrawIntoChunk(cChunkDesc & a_ChunkDesc) override + virtual void DrawIntoChunk(cChunkDesc & a_ChunkDesc) /*override*/ { int BlockStartX = a_ChunkDesc.GetChunkX() * cChunkDef::Width; int BlockStartZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width; diff --git a/src/Generating/RoughRavines.h b/src/Generating/RoughRavines.h index 4c905b641..12c132d86 100644 --- a/src/Generating/RoughRavines.h +++ b/src/Generating/RoughRavines.h @@ -77,8 +77,8 @@ protected: /** Minimum ceiling height at the ravine's center */ float m_MinCeilingHeightCenter; - // cGridStructGen overrides: - virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; + // cGridStructGen /*override*/s: + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) /*override*/; }; diff --git a/src/Generating/StructGen.h b/src/Generating/StructGen.h index 55d5bc1c7..8bbf71f00 100644 --- a/src/Generating/StructGen.h +++ b/src/Generating/StructGen.h @@ -64,8 +64,8 @@ protected: const cChunkDef::BiomeMap & a_Biomes ); - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; @@ -100,8 +100,8 @@ protected: OreList m_OreList; // A list of possible ores. BLOCKTYPE m_ToReplace; - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; void GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_OreType, int a_MaxHeight, int a_NumNests, int a_NestSize, cChunkDef::BlockTypes & a_BlockTypes, int a_Seq); } ; @@ -130,8 +130,8 @@ protected: cTerrainHeightGen & m_HeiGen; int m_Probability; ///< Chance, 0 .. 100, of a chunk having the lake - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; /// Creates a lake image for the specified chunk into a_Lake void CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a_Lake); @@ -152,8 +152,8 @@ protected: cNoise m_Noise1; cNoise m_Noise2; - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; bool HasWantedBiome(cChunkDesc & a_ChunkDesc) const; } ; @@ -174,8 +174,8 @@ protected: cNoise m_NoiseZ; cNoise m_NoiseH; - // cFinishGen override: - virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + // cFinishGen /*override*/: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) /*override*/; } ; diff --git a/src/Generating/TestRailsGen.cpp b/src/Generating/TestRailsGen.cpp index 66ab8b33f..2d8f7d675 100644 --- a/src/Generating/TestRailsGen.cpp +++ b/src/Generating/TestRailsGen.cpp @@ -71,8 +71,8 @@ protected: cPlacedPieces m_Pieces; - // cGridStructGen::cStructure overrides: - virtual void DrawIntoChunk(cChunkDesc & a_Chunk) override + // cGridStructGen::cStructure /*override*/s: + virtual void DrawIntoChunk(cChunkDesc & a_Chunk) /*override*/ { for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr) { diff --git a/src/Generating/TestRailsGen.h b/src/Generating/TestRailsGen.h index 5b0ce95f4..c7f4316ac 100644 --- a/src/Generating/TestRailsGen.h +++ b/src/Generating/TestRailsGen.h @@ -38,8 +38,8 @@ protected: int m_MaxSize; - // cGridStructGen overrides: - virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; + // cGridStructGen /*override*/s: + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) /*override*/; } ; diff --git a/src/Generating/UnderwaterBaseGen.cpp b/src/Generating/UnderwaterBaseGen.cpp index 9278ea546..729789b34 100644 --- a/src/Generating/UnderwaterBaseGen.cpp +++ b/src/Generating/UnderwaterBaseGen.cpp @@ -71,8 +71,8 @@ protected: cPlacedPieces m_Pieces; - // cGridStructGen::cStructure overrides: - virtual void DrawIntoChunk(cChunkDesc & a_Chunk) override + // cGridStructGen::cStructure /*override*/s: + virtual void DrawIntoChunk(cChunkDesc & a_Chunk) /*override*/ { for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr) { diff --git a/src/Generating/UnderwaterBaseGen.h b/src/Generating/UnderwaterBaseGen.h index d6267b602..8b0874cd1 100644 --- a/src/Generating/UnderwaterBaseGen.h +++ b/src/Generating/UnderwaterBaseGen.h @@ -41,8 +41,8 @@ protected: cBiomeGen & m_BiomeGen; - // cGridStructGen overrides: - virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; + // cGridStructGen /*override*/s: + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) /*override*/; } ; diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp index a7f66b75e..f74b996a1 100644 --- a/src/Generating/VillageGen.cpp +++ b/src/Generating/VillageGen.cpp @@ -84,8 +84,8 @@ public: } - // cPrefabPiecePool overrides: - virtual int GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece) override + // cPrefabPiecePool /*override*/s: + virtual int GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece) /*override*/ { // Roads cannot branch T-wise (appending -2 connector to a +2 connector on a 1-high piece): if ((a_ExistingConnector.m_Type == 2) && (a_PlacedPiece.GetDepth() > 0) && (a_PlacedPiece.GetPiece().GetSize().y == 1)) @@ -187,8 +187,8 @@ protected: BLOCKTYPE m_WaterRoadBlock; - // cGridStructGen::cStructure overrides: - virtual void DrawIntoChunk(cChunkDesc & a_Chunk) override + // cGridStructGen::cStructure /*override*/s: + virtual void DrawIntoChunk(cChunkDesc & a_Chunk) /*override*/ { // Iterate over all items // Each intersecting prefab is placed on ground, then drawn @@ -258,7 +258,7 @@ protected: } - // cPiecePool overrides: + // cPiecePool /*override*/s: virtual cPieces GetPiecesWithConnector(int a_ConnectorType) { return m_Prefabs.GetPiecesWithConnector(a_ConnectorType); @@ -275,7 +275,7 @@ protected: const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece - ) override + ) /*override*/ { // Check against the density: if (a_ExistingConnector.m_Type == 1) @@ -293,19 +293,19 @@ protected: } - virtual int GetStartingPieceWeight(const cPiece & a_NewPiece) override + virtual int GetStartingPieceWeight(const cPiece & a_NewPiece) /*override*/ { return m_Prefabs.GetStartingPieceWeight(a_NewPiece); } - virtual void PiecePlaced(const cPiece & a_Piece) override + virtual void PiecePlaced(const cPiece & a_Piece) /*override*/ { m_Prefabs.PiecePlaced(a_Piece); } - virtual void Reset(void) override + virtual void Reset(void) /*override*/ { m_Prefabs.Reset(); } diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h index 694ea2358..ad316b66f 100644 --- a/src/Generating/VillageGen.h +++ b/src/Generating/VillageGen.h @@ -48,8 +48,8 @@ protected: cTerrainHeightGen & m_HeightGen; - // cGridStructGen overrides: - virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; + // cGridStructGen /*override*/s: + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) /*override*/; } ; diff --git a/src/Globals.h b/src/Globals.h index de1024010..80afff80a 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -10,7 +10,7 @@ // Compiler-dependent stuff: #if defined(_MSC_VER) - // MSVC produces warning C4481 on the override keyword usage, so disable the warning altogether + // MSVC produces warning C4481 on the /*override*/ keyword usage, so disable the warning altogether #pragma warning(disable:4481) // Disable some warnings that we don't care about: @@ -56,9 +56,9 @@ // TODO: Can GCC explicitly mark classes as abstract (no instances can be created)? #define abstract - // override is part of c++11 + // /*override*/ is part of c++11 #if __cplusplus < 201103L - #define override + #define /*override*/ #endif #define OBSOLETE __attribute__((deprecated)) @@ -103,7 +103,7 @@ #define abstract // Mark virtual methods as overriding (forcing them to have a virtual function of the same signature in the base class) - #define override + #define /*override*/ // Mark functions as obsolete, so that their usage results in a compile-time warning #define OBSOLETE diff --git a/src/HTTPServer/HTTPConnection.h b/src/HTTPServer/HTTPConnection.h index 6ea8a1ae8..052f93c17 100644 --- a/src/HTTPServer/HTTPConnection.h +++ b/src/HTTPServer/HTTPConnection.h @@ -90,16 +90,16 @@ protected: size_t m_CurrentRequestBodyRemaining; - // cSocketThreads::cCallback overrides: + // cSocketThreads::cCallback /*override*/s: /** Data is received from the client. Returns true if the connection has been closed as the result of parsing the data. */ - virtual bool DataReceived(const char * a_Data, size_t a_Size) override; + virtual bool DataReceived(const char * a_Data, size_t a_Size) /*override*/; /** Data can be sent to client */ - virtual void GetOutgoingData(AString & a_Data) override; + virtual void GetOutgoingData(AString & a_Data) /*override*/; /** The socket has been closed for any reason */ - virtual void SocketClosed(void) override; + virtual void SocketClosed(void) /*override*/; } ; typedef std::vector<cHTTPConnection *> cHTTPConnections; diff --git a/src/HTTPServer/HTTPFormParser.h b/src/HTTPServer/HTTPFormParser.h index edc6d2471..c70277380 100644 --- a/src/HTTPServer/HTTPFormParser.h +++ b/src/HTTPServer/HTTPFormParser.h @@ -103,11 +103,11 @@ protected: /// Parses m_IncomingData as form-urlencoded data (fpkURL or fpkFormUrlEncoded kinds) void ParseFormUrlEncoded(void); - // cMultipartParser::cCallbacks overrides: - virtual void OnPartStart (void) override; - virtual void OnPartHeader(const AString & a_Key, const AString & a_Value) override; - virtual void OnPartData (const char * a_Data, size_t a_Size) override; - virtual void OnPartEnd (void) override; + // cMultipartParser::cCallbacks /*override*/s: + virtual void OnPartStart (void) /*override*/; + virtual void OnPartHeader(const AString & a_Key, const AString & a_Value) /*override*/; + virtual void OnPartData (const char * a_Data, size_t a_Size) /*override*/; + virtual void OnPartEnd (void) /*override*/; } ; diff --git a/src/HTTPServer/HTTPMessage.h b/src/HTTPServer/HTTPMessage.h index c0667030f..81b9ffc61 100644 --- a/src/HTTPServer/HTTPMessage.h +++ b/src/HTTPServer/HTTPMessage.h @@ -149,8 +149,8 @@ protected: */ size_t ParseRequestLine(const char * a_Data, size_t a_Size); - // cEnvelopeParser::cCallbacks overrides: - virtual void OnHeaderLine(const AString & a_Key, const AString & a_Value) override; + // cEnvelopeParser::cCallbacks /*override*/s: + virtual void OnHeaderLine(const AString & a_Key, const AString & a_Value) /*override*/; } ; diff --git a/src/HTTPServer/HTTPServer.cpp b/src/HTTPServer/HTTPServer.cpp index 8eabe5cb2..436f02a93 100644 --- a/src/HTTPServer/HTTPServer.cpp +++ b/src/HTTPServer/HTTPServer.cpp @@ -28,7 +28,7 @@ class cDebugCallbacks : public cHTTPServer::cCallbacks, protected cHTTPFormParser::cCallbacks { - virtual void OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override + virtual void OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) /*override*/ { UNUSED(a_Connection); @@ -39,7 +39,7 @@ class cDebugCallbacks : } - virtual void OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, size_t a_Size) override + virtual void OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, size_t a_Size) /*override*/ { UNUSED(a_Connection); @@ -51,7 +51,7 @@ class cDebugCallbacks : } - virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override + virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) /*override*/ { cHTTPFormParser * FormParser = (cHTTPFormParser *)(a_Request.GetUserData()); if (FormParser != NULL) @@ -95,19 +95,19 @@ class cDebugCallbacks : } - virtual void OnFileStart(cHTTPFormParser & a_Parser, const AString & a_FileName) override + virtual void OnFileStart(cHTTPFormParser & a_Parser, const AString & a_FileName) /*override*/ { // TODO } - virtual void OnFileData(cHTTPFormParser & a_Parser, const char * a_Data, size_t a_Size) override + virtual void OnFileData(cHTTPFormParser & a_Parser, const char * a_Data, size_t a_Size) /*override*/ { // TODO } - virtual void OnFileEnd(cHTTPFormParser & a_Parser) override + virtual void OnFileEnd(cHTTPFormParser & a_Parser) /*override*/ { // TODO } diff --git a/src/HTTPServer/HTTPServer.h b/src/HTTPServer/HTTPServer.h index 522b7da62..66506fe04 100644 --- a/src/HTTPServer/HTTPServer.h +++ b/src/HTTPServer/HTTPServer.h @@ -89,8 +89,8 @@ protected: cCryptoKeyPtr m_CertPrivKey; - // cListenThread::cCallback overrides: - virtual void OnConnectionAccepted(cSocket & a_Socket) override; + // cListenThread::cCallback /*override*/s: + virtual void OnConnectionAccepted(cSocket & a_Socket) /*override*/; /// Called by cHTTPConnection to close the connection (presumably due to an error) void CloseConnection(cHTTPConnection & a_Connection); diff --git a/src/HTTPServer/MultipartParser.cpp b/src/HTTPServer/MultipartParser.cpp index 09732c5f7..b3ca833a3 100644 --- a/src/HTTPServer/MultipartParser.cpp +++ b/src/HTTPServer/MultipartParser.cpp @@ -57,25 +57,25 @@ ThisIsIgnoredEpilogue"; printf("Multipart parsing test finished\n"); } - virtual void OnPartStart(void) override + virtual void OnPartStart(void) /*override*/ { printf("Starting a new part\n"); } - virtual void OnPartHeader(const AString & a_Key, const AString & a_Value) override + virtual void OnPartHeader(const AString & a_Key, const AString & a_Value) /*override*/ { printf(" Hdr: \"%s\"=\"%s\"\n", a_Key.c_str(), a_Value.c_str()); } - virtual void OnPartData(const char * a_Data, int a_Size) override + virtual void OnPartData(const char * a_Data, int a_Size) /*override*/ { printf(" Data: %d bytes, \"%.*s\"\n", a_Size, a_Size, a_Data); } - virtual void OnPartEnd(void) override + virtual void OnPartEnd(void) /*override*/ { printf("Part end\n"); } diff --git a/src/HTTPServer/MultipartParser.h b/src/HTTPServer/MultipartParser.h index ad76ad650..16a32920f 100644 --- a/src/HTTPServer/MultipartParser.h +++ b/src/HTTPServer/MultipartParser.h @@ -70,8 +70,8 @@ protected: /** Parse one line of incoming data in the headers section of a part. The CRLF has already been stripped from a_Data / a_Size */ void ParseHeaderLine(const char * a_Data, size_t a_Size); - // cEnvelopeParser overrides: - virtual void OnHeaderLine(const AString & a_Key, const AString & a_Value) override; + // cEnvelopeParser /*override*/s: + virtual void OnHeaderLine(const AString & a_Key, const AString & a_Value) /*override*/; } ; diff --git a/src/HTTPServer/SslHTTPConnection.h b/src/HTTPServer/SslHTTPConnection.h index c2c1585cd..5bcd642f3 100644 --- a/src/HTTPServer/SslHTTPConnection.h +++ b/src/HTTPServer/SslHTTPConnection.h @@ -35,9 +35,9 @@ protected: /** The private key used for the certificate */ cCryptoKeyPtr m_PrivateKey; - // cHTTPConnection overrides: - virtual bool DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client - virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client + // cHTTPConnection /*override*/s: + virtual bool DataReceived (const char * a_Data, size_t a_Size) /*override*/; // Data is received from the client + virtual void GetOutgoingData(AString & a_Data) /*override*/; // Data can be sent to client } ; diff --git a/src/Inventory.h b/src/Inventory.h index 5628fb0da..701c376de 100644 --- a/src/Inventory.h +++ b/src/Inventory.h @@ -185,8 +185,8 @@ protected: /** Returns the ItemGrid and the (grid-local) slot number for a (global) slot number; return NULL for invalid SlotNum */ cItemGrid * GetGridForSlotNum(int a_SlotNum, int & a_GridSlotNum); - // cItemGrid::cListener override: - virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override; + // cItemGrid::cListener /*override*/: + virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) /*override*/; }; // tolua_export diff --git a/src/Items/ItemArmor.h b/src/Items/ItemArmor.h index 2436df5bd..cc7f15078 100644 --- a/src/Items/ItemArmor.h +++ b/src/Items/ItemArmor.h @@ -18,7 +18,7 @@ public: } /** Move the armor to the armor slot of the player's inventory */ - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { int SlotNum; if (ItemCategory::IsHelmet(a_Item.m_ItemType)) @@ -60,7 +60,7 @@ public: return true; } - virtual bool CanRepairWithRawMaterial(short a_ItemType) override + virtual bool CanRepairWithRawMaterial(short a_ItemType) /*override*/ { switch (m_ItemType) { diff --git a/src/Items/ItemBed.h b/src/Items/ItemBed.h index 94a14cf16..dd48c57f7 100644 --- a/src/Items/ItemBed.h +++ b/src/Items/ItemBed.h @@ -19,7 +19,7 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -29,7 +29,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { if (a_BlockFace != BLOCK_FACE_TOP) { diff --git a/src/Items/ItemBoat.h b/src/Items/ItemBoat.h index 7faac1e32..5c50c6321 100644 --- a/src/Items/ItemBoat.h +++ b/src/Items/ItemBoat.h @@ -28,7 +28,7 @@ public: - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { if ((a_Dir != BLOCK_FACE_YM) && (a_Dir != BLOCK_FACE_NONE)) { @@ -47,7 +47,7 @@ public: { } - virtual bool OnNextBlock(int a_CBBlockX, int a_CBBlockY, int a_CBBlockZ, BLOCKTYPE a_CBBlockType, NIBBLETYPE a_CBBlockMeta, char a_CBEntryFace) override + virtual bool OnNextBlock(int a_CBBlockX, int a_CBBlockY, int a_CBBlockZ, BLOCKTYPE a_CBBlockType, NIBBLETYPE a_CBBlockMeta, char a_CBEntryFace) /*override*/ { if (a_CBBlockType != E_BLOCK_AIR) { diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h index f29cc5d59..639442481 100644 --- a/src/Items/ItemBow.h +++ b/src/Items/ItemBow.h @@ -27,7 +27,7 @@ public: } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { ASSERT(a_Player != NULL); @@ -42,7 +42,7 @@ public: } - virtual void OnItemShoot(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual void OnItemShoot(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { // Actual shot - produce the arrow with speed based on the ticks that the bow was charged ASSERT(a_Player != NULL); diff --git a/src/Items/ItemBrewingStand.h b/src/Items/ItemBrewingStand.h index 7be57763c..95e2fedca 100644 --- a/src/Items/ItemBrewingStand.h +++ b/src/Items/ItemBrewingStand.h @@ -17,7 +17,7 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -28,7 +28,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = E_BLOCK_BREWING_STAND; a_BlockMeta = 0; diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index a17c4838b..6e994555b 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -22,7 +22,7 @@ public: } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { switch (m_ItemType) { @@ -156,7 +156,7 @@ public: { } - virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) override + virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) /*override*/ { if (IsBlockWater(a_BlockType) || IsBlockLava(a_BlockType)) { @@ -198,7 +198,7 @@ public: Vector3i m_Pos; BLOCKTYPE m_ReplacedBlock; - virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) override + virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) /*override*/ { if (a_BlockType != E_BLOCK_AIR) { diff --git a/src/Items/ItemCake.h b/src/Items/ItemCake.h index d1cb091b6..dab756a3f 100644 --- a/src/Items/ItemCake.h +++ b/src/Items/ItemCake.h @@ -17,7 +17,7 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -28,7 +28,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = E_BLOCK_CAKE; a_BlockMeta = 0; diff --git a/src/Items/ItemCauldron.h b/src/Items/ItemCauldron.h index 9617c30ef..4cc222bec 100644 --- a/src/Items/ItemCauldron.h +++ b/src/Items/ItemCauldron.h @@ -17,7 +17,7 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -28,7 +28,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = E_BLOCK_CAULDRON; a_BlockMeta = 0; diff --git a/src/Items/ItemComparator.h b/src/Items/ItemComparator.h index fc843c186..ebe207fc9 100644 --- a/src/Items/ItemComparator.h +++ b/src/Items/ItemComparator.h @@ -17,7 +17,7 @@ public: { } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -27,7 +27,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = E_BLOCK_INACTIVE_COMPARATOR; a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetYaw()); diff --git a/src/Items/ItemDoor.h b/src/Items/ItemDoor.h index c1b439024..ca89ee65f 100644 --- a/src/Items/ItemDoor.h +++ b/src/Items/ItemDoor.h @@ -18,7 +18,7 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -28,7 +28,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = (m_ItemType == E_ITEM_WOODEN_DOOR) ? E_BLOCK_WOODEN_DOOR : E_BLOCK_IRON_DOOR; cChunkInterface ChunkInterface(a_World->GetChunkMap()); diff --git a/src/Items/ItemDye.h b/src/Items/ItemDye.h index ccf4714f7..d57f4700c 100644 --- a/src/Items/ItemDye.h +++ b/src/Items/ItemDye.h @@ -19,7 +19,7 @@ public: } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { // Handle growing the plants: if (a_Item.m_ItemDamage == E_META_DYE_WHITE) diff --git a/src/Items/ItemEmptyMap.h b/src/Items/ItemEmptyMap.h index 953673382..5e16c0d6b 100644 --- a/src/Items/ItemEmptyMap.h +++ b/src/Items/ItemEmptyMap.h @@ -27,7 +27,7 @@ public: { } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { UNUSED(a_Item); UNUSED(a_BlockX); diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h index 6350a38ba..63e9a46a6 100644 --- a/src/Items/ItemFishingRod.h +++ b/src/Items/ItemFishingRod.h @@ -31,7 +31,7 @@ public: { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { m_CanPickup = ((cFloater *)a_Entity)->CanPickup(); m_Pos = Vector3d(a_Entity->GetPosX(), a_Entity->GetPosY(), a_Entity->GetPosZ()); @@ -67,7 +67,7 @@ public: { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { Vector3d Speed = m_PlayerPos - a_Entity->GetPosition(); a_Entity->AddSpeed(Speed); @@ -93,7 +93,7 @@ public: { } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { if (a_Dir != BLOCK_FACE_NONE) { diff --git a/src/Items/ItemFlowerPot.h b/src/Items/ItemFlowerPot.h index 320dce997..9fbc0e978 100644 --- a/src/Items/ItemFlowerPot.h +++ b/src/Items/ItemFlowerPot.h @@ -17,7 +17,7 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -28,7 +28,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = E_BLOCK_FLOWER_POT; a_BlockMeta = 0; diff --git a/src/Items/ItemFood.h b/src/Items/ItemFood.h index 9035344df..3f67463ed 100644 --- a/src/Items/ItemFood.h +++ b/src/Items/ItemFood.h @@ -18,13 +18,13 @@ public: } - virtual bool IsFood(void) override + virtual bool IsFood(void) /*override*/ { return true; } - virtual FoodInfo GetFoodInfo(void) override + virtual FoodInfo GetFoodInfo(void) /*override*/ { switch (m_ItemType) { @@ -58,7 +58,7 @@ public: return FoodInfo(0, 0.f); } - virtual bool GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance) override + virtual bool GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance) /*override*/ { switch (m_ItemType) { diff --git a/src/Items/ItemGoldenApple.h b/src/Items/ItemGoldenApple.h index 02ac0202c..e5ecf9c3e 100644 --- a/src/Items/ItemGoldenApple.h +++ b/src/Items/ItemGoldenApple.h @@ -18,7 +18,7 @@ public: } - virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override + virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) /*override*/ { // Feed the player: FoodInfo Info = GetFoodInfo(); @@ -40,13 +40,13 @@ public: } - virtual FoodInfo GetFoodInfo(void) override + virtual FoodInfo GetFoodInfo(void) /*override*/ { return FoodInfo(4, 9.6); } - virtual bool GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance) override + virtual bool GetEatEffect(cEntityEffect::eType & a_EffectType, int & a_EffectDurationTicks, short & a_EffectIntensity, float & a_Chance) /*override*/ { return false; } diff --git a/src/Items/ItemHoe.h b/src/Items/ItemHoe.h index 8d0b71478..01e53d636 100644 --- a/src/Items/ItemHoe.h +++ b/src/Items/ItemHoe.h @@ -18,7 +18,7 @@ public: { } - virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); @@ -33,7 +33,7 @@ public: } - virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override + virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) /*override*/ { return 0; } diff --git a/src/Items/ItemItemFrame.h b/src/Items/ItemItemFrame.h index 87e20ecf0..ba8300015 100644 --- a/src/Items/ItemItemFrame.h +++ b/src/Items/ItemItemFrame.h @@ -19,7 +19,7 @@ public: } - virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { if ((a_Dir == BLOCK_FACE_NONE) || (a_Dir == BLOCK_FACE_YP) || (a_Dir == BLOCK_FACE_YM)) { diff --git a/src/Items/ItemLeaves.h b/src/Items/ItemLeaves.h index f48126dc5..cce62e687 100644 --- a/src/Items/ItemLeaves.h +++ b/src/Items/ItemLeaves.h @@ -23,7 +23,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { bool res = super::GetPlacementBlockTypeMeta( a_World, a_Player, diff --git a/src/Items/ItemLighter.h b/src/Items/ItemLighter.h index 9f98bf85f..6d6119638 100644 --- a/src/Items/ItemLighter.h +++ b/src/Items/ItemLighter.h @@ -19,7 +19,7 @@ public: { } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { if (a_BlockFace < 0) { diff --git a/src/Items/ItemLilypad.h b/src/Items/ItemLilypad.h index b9d837384..f5a8bdabb 100644 --- a/src/Items/ItemLilypad.h +++ b/src/Items/ItemLilypad.h @@ -23,13 +23,13 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return false; // Set as not placeable so OnItemUse is called } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { if (a_BlockFace > BLOCK_FACE_NONE) { @@ -53,7 +53,7 @@ public: { } - virtual bool OnNextBlock(int a_CBBlockX, int a_CBBlockY, int a_CBBlockZ, BLOCKTYPE a_CBBlockType, NIBBLETYPE a_CBBlockMeta, char a_CBEntryFace) override + virtual bool OnNextBlock(int a_CBBlockX, int a_CBBlockY, int a_CBBlockZ, BLOCKTYPE a_CBBlockType, NIBBLETYPE a_CBBlockMeta, char a_CBEntryFace) /*override*/ { if (IsBlockWater(a_CBBlockType)) { diff --git a/src/Items/ItemMilk.h b/src/Items/ItemMilk.h index db7bc13be..32932bde9 100644 --- a/src/Items/ItemMilk.h +++ b/src/Items/ItemMilk.h @@ -11,13 +11,13 @@ public: { } - virtual bool IsDrinkable(short a_ItemDamage) override + virtual bool IsDrinkable(short a_ItemDamage) /*override*/ { UNUSED(a_ItemDamage); return true; } - virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override + virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) /*override*/ { UNUSED(a_Item); a_Player->ClearEntityEffects(); diff --git a/src/Items/ItemMinecart.h b/src/Items/ItemMinecart.h index 63038de51..c0d179fc2 100644 --- a/src/Items/ItemMinecart.h +++ b/src/Items/ItemMinecart.h @@ -27,7 +27,7 @@ public: - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { if (a_Dir < 0) { diff --git a/src/Items/ItemMobHead.h b/src/Items/ItemMobHead.h index 4c36fe8d8..6317de555 100644 --- a/src/Items/ItemMobHead.h +++ b/src/Items/ItemMobHead.h @@ -18,7 +18,7 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -29,7 +29,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = E_BLOCK_HEAD; a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage & 0x0f); diff --git a/src/Items/ItemNetherWart.h b/src/Items/ItemNetherWart.h index 10a0864b5..3ada15464 100644 --- a/src/Items/ItemNetherWart.h +++ b/src/Items/ItemNetherWart.h @@ -18,7 +18,7 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -28,7 +28,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { if (a_BlockFace != BLOCK_FACE_TOP) { diff --git a/src/Items/ItemPainting.h b/src/Items/ItemPainting.h index a2a77ce21..bbe13e21f 100644 --- a/src/Items/ItemPainting.h +++ b/src/Items/ItemPainting.h @@ -19,7 +19,7 @@ public: { } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { if (a_Dir == BLOCK_FACE_NONE) { diff --git a/src/Items/ItemPickaxe.h b/src/Items/ItemPickaxe.h index 17fd96822..ee819e85b 100644 --- a/src/Items/ItemPickaxe.h +++ b/src/Items/ItemPickaxe.h @@ -30,7 +30,7 @@ public: } } - virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override + virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) /*override*/ { switch (a_BlockType) { @@ -88,7 +88,7 @@ public: return super::CanHarvestBlock(a_BlockType); } - virtual bool CanRepairWithRawMaterial(short a_ItemType) override + virtual bool CanRepairWithRawMaterial(short a_ItemType) /*override*/ { switch (m_ItemType) { diff --git a/src/Items/ItemPotion.h b/src/Items/ItemPotion.h index 24614cd8a..110d47fca 100644 --- a/src/Items/ItemPotion.h +++ b/src/Items/ItemPotion.h @@ -17,8 +17,8 @@ public: } - // cItemHandler overrides: - virtual bool IsDrinkable(short a_ItemDamage) override + // cItemHandler /*override*/s: + virtual bool IsDrinkable(short a_ItemDamage) /*override*/ { // Drinkable potion if 13th lowest bit is set // Ref.: http://minecraft.gamepedia.com/Potions#Data_value_table @@ -26,7 +26,7 @@ public: } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { short PotionDamage = a_Item.m_ItemDamage; @@ -53,7 +53,7 @@ public: } - virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override + virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) /*override*/ { short PotionDamage = a_Item->m_ItemDamage; diff --git a/src/Items/ItemRedstoneDust.h b/src/Items/ItemRedstoneDust.h index a2289239c..709c84a2d 100644 --- a/src/Items/ItemRedstoneDust.h +++ b/src/Items/ItemRedstoneDust.h @@ -15,7 +15,7 @@ public: { } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -25,7 +25,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { if (!cBlockInfo::FullyOccupiesVoxel(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ))) // Some solid blocks, such as cocoa beans, are not suitable for dust { diff --git a/src/Items/ItemRedstoneRepeater.h b/src/Items/ItemRedstoneRepeater.h index 13a797d00..930acb065 100644 --- a/src/Items/ItemRedstoneRepeater.h +++ b/src/Items/ItemRedstoneRepeater.h @@ -17,7 +17,7 @@ public: { } - virtual bool IsPlaceable() override + virtual bool IsPlaceable() /*override*/ { return true; } @@ -27,7 +27,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = E_BLOCK_REDSTONE_REPEATER_OFF; a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetYaw()); diff --git a/src/Items/ItemSapling.h b/src/Items/ItemSapling.h index dbcb12be5..a70ae6de5 100644 --- a/src/Items/ItemSapling.h +++ b/src/Items/ItemSapling.h @@ -23,7 +23,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { bool res = super::GetPlacementBlockTypeMeta( a_World, a_Player, diff --git a/src/Items/ItemSeeds.h b/src/Items/ItemSeeds.h index e1db7c5f4..5b5b91626 100644 --- a/src/Items/ItemSeeds.h +++ b/src/Items/ItemSeeds.h @@ -18,12 +18,12 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } - virtual bool IsFood(void) override + virtual bool IsFood(void) /*override*/ { switch (m_ItemType) // Special cases, both a seed and food { @@ -33,7 +33,7 @@ public: } } - virtual FoodInfo GetFoodInfo(void) override + virtual FoodInfo GetFoodInfo(void) /*override*/ { switch (m_ItemType) { @@ -48,7 +48,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { if (a_BlockFace != BLOCK_FACE_TOP) { diff --git a/src/Items/ItemShears.h b/src/Items/ItemShears.h index fa2794df2..77d5df3ba 100644 --- a/src/Items/ItemShears.h +++ b/src/Items/ItemShears.h @@ -20,13 +20,13 @@ public: } - virtual bool IsTool(void) override + virtual bool IsTool(void) /*override*/ { return true; } - virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); if ((Block == E_BLOCK_LEAVES) || (Block == E_BLOCK_NEW_LEAVES)) @@ -47,7 +47,7 @@ public: } - virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override + virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) /*override*/ { switch (a_BlockType) { @@ -63,13 +63,13 @@ public: } - virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override + virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) /*override*/ { return 0; } - virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { super::OnBlockDestroyed(a_World, a_Player, a_Item, a_BlockX, a_BlockY, a_BlockZ); diff --git a/src/Items/ItemShovel.h b/src/Items/ItemShovel.h index cd235678d..9c35e755c 100644 --- a/src/Items/ItemShovel.h +++ b/src/Items/ItemShovel.h @@ -21,7 +21,7 @@ public: { } - virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); if (Block == E_BLOCK_SNOW) @@ -37,7 +37,7 @@ public: return false; } - virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override + virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) /*override*/ { if (a_BlockType == E_BLOCK_SNOW) { @@ -46,7 +46,7 @@ public: return super::CanHarvestBlock(a_BlockType); } - virtual bool CanRepairWithRawMaterial(short a_ItemType) override + virtual bool CanRepairWithRawMaterial(short a_ItemType) /*override*/ { switch (m_ItemType) { diff --git a/src/Items/ItemSign.h b/src/Items/ItemSign.h index 0fa0fa0be..42d30906b 100644 --- a/src/Items/ItemSign.h +++ b/src/Items/ItemSign.h @@ -20,7 +20,7 @@ public: } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -31,7 +31,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { if (a_BlockFace == BLOCK_FACE_TOP) { diff --git a/src/Items/ItemSpawnEgg.h b/src/Items/ItemSpawnEgg.h index bba97afa1..971aa9edf 100644 --- a/src/Items/ItemSpawnEgg.h +++ b/src/Items/ItemSpawnEgg.h @@ -19,7 +19,7 @@ public: } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) /*override*/ { if (a_BlockFace < 0) { diff --git a/src/Items/ItemString.h b/src/Items/ItemString.h index a97fbe0ce..db01462dc 100644 --- a/src/Items/ItemString.h +++ b/src/Items/ItemString.h @@ -16,7 +16,7 @@ public: { } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -26,7 +26,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = E_BLOCK_TRIPWIRE; a_BlockMeta = 0; diff --git a/src/Items/ItemSugarcane.h b/src/Items/ItemSugarcane.h index dd2e2ece3..86e90f838 100644 --- a/src/Items/ItemSugarcane.h +++ b/src/Items/ItemSugarcane.h @@ -16,7 +16,7 @@ public: { } - virtual bool IsPlaceable(void) override + virtual bool IsPlaceable(void) /*override*/ { return true; } @@ -26,7 +26,7 @@ public: int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) override + ) /*override*/ { a_BlockType = E_BLOCK_SUGARCANE; a_BlockMeta = 0; diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h index 2b2dbfc0d..e806801e0 100644 --- a/src/Items/ItemSword.h +++ b/src/Items/ItemSword.h @@ -20,7 +20,7 @@ public: } - virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override + virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) /*override*/ { if (a_BlockType == E_BLOCK_COBWEB) { @@ -30,7 +30,7 @@ public: } - virtual bool CanRepairWithRawMaterial(short a_ItemType) override + virtual bool CanRepairWithRawMaterial(short a_ItemType) /*override*/ { switch (m_ItemType) { @@ -44,7 +44,7 @@ public: } - virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override + virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) /*override*/ { switch ((int)a_Action) { diff --git a/src/Items/ItemThrowable.h b/src/Items/ItemThrowable.h index c151c5d3a..9d1280eb5 100644 --- a/src/Items/ItemThrowable.h +++ b/src/Items/ItemThrowable.h @@ -26,7 +26,7 @@ public: } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { Vector3d Pos = a_Player->GetThrowStartPos(); Vector3d Speed = a_Player->GetLookVector() * m_SpeedCoeff; @@ -128,7 +128,7 @@ public: { } - virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override + virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) /*override*/ { if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_AIR) { diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp index 652b03e46..281e5ab1a 100644 --- a/src/LightingThread.cpp +++ b/src/LightingThread.cpp @@ -18,7 +18,7 @@ class cReader : public cChunkDataCallback { - virtual void ChunkData(const cChunkData & a_ChunkBuffer) override + virtual void ChunkData(const cChunkData & a_ChunkBuffer) /*override*/ { BLOCKTYPE * OutputRows = m_BlockTypes; int InputIdx = 0; @@ -39,7 +39,7 @@ class cReader : } // BlockTypes() - virtual void HeightMap(const cChunkDef::HeightMap * a_Heightmap) override + virtual void HeightMap(const cChunkDef::HeightMap * a_Heightmap) /*override*/ { // Copy the entire heightmap, distribute it into the 3x3 chunk blob: typedef struct {HEIGHTTYPE m_Row[16]; } ROW; diff --git a/src/LightingThread.h b/src/LightingThread.h index f71d2cf1a..1ac09096c 100644 --- a/src/LightingThread.h +++ b/src/LightingThread.h @@ -82,13 +82,13 @@ protected: cLightingChunkStay(cLightingThread & a_LightingThread, int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallbackAfter); protected: - virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkZ) override + virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkZ) /*override*/ { UNUSED(a_ChunkX); UNUSED(a_ChunkZ); } - virtual bool OnAllChunksAvailable(void) override; - virtual void OnDisabled(void) override; + virtual bool OnAllChunksAvailable(void) /*override*/; + virtual void OnDisabled(void) /*override*/; } ; typedef std::list<cChunkStay *> cChunkStays; @@ -134,7 +134,7 @@ protected: unsigned int m_SeedIdx2[BlocksPerYLayer * cChunkDef::Height]; int m_NumSeeds; - virtual void Execute(void) override; + virtual void Execute(void) /*override*/; /** Lights the entire chunk. If neighbor chunks don't exist, touches them and re-queues the chunk */ void LightChunk(cLightingChunkStay & a_Item); diff --git a/src/LineBlockTracer.h b/src/LineBlockTracer.h index ccbb70ea6..3760b5784 100644 --- a/src/LineBlockTracer.h +++ b/src/LineBlockTracer.h @@ -77,8 +77,8 @@ protected: /// Moves m_Current to the next block on the line; returns false if no move is possible (reached the end) bool MoveToNextBlock(void); - // cChunkCallback overrides: - virtual bool Item(cChunk * a_Chunk) override; + // cChunkCallback /*override*/s: + virtual bool Item(cChunk * a_Chunk) /*override*/; } ; diff --git a/src/LoggerListeners.cpp b/src/LoggerListeners.cpp index 77e2aaf67..6ad94b7bd 100644 --- a/src/LoggerListeners.cpp +++ b/src/LoggerListeners.cpp @@ -22,7 +22,7 @@ virtual void SetLogColour(cLogger::eLogLevel a_LogLevel) = 0; virtual void SetDefaultLogColour() = 0; - virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) override + virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) /*override*/ { SetLogColour(a_LogLevel); fputs(a_Message.c_str(), stdout); @@ -48,7 +48,7 @@ } #ifdef _DEBUG - virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) override + virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) /*override*/ { super::Log(a_Message, a_LogLevel); // In a Windows Debug build, output the log to debug console as well: @@ -57,7 +57,7 @@ #endif - virtual void SetLogColour(cLogger::eLogLevel a_LogLevel) override + virtual void SetLogColour(cLogger::eLogLevel a_LogLevel) /*override*/ { // by default, gray on black WORD Attrib = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; @@ -92,7 +92,7 @@ } - virtual void SetDefaultLogColour() override + virtual void SetDefaultLogColour() /*override*/ { SetConsoleTextAttribute(m_Console, m_DefaultConsoleAttrib); } @@ -113,7 +113,7 @@ : public cColouredConsoleListener { public: - virtual void SetLogColour(cLogger::eLogLevel a_LogLevel) override + virtual void SetLogColour(cLogger::eLogLevel a_LogLevel) /*override*/ { switch (a_LogLevel) { @@ -125,7 +125,7 @@ } case cLogger::llInfo: { - // Yellow on black + // Yellow on black printf("\x1b[33;1m"); break; } @@ -133,7 +133,7 @@ { // Red on black printf("\x1b[31;1m"); - break; + break; } case cLogger::llError: { @@ -145,9 +145,9 @@ } - virtual void SetDefaultLogColour() override + virtual void SetDefaultLogColour() /*override*/ { - // Whatever the console default is + // Whatever the console default is printf("\x1b[0m"); } }; @@ -162,7 +162,7 @@ : public cLogger::cListener { public: - virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) override + virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) /*override*/ { android_LogPriority AndroidLogLevel; switch (a_LogLevel) @@ -202,7 +202,7 @@ class cVanillaCPPConsoleListener : public cLogger::cListener { public: - virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) override + virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) /*override*/ { AString LogLevelString; switch (a_LogLevel) diff --git a/src/LoggerListeners.h b/src/LoggerListeners.h index d300184b1..06019d0a4 100644 --- a/src/LoggerListeners.h +++ b/src/LoggerListeners.h @@ -13,7 +13,7 @@ public: cFileListener(); cFileListener(AString a_Filename); - virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) override; + virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) /*override*/; private: diff --git a/src/Map.cpp b/src/Map.cpp index 8f205a606..212e119dc 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -219,7 +219,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) cCalculatePixelCb(cMap * a_Map, int a_RelX, int a_RelZ) : m_Map(a_Map), m_RelX(a_RelX), m_RelZ(a_RelZ), m_PixelData(E_BASE_COLOR_TRANSPARENT) {} - virtual bool Item(cChunk * a_Chunk) override + virtual bool Item(cChunk * a_Chunk) /*override*/ { if (a_Chunk == NULL) { diff --git a/src/Mobs/Bat.h b/src/Mobs/Bat.h index 6b06aeb4f..2d65f1a7f 100644 --- a/src/Mobs/Bat.h +++ b/src/Mobs/Bat.h @@ -1,16 +1,16 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cBat : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: cBat(void); diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp index b4104d530..954bbfa6c 100644 --- a/src/Mobs/Blaze.cpp +++ b/src/Mobs/Blaze.cpp @@ -25,33 +25,3 @@ void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer) AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_BLAZE_ROD); } } - - - - - -void cBlaze::Attack(float a_Dt) -{ - m_AttackInterval += a_Dt * m_AttackRate; - - if (m_Target != NULL && m_AttackInterval > 3.0) - { - // Setting this higher gives us more wiggle room for attackrate - Vector3d Speed = GetLookVector() * 20; - Speed.y = Speed.y + 1; - cFireChargeEntity * FireCharge = new cFireChargeEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); - if (FireCharge == NULL) - { - return; - } - if (!FireCharge->Initialize(*m_World)) - { - delete FireCharge; - FireCharge = NULL; - return; - } - m_World->BroadcastSpawnEntity(*FireCharge); - m_AttackInterval = 0.0; - // ToDo: Shoot 3 fireballs instead of 1. - } -} diff --git a/src/Mobs/Blaze.h b/src/Mobs/Blaze.h index f283b1070..6698026e9 100644 --- a/src/Mobs/Blaze.h +++ b/src/Mobs/Blaze.h @@ -1,22 +1,21 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cBlaze : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cBlaze(void); CLASS_PROTODEF(cBlaze) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void Attack(float a_Dt) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/CMakeLists.txt b/src/Mobs/CMakeLists.txt index 2c092c15f..e0a55a17b 100644 --- a/src/Mobs/CMakeLists.txt +++ b/src/Mobs/CMakeLists.txt @@ -5,7 +5,6 @@ project (MCServer) include_directories ("${PROJECT_SOURCE_DIR}/../") SET (SRCS - AggressiveMonster.cpp Bat.cpp Blaze.cpp CaveSpider.cpp @@ -21,8 +20,6 @@ SET (SRCS MagmaCube.cpp Monster.cpp Mooshroom.cpp - PassiveAggressiveMonster.cpp - PassiveMonster.cpp Pig.cpp Sheep.cpp Skeleton.cpp @@ -38,7 +35,6 @@ SET (SRCS ZombiePigman.cpp) SET (HDRS - AggressiveMonster.h Bat.h Blaze.h CaveSpider.h @@ -56,8 +52,6 @@ SET (HDRS Monster.h Mooshroom.h Ocelot.h - PassiveAggressiveMonster.h - PassiveMonster.h Pig.h Sheep.h Silverfish.h @@ -75,4 +69,5 @@ SET (HDRS if(NOT MSVC) add_library(Mobs ${SRCS} ${HDRS}) + target_link_libraries(Mobs Components) endif() diff --git a/src/Mobs/CaveSpider.cpp b/src/Mobs/CaveSpider.cpp index 118a6e93b..09bb6c2f5 100644 --- a/src/Mobs/CaveSpider.cpp +++ b/src/Mobs/CaveSpider.cpp @@ -19,23 +19,6 @@ cCaveSpider::cCaveSpider(void) : void cCaveSpider::Tick(float a_Dt, cChunk & a_Chunk) { super::Tick(a_Dt, a_Chunk); - - m_EMPersonality = (GetWorld()->GetTimeOfDay() < (12000 + 1000)) ? PASSIVE : AGGRESSIVE; -} - - - - - -void cCaveSpider::Attack(float a_Dt) -{ - super::Attack(a_Dt); - - if (m_Target->IsPawn()) - { - // TODO: Easy = no poison, Medium = 7 seconds, Hard = 15 seconds - ((cPawn *) m_Target)->AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0); - } } diff --git a/src/Mobs/CaveSpider.h b/src/Mobs/CaveSpider.h index f9ed10e1b..25adcf3e0 100644 --- a/src/Mobs/CaveSpider.h +++ b/src/Mobs/CaveSpider.h @@ -1,24 +1,23 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cCaveSpider : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cCaveSpider(void); CLASS_PROTODEF(cCaveSpider) - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void Attack(float a_Dt) override; - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/Chicken.h b/src/Mobs/Chicken.h index b1a50b61c..a1e6f5ecf 100644 --- a/src/Mobs/Chicken.h +++ b/src/Mobs/Chicken.h @@ -1,25 +1,23 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cChicken : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: cChicken(void); CLASS_PROTODEF(cChicken) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - - virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_SEEDS); } + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; private: diff --git a/src/Mobs/Components/AIAggressiveComponent.cpp b/src/Mobs/Components/AIAggressiveComponent.cpp new file mode 100644 index 000000000..2963da7f0 --- /dev/null +++ b/src/Mobs/Components/AIAggressiveComponent.cpp @@ -0,0 +1,17 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules +#include "AIAggressiveComponent.h" + + + + + +cAIAggressiveComponent::cAIAggressiveComponent(cMonster * a_Monster) : cAIComponent(a_Monster){} + + + + + +void cAIAggressiveComponent::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); +} diff --git a/src/Mobs/Components/AIAggressiveComponent.h b/src/Mobs/Components/AIAggressiveComponent.h new file mode 100644 index 000000000..2cea452c5 --- /dev/null +++ b/src/Mobs/Components/AIAggressiveComponent.h @@ -0,0 +1,12 @@ +#pragma once +#include "AIComponent.h" + +class cEntity; + +class cAIAggressiveComponent : public cAIComponent { + typedef cAIComponent super; +protected: +public: + cAIAggressiveComponent(cMonster * a_Monster); + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; +}; diff --git a/src/Mobs/Components/AIComponent.cpp b/src/Mobs/Components/AIComponent.cpp new file mode 100644 index 000000000..12a89c201 --- /dev/null +++ b/src/Mobs/Components/AIComponent.cpp @@ -0,0 +1,367 @@ +#include "Globals.h" +#include "AIComponent.h" +#include "../Monster.h" + +#include "../../World.h" +#include "../../Entities/Player.h" +#include "../../Tracer.h" + +cAIComponent::cAIComponent(cMonster * a_Entity) : m_Self(a_Entity), m_Target(NULL), m_IdleInterval(0.0f), m_EMState(IDLE), m_bMovingToDestination(false) +{ + +} + +void cAIComponent::Tick(float a_Dt, cChunk & a_Chunk) +{ + if ((m_Target != NULL) && m_Target->IsDestroyed()) + m_Target = NULL; + + + a_Dt /= 1000; + + if (m_bMovingToDestination) + { + if (m_Self->GetEnvironmentComponent()->GetOnGround() && m_Self->GetMovementComponent()->DoesPosYRequireJump((int)floor(m_Destination.y))) + { + m_Self->GetEnvironmentComponent()->SetOnGround(false); + + // TODO: Change to AddSpeedY once collision detection is fixed - currently, mobs will go into blocks attempting to jump without a teleport + m_Self->AddPosY(1.2); // Jump!! + } + + Vector3f Distance = m_Destination - m_Self->GetPosition(); + if (!ReachedDestination() && !ReachedFinalDestination()) // If we haven't reached any sort of destination, move + { + Distance.y = 0; + Distance.Normalize(); + + if (m_Self->GetEnvironmentComponent()->GetOnGround()) + { + Distance *= 2.5f; + } + else if (m_Self->IsSwimming()) + { + Distance *= 1.3f; + } + else + { + // Don't let the mob move too much if he's falling. + Distance *= 0.25f; + } + + m_Self->AddSpeedX(Distance.x); + m_Self->AddSpeedZ(Distance.z); + + // It's too buggy! + /* + if (m_EMState == ESCAPING) + { + // Runs Faster when escaping :D otherwise they just walk away + SetSpeedX (GetSpeedX() * 2.f); + SetSpeedZ (GetSpeedZ() * 2.f); + } + */ + } + else + { + if (ReachedFinalDestination()) // If we have reached the ultimate, final destination, stop pathfinding and attack if appropriate + { + FinishPathFinding(); + } + else + { + TickPathFinding(); // We have reached the next point in our path, calculate another point + } + } + } + + SetPitchAndYawFromDestination(); + // HandleFalling(); + + switch (m_EMState) + { + case IDLE: + { + // If enemy passive we ignore checks for player visibility + InStateIdle(a_Dt); + break; + } + case CHASING: + { + // If we do not see a player anymore skip chasing action + InStateChasing(a_Dt); + break; + } + case ESCAPING: + { + InStateEscaping(a_Dt); + break; + } + + case ATTACKING: break; + } // switch (m_EMState) + + m_Self->BroadcastMovementUpdate(); +} + + + + + +void cAIComponent::SetPitchAndYawFromDestination() +{ + Vector3d FinalDestination = m_FinalDestination; + if (m_Target != NULL) + { + if (m_Target->IsPlayer()) + { + FinalDestination.y = ((cPlayer *)m_Target)->GetStance(); + } + else + { + FinalDestination.y = m_Self->GetHeight(); + } + } + + Vector3d Distance = FinalDestination - m_Self->GetPosition(); + if (Distance.SqrLength() > 0.1f) + { + { + double Rotation, Pitch; + Distance.Normalize(); + VectorToEuler(Distance.x, Distance.y, Distance.z, Rotation, Pitch); + m_Self->SetHeadYaw(Rotation); + m_Self->SetPitch(-Pitch); + } + + { + Vector3d BodyDistance = m_Destination - m_Self->GetPosition(); + double Rotation, Pitch; + Distance.Normalize(); + VectorToEuler(BodyDistance.x, BodyDistance.y, BodyDistance.z, Rotation, Pitch); + m_Self->SetYaw(Rotation); + } + } +} + + + + + +void cAIComponent::TickPathFinding() +{ + const int PosX = (int)floor(m_Self->GetPosX()); + const int PosY = (int)floor(m_Self->GetPosY()); + const int PosZ = (int)floor(m_Self->GetPosZ()); + + std::vector<Vector3d> m_PotentialCoordinates; + m_TraversedCoordinates.push_back(Vector3i(PosX, PosY, PosZ)); + + static const struct // Define which directions to try to move to + { + int x, z; + } gCrossCoords[] = + { + { 1, 0}, + {-1, 0}, + { 0, 1}, + { 0, -1}, + } ; + + if ((PosY - 1 < 0) || (PosY + 2 > cChunkDef::Height) /* PosY + 1 will never be true if PosY + 2 is not */) + { + // Too low/high, can't really do anything + FinishPathFinding(); + return; + } + + for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++) + { + if (IsCoordinateInTraversedList(Vector3i(gCrossCoords[i].x + PosX, PosY, gCrossCoords[i].z + PosZ))) + { + continue; + } + + BLOCKTYPE BlockAtY = m_Self->GetWorld()->GetBlock(gCrossCoords[i].x + PosX, PosY, gCrossCoords[i].z + PosZ); + BLOCKTYPE BlockAtYP = m_Self->GetWorld()->GetBlock(gCrossCoords[i].x + PosX, PosY + 1, gCrossCoords[i].z + PosZ); + BLOCKTYPE BlockAtYPP = m_Self->GetWorld()->GetBlock(gCrossCoords[i].x + PosX, PosY + 2, gCrossCoords[i].z + PosZ); + int LowestY = m_Self->GetMovementComponent()->FindFirstNonAirBlockPosition(gCrossCoords[i].x + PosX, gCrossCoords[i].z + PosZ); + BLOCKTYPE BlockAtLowestY = m_Self->GetWorld()->GetBlock(gCrossCoords[i].x + PosX, LowestY, gCrossCoords[i].z + PosZ); + + if ( + (!cBlockInfo::IsSolid(BlockAtY)) && + (!cBlockInfo::IsSolid(BlockAtYP)) && + (!IsBlockLava(BlockAtLowestY)) && + (BlockAtLowestY != E_BLOCK_CACTUS) && + (PosY - LowestY < 4) + ) + { + m_PotentialCoordinates.push_back(Vector3d((gCrossCoords[i].x + PosX), PosY, gCrossCoords[i].z + PosZ)); + } + else if ( + (cBlockInfo::IsSolid(BlockAtY)) && + (BlockAtY != E_BLOCK_CACTUS) && + (!cBlockInfo::IsSolid(BlockAtYP)) && + (!cBlockInfo::IsSolid(BlockAtYPP)) && + (BlockAtY != E_BLOCK_FENCE) && + (BlockAtY != E_BLOCK_FENCE_GATE) + ) + { + m_PotentialCoordinates.push_back(Vector3d((gCrossCoords[i].x + PosX), PosY + 1, gCrossCoords[i].z + PosZ)); + } + } + + if (!m_PotentialCoordinates.empty()) + { + Vector3f ShortestCoords = m_PotentialCoordinates.front(); + for (std::vector<Vector3d>::const_iterator itr = m_PotentialCoordinates.begin(); itr != m_PotentialCoordinates.end(); ++itr) + { + Vector3f Distance = m_FinalDestination - ShortestCoords; + Vector3f Distance2 = m_FinalDestination - *itr; + if (Distance.SqrLength() > Distance2.SqrLength()) + { + ShortestCoords = *itr; + } + } + + m_Destination = ShortestCoords; + m_Destination.z += 0.5f; + m_Destination.x += 0.5f; + } + else + { + FinishPathFinding(); + } +} + + + + + +bool cAIComponent::IsMovingToTargetPosition() +{ + // Difference between destination x and target x is negligible (to 10^-12 precision) + if (fabsf((float)m_FinalDestination.x - (float)m_Target->GetPosX()) < std::numeric_limits<float>::epsilon()) + { + return false; + } + // Difference between destination z and target z is negligible (to 10^-12 precision) + else if (fabsf((float)m_FinalDestination.z - (float)m_Target->GetPosZ()) > std::numeric_limits<float>::epsilon()) + { + return false; + } + return true; +} + + + + + +bool cAIComponent::ReachedFinalDestination() +{ + if ((m_Self->GetPosition() - m_FinalDestination).Length() <= m_Self->GetAttackComponent()->GetAttackRange()) + { + return true; + } + + return false; +} + + + + + +bool cAIComponent::ReachedDestination() +{ + if ((m_Destination - m_Self->GetPosition()).Length() < 0.5f) + { + return true; + } + + return false; +} + + + + + +void cAIComponent::MoveToPosition(const Vector3d & a_Position) +{ + FinishPathFinding(); + + m_FinalDestination = a_Position; + m_bMovingToDestination = true; + TickPathFinding(); +} + + + + + +void cAIComponent::InStateIdle(float a_Dt) +{ + if (m_bMovingToDestination) + { + return; // Still getting there + } + + m_IdleInterval += a_Dt; + + if (m_IdleInterval > 1) + { + // At this interval the results are predictable + int rem = m_Self->GetWorld()->GetTickRandomNumber(6) + 1; + m_IdleInterval -= 1; // So nothing gets dropped when the server hangs for a few seconds + + Vector3d Dist; + Dist.x = (double)m_Self->GetWorld()->GetTickRandomNumber(10) - 5; + Dist.z = (double)m_Self->GetWorld()->GetTickRandomNumber(10) - 5; + + if ((Dist.SqrLength() > 2) && (rem >= 3)) + { + Vector3d Destination(m_Self->GetPosX() + Dist.x, 0, m_Self->GetPosZ() + Dist.z); + + int NextHeight = m_Self->GetMovementComponent()->FindFirstNonAirBlockPosition(Destination.x, Destination.z); + + if (m_Self->GetMovementComponent()->IsNextYPosReachable(NextHeight)) + { + Destination.y = NextHeight; + MoveToPosition(Destination); + } + } + } +} + + + + + +// What to do if in Chasing State +// This state should always be defined in each child class +void cAIComponent::InStateChasing(float a_Dt) +{ + UNUSED(a_Dt); +} + + + + + +// What to do if in Escaping State +void cAIComponent::InStateEscaping(float a_Dt) +{ + UNUSED(a_Dt); + + if (m_Target != NULL) + { + int sight_distance = m_Self->GetEnvironmentComponent()->GetSightDistance(); + Vector3d newloc = m_Self->GetPosition(); + newloc.x = (m_Target->GetPosition().x < newloc.x)? (newloc.x + sight_distance): (newloc.x - sight_distance); + newloc.z = (m_Target->GetPosition().z < newloc.z)? (newloc.z + sight_distance): (newloc.z - sight_distance); + MoveToPosition(newloc); + } + else + { + m_EMState = IDLE; // This shouldnt be required but just to be safe + } +} diff --git a/src/Mobs/Components/AIComponent.h b/src/Mobs/Components/AIComponent.h new file mode 100644 index 000000000..c4cf15d14 --- /dev/null +++ b/src/Mobs/Components/AIComponent.h @@ -0,0 +1,61 @@ +#pragma once + +class cMonster; +class cEntity; +class cChunk; + +class cAIComponent +{ +protected: + cMonster * m_Self; + cEntity * m_Target; + float m_IdleInterval; + + enum MState{ATTACKING, IDLE, CHASING, ESCAPING} m_EMState; + + /** Coordinates of the next position that should be reached */ + Vector3d m_Destination; + /** Coordinates for the ultimate, final destination. */ + Vector3d m_FinalDestination; + /** A semi-temporary list to store the traversed coordinates during active pathfinding so we don't visit them again */ + std::vector<Vector3i> m_TraversedCoordinates; + + /** Stores if mobile is currently moving towards the ultimate, final destination */ + bool m_bMovingToDestination; + + /********** + * Pathfinding + **********/ + inline void FinishPathFinding(void) + { + m_TraversedCoordinates.clear(); + m_bMovingToDestination = false; + } + /** Finds the next place to go + This is based on the ultimate, final destination and the current position, as well as the traversed coordinates, and any environmental hazards */ + void TickPathFinding(void); + + inline bool IsCoordinateInTraversedList(Vector3i a_Coords) + { + return (std::find(m_TraversedCoordinates.begin(), m_TraversedCoordinates.end(), a_Coords) != m_TraversedCoordinates.end()); + } + bool IsMovingToTargetPosition(); + bool ReachedFinalDestination(); + virtual bool ReachedDestination(void); + virtual void MoveToPosition(const Vector3d & a_Position); + void SetPitchAndYawFromDestination(); + + /********** + * Event Management + **********/ + // void EventLosePlayer(void); + // virtual void EventSeePlayer(cEntity * a_Entity); + virtual void InStateIdle (float a_Dt); + virtual void InStateChasing (float a_Dt); + virtual void InStateEscaping(float a_Dt); +public: + cAIComponent(cMonster * a_Entity); + virtual ~cAIComponent(){} + + virtual void Tick(float a_Dt, cChunk & a_Chunk); +}; diff --git a/src/Mobs/Components/AIPassiveAgressiveComponent.cpp b/src/Mobs/Components/AIPassiveAgressiveComponent.cpp new file mode 100644 index 000000000..efa88a8fa --- /dev/null +++ b/src/Mobs/Components/AIPassiveAgressiveComponent.cpp @@ -0,0 +1,17 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules +#include "cAIPassiveAggressiveComponent.h" + + + + + +cAIPassiveAggressiveComponent::cAIPassiveAggressiveComponent(cMonster * a_Monster) : cAIComponent(a_Monster){} + + + + + +void cAIPassiveAggressiveComponent::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); +} diff --git a/src/Mobs/Components/AIPassiveAgressiveComponent.h b/src/Mobs/Components/AIPassiveAgressiveComponent.h new file mode 100644 index 000000000..bd35251d0 --- /dev/null +++ b/src/Mobs/Components/AIPassiveAgressiveComponent.h @@ -0,0 +1,12 @@ +#pragma once +#include "AIComponent.h" + +class cEntity; + +class cAIPassiveAggressiveComponent : public cAIComponent { + typedef cAIComponent super; +protected: +public: + cAIPassiveAggressiveComponent(cMonster * a_Monster); + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; +}; diff --git a/src/Mobs/Components/AIPassiveComponent.cpp b/src/Mobs/Components/AIPassiveComponent.cpp new file mode 100644 index 000000000..ba3fe7ec7 --- /dev/null +++ b/src/Mobs/Components/AIPassiveComponent.cpp @@ -0,0 +1,17 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules +#include "AIPassiveComponent.h" + + + + + +cAIPassiveComponent::cAIPassiveComponent(cMonster * a_Monster) : cAIComponent(a_Monster){} + + + + + +void cAIPassiveComponent::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); +}
\ No newline at end of file diff --git a/src/Mobs/Components/AIPassiveComponent.h b/src/Mobs/Components/AIPassiveComponent.h new file mode 100644 index 000000000..ab2e5afdb --- /dev/null +++ b/src/Mobs/Components/AIPassiveComponent.h @@ -0,0 +1,12 @@ +#pragma once +#include "AIComponent.h" + +class cEntity; + +class cAIPassiveComponent : public cAIComponent { + typedef cAIComponent super; +protected: +public: + cAIPassiveComponent(cMonster * a_Monster); + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; +}; diff --git a/src/Mobs/Components/AllComponents.h b/src/Mobs/Components/AllComponents.h new file mode 100644 index 000000000..e99d08cc4 --- /dev/null +++ b/src/Mobs/Components/AllComponents.h @@ -0,0 +1,8 @@ +#pragma once + +#include "AIComponent.h" +#include "AttackComponent.h" +#include "EnvironmentComponent.h" +#include "MovementComponent.h" + +#include "AIAggressiveComponent.h" diff --git a/src/Mobs/Components/AttackComponent.cpp b/src/Mobs/Components/AttackComponent.cpp new file mode 100644 index 000000000..ae721f00b --- /dev/null +++ b/src/Mobs/Components/AttackComponent.cpp @@ -0,0 +1,5 @@ +#include "Globals.h" +#include "AttackComponent.h" +#include "../Monster.h" + +cAttackComponent::cAttackComponent(cMonster * a_Entity) : m_Self(a_Entity){} diff --git a/src/Mobs/Components/AttackComponent.h b/src/Mobs/Components/AttackComponent.h new file mode 100644 index 000000000..6a6932bd3 --- /dev/null +++ b/src/Mobs/Components/AttackComponent.h @@ -0,0 +1,32 @@ +#pragma once + +class cMonster; +class cEntity; +class cChunk; + +class cAttackComponent +{ +protected: + cMonster * m_Self; + float m_AttackRate; + int m_AttackDamage; + int m_AttackRange; + float m_AttackInterval; +public: + cAttackComponent(cMonster * a_Entity); + virtual ~cAttackComponent(){} + + virtual void Tick(float a_Dt, cChunk & a_Chunk){} + + // Get Functions + int GetAttackRate() { return (int)m_AttackRate; } + int GetAttackRange() { return m_AttackRange; } + int GetAttackDamage() { return m_AttackDamage; } + float GetAttackInterval() { return m_AttackInterval; } + + // Set Functions + void SetAttackRate(float a_AttackRate) { m_AttackRate = a_AttackRate; } + void SetAttackRange(int a_AttackRange) { m_AttackRange = a_AttackRange; } + void SetAttackDamage(int a_AttackDamage) { m_AttackDamage = a_AttackDamage; } + void SetAttackInterval(float a_AttackInterval) { m_AttackInterval = a_AttackInterval; } +}; diff --git a/src/Mobs/Components/CMakeLists.txt b/src/Mobs/Components/CMakeLists.txt new file mode 100644 index 000000000..a933dc9e0 --- /dev/null +++ b/src/Mobs/Components/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required (VERSION 2.6) +project (MCServer) + +include_directories ("${PROJECT_SOURCE_DIR}/../") + +SET (SRCS + AIComponent.cpp + AIAggressiveComponent.cpp + AttackComponent.cpp + EnvironmentComponent.cpp + MovementComponent.cpp) + +SET (HDRS + AIComponent.h + AIAggressiveComponent.h + AttackComponent.h + EnvironmentComponent.h + MovementComponent.h) + +if(NOT MSVC) + add_library(Components ${SRCS} ${HDRS}) +endif()
\ No newline at end of file diff --git a/src/Mobs/Components/EnvironmentComponent.cpp b/src/Mobs/Components/EnvironmentComponent.cpp new file mode 100644 index 000000000..b44542683 --- /dev/null +++ b/src/Mobs/Components/EnvironmentComponent.cpp @@ -0,0 +1,58 @@ +#include "Globals.h" +#include "EnvironmentComponent.h" +#include "../Monster.h" +#include "../../World.h" +#include "../../Chunk.h" + +cEnvironmentComponent::cEnvironmentComponent(cMonster * a_Entity, int a_SightDistance) : m_Self(a_Entity), m_SightDistance(a_SightDistance){} + + + + + +void cEnvironmentComponent::Tick(float a_Dt, cChunk & a_Chunk) { + + // Burning in daylight + HandleDaylightBurning(a_Chunk); +} + + + + + +void cEnvironmentComponent::HandleDaylightBurning(cChunk & a_Chunk) +{ + if (!m_BurnsInDaylight) + { + return; + } + + int RelY = (int)floor(m_Self->GetPosY()); + if ((RelY < 0) || (RelY >= cChunkDef::Height)) + { + // Outside the world + return; + } + int PosX = (int)floor(m_Self->GetPosX()); + int PosZ = (int)floor(m_Self->GetPosX()); + int RelX = PosX - m_Self->GetChunkX() * cChunkDef::Width; + int RelZ = PosZ - m_Self->GetChunkZ() * cChunkDef::Width; + + if (!a_Chunk.IsLightValid()) + { + m_Self->GetWorld()->QueueLightChunk(m_Self->GetChunkX(), m_Self->GetChunkZ()); + return; + } + + if ( + (a_Chunk.GetSkyLight(RelX, RelY, RelZ) == 15) && // In the daylight + (a_Chunk.GetBlock(RelX, RelY, RelZ) != E_BLOCK_SOULSAND) && // Not on soulsand + (m_Self->GetWorld()->GetTimeOfDay() < (12000 + 1000)) && // It is nighttime + !m_Self->IsOnFire() && // Not already burning + m_Self->GetWorld()->IsWeatherWetAt(PosX, PosZ) // Not raining + ) + { + // Burn for 100 ticks, then decide again + m_Self->StartBurning(100); + } +} diff --git a/src/Mobs/Components/EnvironmentComponent.h b/src/Mobs/Components/EnvironmentComponent.h new file mode 100644 index 000000000..078e81501 --- /dev/null +++ b/src/Mobs/Components/EnvironmentComponent.h @@ -0,0 +1,33 @@ +#pragma once + +class cMonster; +class cEntity; +class cChunk; + +class cEnvironmentComponent +{ +protected: + cMonster * m_Self; + int m_SightDistance; + bool m_OnGround; + + bool m_BurnsInDaylight; +public: + cEnvironmentComponent(cMonster * a_Entity, int a_SightDistance); + virtual ~cEnvironmentComponent(){} + + virtual void Tick(float a_Dt, cChunk & a_Chunk); + + // Get Functions + int GetSightDistance() { return m_SightDistance ; } + bool GetOnGround() { return m_OnGround; } + bool GetBurnsInDaylight() { return m_BurnsInDaylight; } + + // Set Functions + void SetSightDistance(int a_SightDistance) { m_SightDistance = a_SightDistance; } + void SetOnGround(bool a_Bool) { m_OnGround = a_Bool; } + void SetBurnsInDaylight(bool a_Bool) { m_BurnsInDaylight = a_Bool; } + + // Handle functions + void HandleDaylightBurning(cChunk & a_Chunk); +}; diff --git a/src/Mobs/Components/MovementComponent.cpp b/src/Mobs/Components/MovementComponent.cpp new file mode 100644 index 000000000..e808e2948 --- /dev/null +++ b/src/Mobs/Components/MovementComponent.cpp @@ -0,0 +1,50 @@ +#include "Globals.h" +#include "MovementComponent.h" +#include "../Monster.h" + +#include "../../World.h" + +cMovementComponent::cMovementComponent(cMonster * a_Entity) : m_Self(a_Entity){} + + +int cMovementComponent::FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ) +{ + int PosY = (int)floor(m_Self->GetPosY()); + PosY = Clamp(PosY, 0, cChunkDef::Height); + + if (!cBlockInfo::IsSolid(m_Self->GetWorld()->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ)))) + { + while (!cBlockInfo::IsSolid(m_Self->GetWorld()->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))) && (PosY > 0)) + { + PosY--; + } + + return PosY + 1; + } + else + { + while (cBlockInfo::IsSolid(m_Self->GetWorld()->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))) && (PosY < cChunkDef::Height)) + { + PosY++; + } + + return PosY; + } +} + + + + + +bool cMovementComponent::IsNextYPosReachable(int a_PosY) +{ + return ( + (a_PosY <= (int)floor(m_Self->GetPosY())) || + DoesPosYRequireJump(a_PosY) + ); +} +/** Returns if a monster can reach a given height by jumping */ +bool cMovementComponent::DoesPosYRequireJump(int a_PosY) +{ + return ((a_PosY > (int)floor(m_Self->GetPosY())) && (a_PosY == (int)floor(m_Self->GetPosY()) + 1)); +} diff --git a/src/Mobs/Components/MovementComponent.h b/src/Mobs/Components/MovementComponent.h new file mode 100644 index 000000000..ffb840f76 --- /dev/null +++ b/src/Mobs/Components/MovementComponent.h @@ -0,0 +1,25 @@ +#pragma once + +class cMonster; +class cEntity; +class cChunk; + +class cMovementComponent +{ +protected: + cMonster * m_Self; +public: + cMovementComponent(cMonster * a_Entity); + virtual ~cMovementComponent(){} + + virtual void Tick(float a_Dt, cChunk & a_Chunk){} + + /** Finds the first non-air block position (not the highest, as cWorld::GetHeight does) + If current Y is nonsolid, goes down to try to find a solid block, then returns that + 1 + If current Y is solid, goes up to find first nonsolid block, and returns that */ + int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ); + /** Returns if a monster can actually reach a given height by jumping or walking */ + bool IsNextYPosReachable(int a_PosY); + /** Returns if a monster can reach a given height by jumping */ + bool DoesPosYRequireJump(int a_PosY); +}; diff --git a/src/Mobs/Cow.cpp b/src/Mobs/Cow.cpp index 9914df6b5..391abd453 100644 --- a/src/Mobs/Cow.cpp +++ b/src/Mobs/Cow.cpp @@ -31,18 +31,3 @@ void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer) } - - - -void cCow::OnRightClicked(cPlayer & a_Player) -{ - if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_BUCKET)) - { - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - a_Player.GetInventory().AddItem(E_ITEM_MILK); - } - } -} - diff --git a/src/Mobs/Cow.h b/src/Mobs/Cow.h index 8814b7e09..ab86dafb4 100644 --- a/src/Mobs/Cow.h +++ b/src/Mobs/Cow.h @@ -1,27 +1,23 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cCow : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: cCow(); CLASS_PROTODEF(cCow) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void OnRightClicked(cPlayer & a_Player) override; - - virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_WHEAT); } - + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp index 02718edf8..354910bf7 100644 --- a/src/Mobs/Creeper.cpp +++ b/src/Mobs/Creeper.cpp @@ -5,6 +5,7 @@ #include "../World.h" #include "../Entities/ProjectileEntity.h" #include "../Entities/Player.h" +#include "../Entities/Entity.h" @@ -14,7 +15,7 @@ cCreeper::cCreeper(void) : super("Creeper", mtCreeper, "mob.creeper.say", "mob.creeper.say", 0.6, 1.8), m_bIsBlowing(false), m_bIsCharged(false), - m_BurnedWithFlintAndSteel(false), + // m_BurnedWithFlintAndSteel(false), m_ExplodingTimer(0) { } @@ -23,35 +24,6 @@ cCreeper::cCreeper(void) : -void cCreeper::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - - if (!ReachedFinalDestination() && !m_BurnedWithFlintAndSteel) - { - m_ExplodingTimer = 0; - m_bIsBlowing = false; - m_World->BroadcastEntityMetadata(*this); - } - else - { - if (m_bIsBlowing) - { - m_ExplodingTimer += 1; - } - - if (m_ExplodingTimer == 30) - { - m_World->DoExplosionAt((m_bIsCharged ? 5 : 3), GetPosX(), GetPosY(), GetPosZ(), false, esMonster, this); - Destroy(); // Just in case we aren't killed by the explosion - } - } -} - - - - - void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer) { if (m_ExplodingTimer == 30) @@ -76,7 +48,7 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer) { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { if (a_Entity->IsMob() && ((cMonster *)a_Entity)->GetMobType() == mtSkeleton) { @@ -95,58 +67,3 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer) } } - - - - -bool cCreeper::DoTakeDamage(TakeDamageInfo & a_TDI) -{ - if (!super::DoTakeDamage(a_TDI)) - { - return false; - } - - if (a_TDI.DamageType == dtLightning) - { - m_bIsCharged = true; - } - - m_World->BroadcastEntityMetadata(*this); - return true; -} - - - - - -void cCreeper::Attack(float a_Dt) -{ - UNUSED(a_Dt); - - if (!m_bIsBlowing) - { - m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); - m_bIsBlowing = true; - m_World->BroadcastEntityMetadata(*this); - } -} - - - - - -void cCreeper::OnRightClicked(cPlayer & a_Player) -{ - if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_FLINT_AND_STEEL)) - { - if (!a_Player.IsGameModeCreative()) - { - a_Player.UseEquippedItem(); - } - m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); - m_bIsBlowing = true; - m_World->BroadcastEntityMetadata(*this); - m_BurnedWithFlintAndSteel = true; - } -} - diff --git a/src/Mobs/Creeper.h b/src/Mobs/Creeper.h index 747daca09..10ff3d249 100644 --- a/src/Mobs/Creeper.h +++ b/src/Mobs/Creeper.h @@ -1,34 +1,30 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cCreeper : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cCreeper(void); CLASS_PROTODEF(cCreeper) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; - virtual void Attack(float a_Dt) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void OnRightClicked(cPlayer & a_Player) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; bool IsBlowing(void) const {return m_bIsBlowing; } bool IsCharged(void) const {return m_bIsCharged; } private: - bool m_bIsBlowing, m_bIsCharged, m_BurnedWithFlintAndSteel; + bool m_bIsBlowing, m_bIsCharged/*, m_BurnedWithFlintAndSteel*/; int m_ExplodingTimer; } ; diff --git a/src/Mobs/EnderDragon.h b/src/Mobs/EnderDragon.h index 1d4cd657c..b75bdb5a5 100644 --- a/src/Mobs/EnderDragon.h +++ b/src/Mobs/EnderDragon.h @@ -1,23 +1,23 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cEnderDragon : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cEnderDragon(void); CLASS_PROTODEF(cEnderDragon) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp index 51255beb3..8a2803492 100644 --- a/src/Mobs/Enderman.cpp +++ b/src/Mobs/Enderman.cpp @@ -8,74 +8,6 @@ -//////////////////////////////////////////////////////////////////////////////// -// cPlayerLookCheck -class cPlayerLookCheck : - public cPlayerListCallback -{ -public: - cPlayerLookCheck(Vector3d a_EndermanPos, int a_SightDistance) : - m_Player(NULL), - m_EndermanPos(a_EndermanPos), - m_SightDistance(a_SightDistance) - { - } - - virtual bool Item(cPlayer * a_Player) override - { - // Don't check players who are in creative gamemode - if (a_Player->IsGameModeCreative()) - { - return false; - } - - Vector3d Direction = m_EndermanPos - a_Player->GetPosition(); - - // Don't check players who are more then SightDistance (64) blocks away - if (Direction.Length() > m_SightDistance) - { - return false; - } - - // Don't check if the player has a pumpkin on his head - if (a_Player->GetEquippedHelmet().m_ItemType == E_BLOCK_PUMPKIN) - { - return false; - } - - - Vector3d LookVector = a_Player->GetLookVector(); - double dot = Direction.Dot(LookVector); - - // 0.09 rad ~ 5 degrees - // If the player's crosshair is within 5 degrees of the enderman, it counts as looking - if (dot <= cos(0.09)) - { - return false; - } - - cTracer LineOfSight(a_Player->GetWorld()); - if (LineOfSight.Trace(m_EndermanPos, Direction, (int)Direction.Length())) - { - // No direct line of sight - return false; - } - - m_Player = a_Player; - return true; - } - - cPlayer * GetPlayer(void) const { return m_Player; } - -protected: - cPlayer * m_Player; - Vector3d m_EndermanPos; - int m_SightDistance; -} ; - - - - cEnderman::cEnderman(void) : super("Enderman", mtEnderman, "mob.endermen.hit", "mob.endermen.death", 0.5, 2.9), @@ -98,86 +30,3 @@ void cEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer) } AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ENDER_PEARL); } - - - - -void cEnderman::CheckEventSeePlayer() -{ - if (m_Target != NULL) - { - return; - } - - cPlayerLookCheck Callback(GetPosition(), m_SightDistance); - if (m_World->ForEachPlayer(Callback)) - { - return; - } - - ASSERT(Callback.GetPlayer() != NULL); - - if (!CheckLight()) - { - // Insufficient light for enderman to become aggravated - // TODO: Teleport to a suitable location - return; - } - - if (!Callback.GetPlayer()->IsGameModeCreative()) - { - super::EventSeePlayer(Callback.GetPlayer()); - m_EMState = CHASING; - m_bIsScreaming = true; - GetWorld()->BroadcastEntityMetadata(*this); - } -} - - - - - -void cEnderman::CheckEventLostPlayer(void) -{ - super::CheckEventLostPlayer(); - if (!CheckLight()) - { - EventLosePlayer(); - } -} - - - - - -void cEnderman::EventLosePlayer() -{ - super::EventLosePlayer(); - m_bIsScreaming = false; - GetWorld()->BroadcastEntityMetadata(*this); -} - - - - - -bool cEnderman::CheckLight() -{ - int ChunkX, ChunkZ; - cChunkDef::BlockToChunk(POSX_TOINT, POSZ_TOINT, ChunkX, ChunkZ); - - // Check if the chunk the enderman is in is lit - if (!m_World->IsChunkLighted(ChunkX, ChunkZ)) - { - m_World->QueueLightChunk(ChunkX, ChunkZ); - return true; - } - - // Enderman only attack if the skylight is lower or equal to 8 - if (m_World->GetBlockSkyLight(POSX_TOINT, POSY_TOINT, POSZ_TOINT) - GetWorld()->GetSkyDarkness() > 8) - { - return false; - } - - return true; -} diff --git a/src/Mobs/Enderman.h b/src/Mobs/Enderman.h index 4583746e7..b7a547c67 100644 --- a/src/Mobs/Enderman.h +++ b/src/Mobs/Enderman.h @@ -1,34 +1,28 @@ #pragma once -#include "PassiveAggressiveMonster.h" +#include "Monster.h" class cEnderman : - public cPassiveAggressiveMonster + public cMonster { - typedef cPassiveAggressiveMonster super; + typedef cMonster super; public: cEnderman(void); CLASS_PROTODEF(cEnderman) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void CheckEventSeePlayer(void) override; - virtual void CheckEventLostPlayer(void) override; - virtual void EventLosePlayer(void) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; bool IsScreaming(void) const {return m_bIsScreaming; } BLOCKTYPE GetCarriedBlock(void) const {return CarriedBlock; } NIBBLETYPE GetCarriedMeta(void) const {return CarriedMeta; } - /** Returns if the current sky light level is sufficient for the enderman to become aggravated */ - bool CheckLight(void); - private: bool m_bIsScreaming; diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp index 6aac14779..4bea6dd0d 100644 --- a/src/Mobs/Ghast.cpp +++ b/src/Mobs/Ghast.cpp @@ -30,32 +30,3 @@ void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer) - - -void cGhast::Attack(float a_Dt) -{ - m_AttackInterval += a_Dt * m_AttackRate; - - if (m_Target != NULL && m_AttackInterval > 3.0) - { - // Setting this higher gives us more wiggle room for attackrate - Vector3d Speed = GetLookVector() * 20; - Speed.y = Speed.y + 1; - cGhastFireballEntity * GhastBall = new cGhastFireballEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); - if (GhastBall == NULL) - { - return; - } - if (!GhastBall->Initialize(*m_World)) - { - delete GhastBall; - GhastBall = NULL; - return; - } - m_World->BroadcastSpawnEntity(*GhastBall); - m_AttackInterval = 0.0; - } -} - - - diff --git a/src/Mobs/Ghast.h b/src/Mobs/Ghast.h index 1d4e6b94a..a7579e9aa 100644 --- a/src/Mobs/Ghast.h +++ b/src/Mobs/Ghast.h @@ -1,24 +1,23 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cGhast : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cGhast(void); CLASS_PROTODEF(cGhast) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void Attack(float a_Dt) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; bool IsCharging(void) const {return false; } } ; diff --git a/src/Mobs/Giant.h b/src/Mobs/Giant.h index 7c04c9b4f..bf291d647 100644 --- a/src/Mobs/Giant.h +++ b/src/Mobs/Giant.h @@ -1,23 +1,23 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cGiant : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cGiant(void); CLASS_PROTODEF(cGiant) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp index 67a09d4ab..48bd9fef5 100644 --- a/src/Mobs/Horse.cpp +++ b/src/Mobs/Horse.cpp @@ -90,54 +90,6 @@ void cHorse::Tick(float a_Dt, cChunk & a_Chunk) -void cHorse::OnRightClicked(cPlayer & a_Player) -{ - if (!m_bIsSaddled && m_bIsTame) - { - if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE) - { - // Saddle the horse: - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - } - m_bIsSaddled = true; - m_World->BroadcastEntityMetadata(*this); - } - else if (!a_Player.GetEquippedItem().IsEmpty()) - { - // The horse doesn't like being hit, make it rear: - m_bIsRearing = true; - m_RearTickCount = 0; - } - } - else - { - if (m_Attachee != NULL) - { - if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID()) - { - a_Player.Detach(); - return; - } - - if (m_Attachee->IsPlayer()) - { - return; - } - - m_Attachee->Detach(); - } - - m_TameAttemptTimes++; - a_Player.AttachTo(this); - } -} - - - - - void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer) { int LootingLevel = 0; diff --git a/src/Mobs/Horse.h b/src/Mobs/Horse.h index 47189b3b0..e1023f3f2 100644 --- a/src/Mobs/Horse.h +++ b/src/Mobs/Horse.h @@ -1,25 +1,24 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cHorse : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: cHorse(int Type, int Color, int Style, int TameTimes); CLASS_PROTODEF(cHorse) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void OnRightClicked(cPlayer & a_Player) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; bool IsSaddled (void) const {return m_bIsSaddled; } bool IsChested (void) const {return m_bHasChest; } diff --git a/src/Mobs/IronGolem.h b/src/Mobs/IronGolem.h index c5341ed76..381bfff4d 100644 --- a/src/Mobs/IronGolem.h +++ b/src/Mobs/IronGolem.h @@ -1,27 +1,23 @@ #pragma once -#include "PassiveAggressiveMonster.h" +#include "Monster.h" class cIronGolem : - public cPassiveAggressiveMonster + public cMonster { - typedef cPassiveAggressiveMonster super; + typedef cMonster super; public: cIronGolem(void); CLASS_PROTODEF(cIronGolem) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - - // Iron golems do not drown nor float - virtual void HandleAir(void) override {} - virtual void SetSwimState(cChunk & a_Chunk) override {} + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h index bfe63fa2e..28be7e77f 100644 --- a/src/Mobs/MagmaCube.h +++ b/src/Mobs/MagmaCube.h @@ -1,15 +1,15 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cMagmaCube : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest @@ -17,7 +17,7 @@ public: CLASS_PROTODEF(cMagmaCube) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; int GetSize(void) const { return m_Size; } protected: diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index f7ee0b0c0..029930266 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -1,17 +1,9 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - +#include "Monster.h" #include "IncludeAllMonsters.h" -#include "../Root.h" -#include "../Server.h" #include "../ClientHandle.h" -#include "../World.h" -#include "../Entities/Player.h" -#include "../Entities/ExpOrb.h" -#include "../MonsterConfig.h" #include "../MersenneTwister.h" - -#include "../Chunk.h" #include "../FastRandom.h" @@ -62,190 +54,26 @@ static const struct -//////////////////////////////////////////////////////////////////////////////// -// cMonster: - cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) : super(etMonster, a_Width, a_Height) - , m_EMState(IDLE) - , m_EMPersonality(AGGRESSIVE) - , m_Target(NULL) - , m_bMovingToDestination(false) - , m_LastGroundHeight(POSY_TOINT) - , m_IdleInterval(0) - , m_DestroyTimer(0) , m_MobType(a_MobType) , m_SoundHurt(a_SoundHurt) , m_SoundDeath(a_SoundDeath) - , m_AttackRate(3) - , m_AttackDamage(1) - , m_AttackRange(2) - , m_AttackInterval(0) - , m_SightDistance(25) - , m_DropChanceWeapon(0.085f) - , m_DropChanceHelmet(0.085f) - , m_DropChanceChestplate(0.085f) - , m_DropChanceLeggings(0.085f) - , m_DropChanceBoots(0.085f) - , m_CanPickUpLoot(true) - , m_BurnsInDaylight(false) -{ - if (!a_ConfigName.empty()) - { - GetMonsterConfig(a_ConfigName); - } -} - - - - - -void cMonster::SpawnOn(cClientHandle & a_Client) -{ - a_Client.SendSpawnMob(*this); -} - - - - - -void cMonster::TickPathFinding() -{ - const int PosX = POSX_TOINT; - const int PosY = POSY_TOINT; - const int PosZ = POSZ_TOINT; - - std::vector<Vector3d> m_PotentialCoordinates; - m_TraversedCoordinates.push_back(Vector3i(PosX, PosY, PosZ)); - - static const struct // Define which directions to try to move to - { - int x, z; - } gCrossCoords[] = - { - { 1, 0}, - {-1, 0}, - { 0, 1}, - { 0, -1}, - } ; - - if ((PosY - 1 < 0) || (PosY + 2 > cChunkDef::Height) /* PosY + 1 will never be true if PosY + 2 is not */) - { - // Too low/high, can't really do anything - FinishPathFinding(); - return; - } - - for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++) - { - if (IsCoordinateInTraversedList(Vector3i(gCrossCoords[i].x + PosX, PosY, gCrossCoords[i].z + PosZ))) - { - continue; - } - - BLOCKTYPE BlockAtY = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY, gCrossCoords[i].z + PosZ); - BLOCKTYPE BlockAtYP = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY + 1, gCrossCoords[i].z + PosZ); - BLOCKTYPE BlockAtYPP = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY + 2, gCrossCoords[i].z + PosZ); - int LowestY = FindFirstNonAirBlockPosition(gCrossCoords[i].x + PosX, gCrossCoords[i].z + PosZ); - BLOCKTYPE BlockAtLowestY = m_World->GetBlock(gCrossCoords[i].x + PosX, LowestY, gCrossCoords[i].z + PosZ); - - if ( - (!cBlockInfo::IsSolid(BlockAtY)) && - (!cBlockInfo::IsSolid(BlockAtYP)) && - (!IsBlockLava(BlockAtLowestY)) && - (BlockAtLowestY != E_BLOCK_CACTUS) && - (PosY - LowestY < FALL_DAMAGE_HEIGHT) - ) - { - m_PotentialCoordinates.push_back(Vector3d((gCrossCoords[i].x + PosX), PosY, gCrossCoords[i].z + PosZ)); - } - else if ( - (cBlockInfo::IsSolid(BlockAtY)) && - (BlockAtY != E_BLOCK_CACTUS) && - (!cBlockInfo::IsSolid(BlockAtYP)) && - (!cBlockInfo::IsSolid(BlockAtYPP)) && - (BlockAtY != E_BLOCK_FENCE) && - (BlockAtY != E_BLOCK_FENCE_GATE) - ) - { - m_PotentialCoordinates.push_back(Vector3d((gCrossCoords[i].x + PosX), PosY + 1, gCrossCoords[i].z + PosZ)); - } - } - - if (!m_PotentialCoordinates.empty()) - { - Vector3f ShortestCoords = m_PotentialCoordinates.front(); - for (std::vector<Vector3d>::const_iterator itr = m_PotentialCoordinates.begin(); itr != m_PotentialCoordinates.end(); ++itr) - { - Vector3f Distance = m_FinalDestination - ShortestCoords; - Vector3f Distance2 = m_FinalDestination - *itr; - if (Distance.SqrLength() > Distance2.SqrLength()) - { - ShortestCoords = *itr; - } - } - - m_Destination = ShortestCoords; - m_Destination.z += 0.5f; - m_Destination.x += 0.5f; - } - else - { - FinishPathFinding(); - } -} - - - - - -void cMonster::MoveToPosition(const Vector3d & a_Position) -{ - FinishPathFinding(); - - m_FinalDestination = a_Position; - m_bMovingToDestination = true; - TickPathFinding(); -} - - - -bool cMonster::IsCoordinateInTraversedList(Vector3i a_Coords) -{ - return (std::find(m_TraversedCoordinates.begin(), m_TraversedCoordinates.end(), a_Coords) != m_TraversedCoordinates.end()); -} - - - - - -bool cMonster::ReachedDestination() + , m_DestroyTimer(0.0f) { - if ((m_Destination - GetPosition()).Length() < 0.5f) - { - return true; - } - - return false; -} - - - + m_AI = new cAIAggressiveComponent(this); + m_Attack = new cAttackComponent(this); + m_Environment = new cEnvironmentComponent(this, 16); + m_Movement = new cMovementComponent(this); -bool cMonster::ReachedFinalDestination() -{ - if ((GetPosition() - m_FinalDestination).Length() <= m_AttackRange) - { - return true; - } - - return false; + // Temporary placement till I figure out where to put it + m_DropChanceWeapon = 0.0f; + m_DropChanceHelmet = 0.0f; + m_DropChanceChestplate = 0.0f; + m_DropChanceLeggings = 0.0f; + m_DropChanceBoots = 0.0f; } - - - - void cMonster::Tick(float a_Dt, cChunk & a_Chunk) { super::Tick(a_Dt, a_Chunk); @@ -261,325 +89,58 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk) return; } - if ((m_Target != NULL) && m_Target->IsDestroyed()) - m_Target = NULL; - - // Burning in daylight - HandleDaylightBurning(a_Chunk); - - a_Dt /= 1000; - - if (m_bMovingToDestination) - { - if (m_bOnGround) - { - if (DoesPosYRequireJump((int)floor(m_Destination.y))) - { - m_bOnGround = false; - - // TODO: Change to AddSpeedY once collision detection is fixed - currently, mobs will go into blocks attempting to jump without a teleport - AddPosY(1.2); // Jump!! - } - } - - Vector3f Distance = m_Destination - GetPosition(); - if (!ReachedDestination() && !ReachedFinalDestination()) // If we haven't reached any sort of destination, move - { - Distance.y = 0; - Distance.Normalize(); - - if (m_bOnGround) - { - Distance *= 2.5f; - } - else if (IsSwimming()) - { - Distance *= 1.3f; - } - else - { - // Don't let the mob move too much if he's falling. - Distance *= 0.25f; - } - - AddSpeedX(Distance.x); - AddSpeedZ(Distance.z); - - // It's too buggy! - /* - if (m_EMState == ESCAPING) - { - // Runs Faster when escaping :D otherwise they just walk away - SetSpeedX (GetSpeedX() * 2.f); - SetSpeedZ (GetSpeedZ() * 2.f); - } - */ - } - else - { - if (ReachedFinalDestination()) // If we have reached the ultimate, final destination, stop pathfinding and attack if appropriate - { - FinishPathFinding(); - } - else - { - TickPathFinding(); // We have reached the next point in our path, calculate another point - } - } - } - - SetPitchAndYawFromDestination(); - HandleFalling(); - - switch (m_EMState) - { - case IDLE: - { - // If enemy passive we ignore checks for player visibility - InStateIdle(a_Dt); - break; - } - case CHASING: - { - // If we do not see a player anymore skip chasing action - InStateChasing(a_Dt); - break; - } - case ESCAPING: - { - InStateEscaping(a_Dt); - break; - } - - case ATTACKING: break; - } // switch (m_EMState) - - BroadcastMovementUpdate(); -} - - - - -void cMonster::SetPitchAndYawFromDestination() -{ - Vector3d FinalDestination = m_FinalDestination; - if (m_Target != NULL) - { - if (m_Target->IsPlayer()) - { - FinalDestination.y = ((cPlayer *)m_Target)->GetStance(); - } - else - { - FinalDestination.y = GetHeight(); - } - } - - Vector3d Distance = FinalDestination - GetPosition(); - if (Distance.SqrLength() > 0.1f) - { - { - double Rotation, Pitch; - Distance.Normalize(); - VectorToEuler(Distance.x, Distance.y, Distance.z, Rotation, Pitch); - SetHeadYaw(Rotation); - SetPitch(-Pitch); - } - - { - Vector3d BodyDistance = m_Destination - GetPosition(); - double Rotation, Pitch; - Distance.Normalize(); - VectorToEuler(BodyDistance.x, BodyDistance.y, BodyDistance.z, Rotation, Pitch); - SetYaw(Rotation); - } - } -} - - - - -void cMonster::HandleFalling() -{ - if (m_bOnGround) - { - int Damage = (m_LastGroundHeight - POSY_TOINT) - 3; - - if (Damage > 0) - { - TakeDamage(dtFalling, NULL, Damage, Damage, 0); - - // Fall particles - GetWorld()->BroadcastSoundParticleEffect(2006, POSX_TOINT, POSY_TOINT - 1, POSZ_TOINT, Damage /* Used as particle effect speed modifier */); - } - - m_LastGroundHeight = POSY_TOINT; - } -} - - - - - -int cMonster::FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ) -{ - int PosY = POSY_TOINT; - PosY = Clamp(PosY, 0, cChunkDef::Height); - - if (!cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ)))) - { - while (!cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))) && (PosY > 0)) - { - PosY--; - } - - return PosY + 1; - } - else - { - while (cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))) && (PosY < cChunkDef::Height)) - { - PosY++; - } - - return PosY; - } + LOG("Monster Tick..."); + m_AI->Tick(a_Dt, a_Chunk); + m_Attack->Tick(a_Dt, a_Chunk); + m_Environment->Tick(a_Dt, a_Chunk); + m_Movement->Tick(a_Dt, a_Chunk); } - -bool cMonster::DoTakeDamage(TakeDamageInfo & a_TDI) +void cMonster::SpawnOn(cClientHandle & a_Client) { - if (!super::DoTakeDamage(a_TDI)) - { - return false; - } - - if (!m_SoundHurt.empty() && (m_Health > 0)) - { - m_World->BroadcastSoundEffect(m_SoundHurt, GetPosX(), GetPosY(), GetPosZ(), 1.0f, 0.8f); - } - - if (a_TDI.Attacker != NULL) - { - m_Target = a_TDI.Attacker; - } - return true; + a_Client.SendSpawnMob(*this); } - -void cMonster::KilledBy(TakeDamageInfo & a_TDI) +void cMonster::AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth) { - super::KilledBy(a_TDI); - if (m_SoundHurt != "") - { - m_World->BroadcastSoundEffect(m_SoundDeath, GetPosX(), GetPosY(), GetPosZ(), 1.0f, 0.8f); - } - int Reward; - switch (m_MobType) - { - // Animals - case cMonster::mtChicken: - case cMonster::mtCow: - case cMonster::mtHorse: - case cMonster::mtPig: - case cMonster::mtSheep: - case cMonster::mtSquid: - case cMonster::mtMooshroom: - case cMonster::mtOcelot: - case cMonster::mtWolf: - { - Reward = m_World->GetTickRandomNumber(2) + 1; - break; - } - - // Monsters - case cMonster::mtCaveSpider: - case cMonster::mtCreeper: - case cMonster::mtEnderman: - case cMonster::mtGhast: - case cMonster::mtSilverfish: - case cMonster::mtSkeleton: - case cMonster::mtSpider: - case cMonster::mtWitch: - case cMonster::mtZombie: - case cMonster::mtZombiePigman: - case cMonster::mtSlime: - case cMonster::mtMagmaCube: - { - Reward = 6 + (m_World->GetTickRandomNumber(2)); - break; - } - case cMonster::mtBlaze: - { - Reward = 10; - break; - } - - // Bosses - case cMonster::mtEnderDragon: - { - Reward = 12000; - break; - } - case cMonster::mtWither: - { - Reward = 50; - break; - } - - default: - { - Reward = 0; - break; - } - } - if ((a_TDI.Attacker != NULL) && (!IsBaby())) + MTRand r1; + int Count = r1.randInt() % (a_Max + 1 - a_Min) + a_Min; + if (Count > 0) { - m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), Reward); + a_Drops.push_back(cItem(a_Item, Count, a_ItemHealth)); } - m_DestroyTimer = 0; } -// Checks to see if EventSeePlayer should be fired -// monster sez: Do I see the player -void cMonster::CheckEventSeePlayer(void) +void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth) { - // TODO: Rewrite this to use cWorld's DoWithPlayers() - cPlayer * Closest = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance, false); - - if (Closest != NULL) + MTRand r1; + int Count = r1.randInt() % 1000; + if (Count < (a_Chance * 10)) { - EventSeePlayer(Closest); + a_Drops.push_back(cItem(a_Item, 1, a_ItemHealth)); } } - - - -void cMonster::CheckEventLostPlayer(void) +void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel) { - if (m_Target != NULL) - { - if ((m_Target->GetPosition() - GetPosition()).Length() > m_SightDistance) - { - EventLosePlayer(); - } - } - else + MTRand r1; + int Count = r1.randInt() % 200; + if (Count < (5 + a_LootingLevel)) { - EventLosePlayer(); + int Rare = r1.randInt() % a_Items.Size(); + a_Drops.push_back(a_Items.at(Rare)); } } @@ -587,175 +148,45 @@ void cMonster::CheckEventLostPlayer(void) -// What to do if player is seen -// default to change state to chasing -void cMonster::EventSeePlayer(cEntity * a_SeenPlayer) -{ - m_Target = a_SeenPlayer; -} - - - - - -void cMonster::EventLosePlayer(void) -{ - m_Target = NULL; - m_EMState = IDLE; -} - - - - - -void cMonster::InStateIdle(float a_Dt) +void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel) { - if (m_bMovingToDestination) + MTRand r1; + if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2))) { - return; // Still getting there + if (!GetEquippedHelmet().IsEmpty()) a_Drops.push_back(GetEquippedHelmet()); } - - m_IdleInterval += a_Dt; - - if (m_IdleInterval > 1) + + if (r1.randInt() % 200 < ((m_DropChanceChestplate * 200) + (a_LootingLevel * 2))) { - // At this interval the results are predictable - int rem = m_World->GetTickRandomNumber(6) + 1; - m_IdleInterval -= 1; // So nothing gets dropped when the server hangs for a few seconds - - Vector3d Dist; - Dist.x = (double)m_World->GetTickRandomNumber(10) - 5; - Dist.z = (double)m_World->GetTickRandomNumber(10) - 5; - - if ((Dist.SqrLength() > 2) && (rem >= 3)) - { - Vector3d Destination(GetPosX() + Dist.x, 0, GetPosZ() + Dist.z); - - int NextHeight = FindFirstNonAirBlockPosition(Destination.x, Destination.z); - - if (IsNextYPosReachable(NextHeight)) - { - Destination.y = NextHeight; - MoveToPosition(Destination); - } - } + if (!GetEquippedChestplate().IsEmpty()) a_Drops.push_back(GetEquippedChestplate()); } -} - - - - - -// What to do if in Chasing State -// This state should always be defined in each child class -void cMonster::InStateChasing(float a_Dt) -{ - UNUSED(a_Dt); -} - - - - - -// What to do if in Escaping State -void cMonster::InStateEscaping(float a_Dt) -{ - UNUSED(a_Dt); - if (m_Target != NULL) + if (r1.randInt() % 200 < ((m_DropChanceLeggings * 200) + (a_LootingLevel * 2))) { - Vector3d newloc = GetPosition(); - newloc.x = (m_Target->GetPosition().x < newloc.x)? (newloc.x + m_SightDistance): (newloc.x - m_SightDistance); - newloc.z = (m_Target->GetPosition().z < newloc.z)? (newloc.z + m_SightDistance): (newloc.z - m_SightDistance); - MoveToPosition(newloc); + if (!GetEquippedLeggings().IsEmpty()) a_Drops.push_back(GetEquippedLeggings()); } - else + + if (r1.randInt() % 200 < ((m_DropChanceBoots * 200) + (a_LootingLevel * 2))) { - m_EMState = IDLE; // This shouldnt be required but just to be safe + if (!GetEquippedBoots().IsEmpty()) a_Drops.push_back(GetEquippedBoots()); } } - - -void cMonster::GetMonsterConfig(const AString & a_Name) -{ - cRoot::Get()->GetMonsterConfig()->AssignAttributes(this, a_Name); -} - - - - - -bool cMonster::IsUndead(void) -{ - return false; -} - - - - - -AString cMonster::MobTypeToString(cMonster::eType a_MobType) +void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel) { - // Mob types aren't sorted, so we need to search linearly: - for (size_t i = 0; i < ARRAYCOUNT(g_MobTypeNames); i++) + MTRand r1; + if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2))) { - if (g_MobTypeNames[i].m_Type == a_MobType) - { - return g_MobTypeNames[i].m_lcName; - } + if (!GetEquippedWeapon().IsEmpty()) a_Drops.push_back(GetEquippedWeapon()); } - - // Not found: - return ""; } -cMonster::eType cMonster::StringToMobType(const AString & a_Name) -{ - AString lcName = StrToLower(a_Name); - - // Binary-search for the lowercase name: - int lo = 0, hi = ARRAYCOUNT(g_MobTypeNames) - 1; - while (hi - lo > 1) - { - int mid = (lo + hi) / 2; - int res = strcmp(g_MobTypeNames[mid].m_lcName, lcName.c_str()); - if (res == 0) - { - return g_MobTypeNames[mid].m_Type; - } - if (res < 0) - { - lo = mid; - } - else - { - hi = mid; - } - } - // Range has collapsed to at most two elements, compare each: - if (strcmp(g_MobTypeNames[lo].m_lcName, lcName.c_str()) == 0) - { - return g_MobTypeNames[lo].m_Type; - } - if ((lo != hi) && (strcmp(g_MobTypeNames[hi].m_lcName, lcName.c_str()) == 0)) - { - return g_MobTypeNames[hi].m_Type; - } - - // Not found: - return mtInvalidType; -} - - - - cMonster::eFamily cMonster::FamilyFromType(eType a_Type) { @@ -803,25 +234,6 @@ cMonster::eFamily cMonster::FamilyFromType(eType a_Type) -int cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily) -{ - switch (a_MobFamily) - { - case mfHostile: return 40; - case mfPassive: return 40; - case mfAmbient: return 40; - case mfWater: return 400; - case mfNoSpawn: return -1; - case mfUnhandled: break; - } - ASSERT(!"Unhandled mob family"); - return -1; -} - - - - - cMonster * cMonster::NewMonsterFromType(cMonster::eType a_MobType) { cFastRandom Random; @@ -912,134 +324,78 @@ cMonster * cMonster::NewMonsterFromType(cMonster::eType a_MobType) -void cMonster::AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth) -{ - MTRand r1; - int Count = r1.randInt() % (a_Max + 1 - a_Min) + a_Min; - if (Count > 0) - { - a_Drops.push_back(cItem(a_Item, Count, a_ItemHealth)); - } -} - - - - - -void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth) -{ - MTRand r1; - int Count = r1.randInt() % 1000; - if (Count < (a_Chance * 10)) - { - a_Drops.push_back(cItem(a_Item, 1, a_ItemHealth)); - } -} - - - - - -void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel) +int cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily) { - MTRand r1; - int Count = r1.randInt() % 200; - if (Count < (5 + a_LootingLevel)) + switch (a_MobFamily) { - int Rare = r1.randInt() % a_Items.Size(); - a_Drops.push_back(a_Items.at(Rare)); + case mfHostile: return 40; + case mfPassive: return 40; + case mfAmbient: return 40; + case mfWater: return 400; + case mfNoSpawn: return -1; + case mfUnhandled: break; } + ASSERT(!"Unhandled mob family"); + return -1; } -void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel) +AString cMonster::MobTypeToString(cMonster::eType a_MobType) { - MTRand r1; - if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2))) - { - if (!GetEquippedHelmet().IsEmpty()) a_Drops.push_back(GetEquippedHelmet()); - } - - if (r1.randInt() % 200 < ((m_DropChanceChestplate * 200) + (a_LootingLevel * 2))) - { - if (!GetEquippedChestplate().IsEmpty()) a_Drops.push_back(GetEquippedChestplate()); - } - - if (r1.randInt() % 200 < ((m_DropChanceLeggings * 200) + (a_LootingLevel * 2))) + // Mob types aren't sorted, so we need to search linearly: + for (size_t i = 0; i < ARRAYCOUNT(g_MobTypeNames); i++) { - if (!GetEquippedLeggings().IsEmpty()) a_Drops.push_back(GetEquippedLeggings()); + if (g_MobTypeNames[i].m_Type == a_MobType) + { + return g_MobTypeNames[i].m_lcName; + } } - if (r1.randInt() % 200 < ((m_DropChanceBoots * 200) + (a_LootingLevel * 2))) - { - if (!GetEquippedBoots().IsEmpty()) a_Drops.push_back(GetEquippedBoots()); - } -} - - - - - -void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel) -{ - MTRand r1; - if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2))) - { - if (!GetEquippedWeapon().IsEmpty()) a_Drops.push_back(GetEquippedWeapon()); - } + // Not found: + return ""; } -void cMonster::HandleDaylightBurning(cChunk & a_Chunk) +cMonster::eType cMonster::StringToMobType(const AString & a_Name) { - if (!m_BurnsInDaylight) - { - return; - } + AString lcName = StrToLower(a_Name); - int RelY = POSY_TOINT; - if ((RelY < 0) || (RelY >= cChunkDef::Height)) + // Binary-search for the lowercase name: + int lo = 0, hi = ARRAYCOUNT(g_MobTypeNames) - 1; + while (hi - lo > 1) { - // Outside the world - return; + int mid = (lo + hi) / 2; + int res = strcmp(g_MobTypeNames[mid].m_lcName, lcName.c_str()); + if (res == 0) + { + return g_MobTypeNames[mid].m_Type; + } + if (res < 0) + { + lo = mid; + } + else + { + hi = mid; + } } - - int RelX = POSX_TOINT - GetChunkX() * cChunkDef::Width; - int RelZ = POSZ_TOINT - GetChunkZ() * cChunkDef::Width; - - if (!a_Chunk.IsLightValid()) + // Range has collapsed to at most two elements, compare each: + if (strcmp(g_MobTypeNames[lo].m_lcName, lcName.c_str()) == 0) { - m_World->QueueLightChunk(GetChunkX(), GetChunkZ()); - return; + return g_MobTypeNames[lo].m_Type; } - - if ( - (a_Chunk.GetSkyLight(RelX, RelY, RelZ) == 15) && // In the daylight - (a_Chunk.GetBlock(RelX, RelY, RelZ) != E_BLOCK_SOULSAND) && // Not on soulsand - (GetWorld()->GetTimeOfDay() < (12000 + 1000)) && // It is nighttime - !IsOnFire() && // Not already burning - GetWorld()->IsWeatherSunnyAt(POSX_TOINT, POSZ_TOINT) // Not raining - ) + if ((lo != hi) && (strcmp(g_MobTypeNames[hi].m_lcName, lcName.c_str()) == 0)) { - // Burn for 100 ticks, then decide again - StartBurning(100); + return g_MobTypeNames[hi].m_Type; } + + // Not found: + return mtInvalidType; } - - - -cMonster::eFamily cMonster::GetMobFamily(void) const -{ - return FamilyFromType(m_MobType); -} - - - - diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h index cdbd26c09..bfaceece2 100644 --- a/src/Mobs/Monster.h +++ b/src/Mobs/Monster.h @@ -6,6 +6,7 @@ #include "../BlockID.h" #include "../Item.h" #include "../Enchantments.h" +#include "Components/AllComponents.h" @@ -15,12 +16,7 @@ class cClientHandle; class cWorld; - - -// tolua_begin -class cMonster : - public cPawn -{ +class cMonster : public cPawn { typedef cPawn super; public: /// This identifies individual monster type, as well as their network type-ID @@ -57,7 +53,7 @@ public: mtWolf = E_META_SPAWN_EGG_WOLF, mtZombie = E_META_SPAWN_EGG_ZOMBIE, mtZombiePigman = E_META_SPAWN_EGG_ZOMBIE_PIGMAN, - } ; + }; enum eFamily { @@ -69,81 +65,61 @@ public: mfNoSpawn, mfUnhandled, // Nothing. Be sure this is the last and the others are in order } ; - - // tolua_end - - enum MState{ATTACKING, IDLE, CHASING, ESCAPING} m_EMState; - enum MPersonality{PASSIVE, AGGRESSIVE, COWARDLY} m_EMPersonality; - - /** Creates the mob object. - If a_ConfigName is not empty, the configuration is loaded using GetMonsterConfig() - a_MobType is the type of the mob (also used in the protocol ( http://wiki.vg/Entities#Mobs 2012_12_22)) - a_SoundHurt and a_SoundDeath are assigned into m_SoundHurt and m_SoundDeath, respectively - */ - cMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); - CLASS_PROTODEF(cMonster) - - virtual void SpawnOn(cClientHandle & a_ClientHandle) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; +protected: + eType m_MobType; - virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; - - virtual void KilledBy(TakeDamageInfo & a_TDI) override; + cAIComponent * m_AI; + cAttackComponent * m_Attack; + cEnvironmentComponent * m_Environment; + cMovementComponent * m_Movement; +public: + cMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); + ~cMonster() { delete m_AI; delete m_Attack; delete m_Environment; delete m_Movement;} + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; - virtual void MoveToPosition(const Vector3d & a_Position); // tolua_export - virtual bool ReachedDestination(void); - - // tolua_begin - eType GetMobType(void) const {return m_MobType; } - eFamily GetMobFamily(void) const; - // tolua_end - - virtual void CheckEventSeePlayer(void); - virtual void EventSeePlayer(cEntity * a_Player); - - /// Reads the monster configuration for the specified monster name and assigns it to this object. - void GetMonsterConfig(const AString & a_Name); - - /** Returns whether this mob is undead (skeleton, zombie, etc.) */ - virtual bool IsUndead(void); - - virtual void EventLosePlayer(void); - virtual void CheckEventLostPlayer(void); - - virtual void InStateIdle (float a_Dt); - virtual void InStateChasing (float a_Dt); - virtual void InStateEscaping(float a_Dt); - - int GetAttackRate() { return (int)m_AttackRate; } - void SetAttackRate(float a_AttackRate) { m_AttackRate = a_AttackRate; } - void SetAttackRange(int a_AttackRange) { m_AttackRange = a_AttackRange; } - void SetAttackDamage(int a_AttackDamage) { m_AttackDamage = a_AttackDamage; } - void SetSightDistance(int a_SightDistance) { m_SightDistance = a_SightDistance; } - - float GetDropChanceWeapon() { return m_DropChanceWeapon; } - float GetDropChanceHelmet() { return m_DropChanceHelmet; } - float GetDropChanceChestplate() { return m_DropChanceChestplate; } - float GetDropChanceLeggings() { return m_DropChanceLeggings; } - float GetDropChanceBoots() { return m_DropChanceBoots; } - bool CanPickUpLoot() { return m_CanPickUpLoot; } - void SetDropChanceWeapon(float a_DropChanceWeapon) { m_DropChanceWeapon = a_DropChanceWeapon; } - void SetDropChanceHelmet(float a_DropChanceHelmet) { m_DropChanceHelmet = a_DropChanceHelmet; } - void SetDropChanceChestplate(float a_DropChanceChestplate) { m_DropChanceChestplate = a_DropChanceChestplate; } - void SetDropChanceLeggings(float a_DropChanceLeggings) { m_DropChanceLeggings = a_DropChanceLeggings; } - void SetDropChanceBoots(float a_DropChanceBoots) { m_DropChanceBoots = a_DropChanceBoots; } - void SetCanPickUpLoot(bool a_CanPickUpLoot) { m_CanPickUpLoot = a_CanPickUpLoot; } - - /// Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick - void SetBurnsInDaylight(bool a_BurnsInDaylight) { m_BurnsInDaylight = a_BurnsInDaylight; } + virtual void Tick(float a_Dt, cChunk & a_Chunk); - // Overridables to handle ageable mobs + // Type Function virtual bool IsBaby (void) const { return false; } virtual bool IsTame (void) const { return false; } - virtual bool IsSitting (void) const { return false; } + virtual bool IsUndead (void) const { return false; } + + // Get Functions + cAIComponent * GetAIComponent() { return m_AI; } + cAttackComponent * GetAttackComponent() { return m_Attack; } + cEnvironmentComponent * GetEnvironmentComponent() { return m_Environment; } + cMovementComponent * GetMovementComponent() { return m_Movement; } + + // Get Functions - Temporary + + AString GetOwnerName (void) const { return m_OwnerName; } + AString GetOwnerUUID (void) const { return m_OwnerUUID; } + float GetDropChanceBoots() { return m_DropChanceBoots; } + float GetDropChanceHelmet() { return m_DropChanceHelmet; } + float GetDropChanceChestplate() { return m_DropChanceChestplate; } + float GetDropChanceLeggings() { return m_DropChanceLeggings; } + float GetDropChanceWeapon() { return m_DropChanceWeapon; } - // tolua_begin + eType GetMobType() const { return m_MobType; } + eFamily GetMobFamily() { return mfPassive; } + + + // Set Functions - Temporary + void SetDropChanceBoots(float a_Chance) { m_DropChanceBoots = a_Chance; } + void SetDropChanceHelmet(float a_Chance) { m_DropChanceHelmet = a_Chance; } + void SetDropChanceChestplate(float a_Chance) { m_DropChanceChestplate = a_Chance; } + void SetDropChanceLeggings(float a_Chance) { m_DropChanceLeggings = a_Chance; } + void SetDropChanceWeapon(float a_Chance) { m_DropChanceWeapon = a_Chance; } + void SetIsTame(bool m_Tame) {} + void SetOwner(AString a_Name, AString a_UUID) { m_OwnerName = a_Name; m_OwnerUUID = a_UUID; } + + // Ability Functions + bool CanPickUpLoot() { return false; } + void SetCanPickUpLoot(bool a_Looting) {} + + // Static Functions /// Translates MobType enum to a string, empty string if unknown static AString MobTypeToString(eType a_MobType); @@ -156,97 +132,15 @@ public: /// Returns the spawn delay (number of game ticks between spawn attempts) for the given mob family static int GetSpawnDelay(cMonster::eFamily a_MobFamily); - - // tolua_end /** Creates a new object of the specified mob. a_MobType is the type of the mob to be created Asserts and returns null if mob type is not specified */ static cMonster * NewMonsterFromType(eType a_MobType); - protected: - - /* ======= PATHFINDING ======= */ - /** A pointer to the entity this mobile is aiming to reach */ - cEntity * m_Target; - /** Coordinates of the next position that should be reached */ - Vector3d m_Destination; - /** Coordinates for the ultimate, final destination. */ - Vector3d m_FinalDestination; - /** Returns if the ultimate, final destination has been reached */ - bool ReachedFinalDestination(void); - /** Stores if mobile is currently moving towards the ultimate, final destination */ - bool m_bMovingToDestination; - - /** Finds the first non-air block position (not the highest, as cWorld::GetHeight does) - If current Y is nonsolid, goes down to try to find a solid block, then returns that + 1 - If current Y is solid, goes up to find first nonsolid block, and returns that */ - int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ); - /** Returns if a monster can actually reach a given height by jumping or walking */ - inline bool IsNextYPosReachable(int a_PosY) - { - return ( - (a_PosY <= POSY_TOINT) || - DoesPosYRequireJump(a_PosY) - ); - } - /** Returns if a monster can reach a given height by jumping */ - inline bool DoesPosYRequireJump(int a_PosY) - { - return ((a_PosY > POSY_TOINT) && (a_PosY == POSY_TOINT + 1)); - } - - /** A semi-temporary list to store the traversed coordinates during active pathfinding so we don't visit them again */ - std::vector<Vector3i> m_TraversedCoordinates; - /** Returns if coordinate is in the traversed list */ - bool IsCoordinateInTraversedList(Vector3i a_Coords); - - /** Finds the next place to go - This is based on the ultimate, final destination and the current position, as well as the traversed coordinates, and any environmental hazards */ - void TickPathFinding(void); - /** Finishes a pathfinding task, be it due to failure or something else */ - inline void FinishPathFinding(void) - { - m_TraversedCoordinates.clear(); - m_bMovingToDestination = false; - } - /** Sets the body yaw and head yaw/pitch based on next/ultimate destinations */ - void SetPitchAndYawFromDestination(void); - - /* =========================== */ - /* ========= FALLING ========= */ - - virtual void HandleFalling(void); - int m_LastGroundHeight; - - /* =========================== */ - - float m_IdleInterval; - float m_DestroyTimer; - - eType m_MobType; - - AString m_SoundHurt; - AString m_SoundDeath; - - float m_AttackRate; - int m_AttackDamage; - int m_AttackRange; - float m_AttackInterval; - int m_SightDistance; - - float m_DropChanceWeapon; - float m_DropChanceHelmet; - float m_DropChanceChestplate; - float m_DropChanceLeggings; - float m_DropChanceBoots; - bool m_CanPickUpLoot; - - void HandleDaylightBurning(cChunk & a_Chunk); - bool m_BurnsInDaylight; /** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/ void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0); @@ -262,10 +156,21 @@ protected: /** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/ void AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel); - -} ; // tolua_export + AString m_SoundHurt; + AString m_SoundDeath; + // Temporary placement till I figure out where to put it + float m_DropChanceWeapon; + float m_DropChanceHelmet; + float m_DropChanceChestplate; + float m_DropChanceLeggings; + float m_DropChanceBoots; + AString m_OwnerName; + AString m_OwnerUUID; + + float m_DestroyTimer; +}; diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp index 81bd3e3b4..d20c92fee 100644 --- a/src/Mobs/Mooshroom.cpp +++ b/src/Mobs/Mooshroom.cpp @@ -33,43 +33,3 @@ void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer) AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF); } - - - - -void cMooshroom::OnRightClicked(cPlayer & a_Player) -{ - switch (a_Player.GetEquippedItem().m_ItemType) - { - case E_ITEM_BUCKET: - { - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - a_Player.GetInventory().AddItem(E_ITEM_MILK); - } - } break; - case E_ITEM_BOWL: - { - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - a_Player.GetInventory().AddItem(E_ITEM_MUSHROOM_SOUP); - } - } break; - case E_ITEM_SHEARS: - { - if (!a_Player.IsGameModeCreative()) - { - a_Player.UseEquippedItem(); - } - - cItems Drops; - Drops.push_back(cItem(E_BLOCK_RED_MUSHROOM, 5, 0)); - m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); - m_World->SpawnMob(GetPosX(), GetPosY(), GetPosZ(), cMonster::mtCow); - Destroy(); - } break; - } -} - diff --git a/src/Mobs/Mooshroom.h b/src/Mobs/Mooshroom.h index fb002c2bf..40ba41155 100644 --- a/src/Mobs/Mooshroom.h +++ b/src/Mobs/Mooshroom.h @@ -1,26 +1,23 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cMooshroom : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: cMooshroom(void); CLASS_PROTODEF(cMooshroom) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void OnRightClicked(cPlayer & a_Player) override; - - virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_WHEAT); } + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/Ocelot.h b/src/Mobs/Ocelot.h index f2727d354..1777b14ce 100644 --- a/src/Mobs/Ocelot.h +++ b/src/Mobs/Ocelot.h @@ -1,16 +1,16 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cOcelot : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: cOcelot(void) : diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/Old Mobs/AggressiveMonster.cpp index 5f5b1853d..5f5b1853d 100644 --- a/src/Mobs/AggressiveMonster.cpp +++ b/src/Mobs/Old Mobs/AggressiveMonster.cpp diff --git a/src/Mobs/AggressiveMonster.h b/src/Mobs/Old Mobs/AggressiveMonster.h index d70ff04a3..2c6f6b253 100644 --- a/src/Mobs/AggressiveMonster.h +++ b/src/Mobs/Old Mobs/AggressiveMonster.h @@ -16,10 +16,10 @@ public: cAggressiveMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); - virtual void Tick (float a_Dt, cChunk & a_Chunk) override; - virtual void InStateChasing(float a_Dt) override; + virtual void Tick (float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void InStateChasing(float a_Dt) /*override*/; - virtual void EventSeePlayer(cEntity *) override; + virtual void EventSeePlayer(cEntity *) /*override*/; virtual void Attack(float a_Dt); protected: diff --git a/src/Mobs/Old Mobs/Bat.cpp b/src/Mobs/Old Mobs/Bat.cpp new file mode 100644 index 000000000..c072d4f48 --- /dev/null +++ b/src/Mobs/Old Mobs/Bat.cpp @@ -0,0 +1,14 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Bat.h" +#include "../Vector3.h" +#include "../Chunk.h" + + +cBat::cBat(void) : + super("Bat", mtBat, "mob.bat.hurt", "mob.bat.death", 0.5, 0.9) +{ +} + + diff --git a/src/Mobs/Old Mobs/Bat.h b/src/Mobs/Old Mobs/Bat.h new file mode 100644 index 000000000..6b06aeb4f --- /dev/null +++ b/src/Mobs/Old Mobs/Bat.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "PassiveMonster.h" + + + + + +class cBat : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + cBat(void); + + CLASS_PROTODEF(cBat) + + bool IsHanging(void) const {return false; } +} ; + + + + diff --git a/src/Mobs/Old Mobs/Blaze.cpp b/src/Mobs/Old Mobs/Blaze.cpp new file mode 100644 index 000000000..b4104d530 --- /dev/null +++ b/src/Mobs/Old Mobs/Blaze.cpp @@ -0,0 +1,57 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Blaze.h" +#include "../World.h" +#include "../Entities/FireChargeEntity.h" + + + + +cBlaze::cBlaze(void) : + super("Blaze", mtBlaze, "mob.blaze.hit", "mob.blaze.death", 0.6, 1.8) +{ +} + + + + + +void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf"))) + { + int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_BLAZE_ROD); + } +} + + + + + +void cBlaze::Attack(float a_Dt) +{ + m_AttackInterval += a_Dt * m_AttackRate; + + if (m_Target != NULL && m_AttackInterval > 3.0) + { + // Setting this higher gives us more wiggle room for attackrate + Vector3d Speed = GetLookVector() * 20; + Speed.y = Speed.y + 1; + cFireChargeEntity * FireCharge = new cFireChargeEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); + if (FireCharge == NULL) + { + return; + } + if (!FireCharge->Initialize(*m_World)) + { + delete FireCharge; + FireCharge = NULL; + return; + } + m_World->BroadcastSpawnEntity(*FireCharge); + m_AttackInterval = 0.0; + // ToDo: Shoot 3 fireballs instead of 1. + } +} diff --git a/src/Mobs/Old Mobs/Blaze.h b/src/Mobs/Old Mobs/Blaze.h new file mode 100644 index 000000000..66540e2f2 --- /dev/null +++ b/src/Mobs/Old Mobs/Blaze.h @@ -0,0 +1,22 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cBlaze : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cBlaze(void); + + CLASS_PROTODEF(cBlaze) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void Attack(float a_Dt) /*override*/; +} ; diff --git a/src/Mobs/Old Mobs/CaveSpider.cpp b/src/Mobs/Old Mobs/CaveSpider.cpp new file mode 100644 index 000000000..118a6e93b --- /dev/null +++ b/src/Mobs/Old Mobs/CaveSpider.cpp @@ -0,0 +1,61 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "CaveSpider.h" +#include "../World.h" + + + + + +cCaveSpider::cCaveSpider(void) : + super("CaveSpider", mtCaveSpider, "mob.spider.say", "mob.spider.death", 0.7, 0.5) +{ +} + + + + + +void cCaveSpider::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + m_EMPersonality = (GetWorld()->GetTimeOfDay() < (12000 + 1000)) ? PASSIVE : AGGRESSIVE; +} + + + + + +void cCaveSpider::Attack(float a_Dt) +{ + super::Attack(a_Dt); + + if (m_Target->IsPawn()) + { + // TODO: Easy = no poison, Medium = 7 seconds, Hard = 15 seconds + ((cPawn *) m_Target)->AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0); + } +} + + + + + +void cCaveSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING); + if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf"))) + { + AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE); + } +} + + + + diff --git a/src/Mobs/Old Mobs/CaveSpider.h b/src/Mobs/Old Mobs/CaveSpider.h new file mode 100644 index 000000000..355577d22 --- /dev/null +++ b/src/Mobs/Old Mobs/CaveSpider.h @@ -0,0 +1,26 @@ +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cCaveSpider : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cCaveSpider(void); + + CLASS_PROTODEF(cCaveSpider) + + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void Attack(float a_Dt) /*override*/; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; +} ; + + + + diff --git a/src/Mobs/Old Mobs/Chicken.cpp b/src/Mobs/Old Mobs/Chicken.cpp new file mode 100644 index 000000000..f7e44238f --- /dev/null +++ b/src/Mobs/Old Mobs/Chicken.cpp @@ -0,0 +1,66 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Chicken.h" +#include "../World.h" + + + + + + + +cChicken::cChicken(void) : + super("Chicken", mtChicken, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4), + m_EggDropTimer(0) +{ +} + + + + +void cChicken::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + if ((m_EggDropTimer == 6000) && (m_World->GetTickRandomNumber(1) == 0)) + { + cItems Drops; + m_EggDropTimer = 0; + Drops.push_back(cItem(E_ITEM_EGG, 1)); + m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); + } + else if (m_EggDropTimer == 12000) + { + cItems Drops; + m_EggDropTimer = 0; + Drops.push_back(cItem(E_ITEM_EGG, 1)); + m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); + } + else + { + m_EggDropTimer++; + } +} + + + + + +void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_FEATHER); + AddRandomDropItem(a_Drops, 1, 1, IsOnFire() ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN); +} + + + + + + + + diff --git a/src/Mobs/Old Mobs/Chicken.h b/src/Mobs/Old Mobs/Chicken.h new file mode 100644 index 000000000..2a6c4fdb5 --- /dev/null +++ b/src/Mobs/Old Mobs/Chicken.h @@ -0,0 +1,30 @@ +#pragma once + +#include "PassiveMonster.h" + + + + + +class cChicken : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + cChicken(void); + + CLASS_PROTODEF(cChicken) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + + virtual const cItem GetFollowedItem(void) const /*override*/ { return cItem(E_ITEM_SEEDS); } + +private: + + int m_EggDropTimer; +} ; + + + diff --git a/src/Mobs/Old Mobs/Cow.cpp b/src/Mobs/Old Mobs/Cow.cpp new file mode 100644 index 000000000..9914df6b5 --- /dev/null +++ b/src/Mobs/Old Mobs/Cow.cpp @@ -0,0 +1,48 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Cow.h" +#include "../Entities/Player.h" + + + + + + + +cCow::cCow(void) : + super("Cow", mtCow, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3) +{ +} + + + + + +void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER); + AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF); +} + + + + + +void cCow::OnRightClicked(cPlayer & a_Player) +{ + if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_BUCKET)) + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + a_Player.GetInventory().AddItem(E_ITEM_MILK); + } + } +} + diff --git a/src/Mobs/Old Mobs/Cow.h b/src/Mobs/Old Mobs/Cow.h new file mode 100644 index 000000000..52f468982 --- /dev/null +++ b/src/Mobs/Old Mobs/Cow.h @@ -0,0 +1,29 @@ + +#pragma once + +#include "PassiveMonster.h" + + + + + +class cCow : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + cCow(); + + CLASS_PROTODEF(cCow) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + + virtual const cItem GetFollowedItem(void) const /*override*/ { return cItem(E_ITEM_WHEAT); } + +} ; + + + + diff --git a/src/Mobs/Old Mobs/Creeper.cpp b/src/Mobs/Old Mobs/Creeper.cpp new file mode 100644 index 000000000..399710723 --- /dev/null +++ b/src/Mobs/Old Mobs/Creeper.cpp @@ -0,0 +1,152 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Creeper.h" +#include "../World.h" +#include "../Entities/ProjectileEntity.h" +#include "../Entities/Player.h" + + + + + +cCreeper::cCreeper(void) : + super("Creeper", mtCreeper, "mob.creeper.say", "mob.creeper.say", 0.6, 1.8), + m_bIsBlowing(false), + m_bIsCharged(false), + m_BurnedWithFlintAndSteel(false), + m_ExplodingTimer(0) +{ +} + + + + + +void cCreeper::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + if (!ReachedFinalDestination() && !m_BurnedWithFlintAndSteel) + { + m_ExplodingTimer = 0; + m_bIsBlowing = false; + m_World->BroadcastEntityMetadata(*this); + } + else + { + if (m_bIsBlowing) + { + m_ExplodingTimer += 1; + } + + if (m_ExplodingTimer == 30) + { + m_World->DoExplosionAt((m_bIsCharged ? 5 : 3), GetPosX(), GetPosY(), GetPosZ(), false, esMonster, this); + Destroy(); // Just in case we aren't killed by the explosion + } + } +} + + + + + +void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + if (m_ExplodingTimer == 30) + { + // Exploded creepers drop naught but charred flesh, which Minecraft doesn't have + return; + } + + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER); + + if ((a_Killer != NULL) && a_Killer->IsProjectile() && (((cProjectileEntity *)a_Killer)->GetCreatorUniqueID() >= 0)) + { + class cProjectileCreatorCallback : public cEntityCallback + { + public: + cProjectileCreatorCallback(void) + { + } + + virtual bool Item(cEntity * a_Entity) /*override*/ + { + if (a_Entity->IsMob() && ((cMonster *)a_Entity)->GetMobType() == mtSkeleton) + { + return true; + } + return false; + } + }; + + cProjectileCreatorCallback PCC; + if (GetWorld()->DoWithEntityByID(((cProjectileEntity *)a_Killer)->GetCreatorUniqueID(), PCC)) + { + // 12 music discs. TickRand starts from 0 to 11. Disk IDs start at 2256, so add that. There. + AddRandomDropItem(a_Drops, 1, 1, (short)m_World->GetTickRandomNumber(11) + 2256); + } + } +} + + + + + +bool cCreeper::DoTakeDamage(TakeDamageInfo & a_TDI) +{ + if (!super::DoTakeDamage(a_TDI)) + { + return false; + } + + if (a_TDI.DamageType == dtLightning) + { + m_bIsCharged = true; + } + + m_World->BroadcastEntityMetadata(*this); + return true; +} + + + + + +void cCreeper::Attack(float a_Dt) +{ + UNUSED(a_Dt); + + if (!m_bIsBlowing) + { + m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); + m_bIsBlowing = true; + m_World->BroadcastEntityMetadata(*this); + } +} + + + + + +void cCreeper::OnRightClicked(cPlayer & a_Player) +{ + if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_FLINT_AND_STEEL)) + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.UseEquippedItem(); + } + m_World->BroadcastSoundEffect("game.tnt.primed", GetPosX(), GetPosY(), GetPosZ(), 1.f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); + m_bIsBlowing = true; + m_World->BroadcastEntityMetadata(*this); + m_BurnedWithFlintAndSteel = true; + } +} + diff --git a/src/Mobs/Old Mobs/Creeper.h b/src/Mobs/Old Mobs/Creeper.h new file mode 100644 index 000000000..fcf0d40df --- /dev/null +++ b/src/Mobs/Old Mobs/Creeper.h @@ -0,0 +1,38 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cCreeper : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cCreeper(void); + + CLASS_PROTODEF(cCreeper) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) /*override*/; + virtual void Attack(float a_Dt) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + + bool IsBlowing(void) const {return m_bIsBlowing; } + bool IsCharged(void) const {return m_bIsCharged; } + +private: + + bool m_bIsBlowing, m_bIsCharged, m_BurnedWithFlintAndSteel; + int m_ExplodingTimer; + +} ; + + + + diff --git a/src/Mobs/Old Mobs/EnderDragon.cpp b/src/Mobs/Old Mobs/EnderDragon.cpp new file mode 100644 index 000000000..acd81cde1 --- /dev/null +++ b/src/Mobs/Old Mobs/EnderDragon.cpp @@ -0,0 +1,27 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "EnderDragon.h" + + + + + +cEnderDragon::cEnderDragon(void) : + // TODO: Vanilla source says this, but is it right? Dragons fly, they don't stand + super("EnderDragon", mtEnderDragon, "mob.enderdragon.hit", "mob.enderdragon.end", 16.0, 8.0) +{ +} + + + + + +void cEnderDragon::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + return; +} + + + + diff --git a/src/Mobs/Old Mobs/EnderDragon.h b/src/Mobs/Old Mobs/EnderDragon.h new file mode 100644 index 000000000..b26456868 --- /dev/null +++ b/src/Mobs/Old Mobs/EnderDragon.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cEnderDragon : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cEnderDragon(void); + + CLASS_PROTODEF(cEnderDragon) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; +} ; + + + + diff --git a/src/Mobs/Old Mobs/Enderman.cpp b/src/Mobs/Old Mobs/Enderman.cpp new file mode 100644 index 000000000..29f8d434c --- /dev/null +++ b/src/Mobs/Old Mobs/Enderman.cpp @@ -0,0 +1,183 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Enderman.h" +#include "../Entities/Player.h" +#include "../Tracer.h" + + + + +//////////////////////////////////////////////////////////////////////////////// +// cPlayerLookCheck +class cPlayerLookCheck : + public cPlayerListCallback +{ +public: + cPlayerLookCheck(Vector3d a_EndermanPos, int a_SightDistance) : + m_Player(NULL), + m_EndermanPos(a_EndermanPos), + m_SightDistance(a_SightDistance) + { + } + + virtual bool Item(cPlayer * a_Player) /*override*/ + { + // Don't check players who are in creative gamemode + if (a_Player->IsGameModeCreative()) + { + return false; + } + + Vector3d Direction = m_EndermanPos - a_Player->GetPosition(); + + // Don't check players who are more then SightDistance (64) blocks away + if (Direction.Length() > m_SightDistance) + { + return false; + } + + // Don't check if the player has a pumpkin on his head + if (a_Player->GetEquippedHelmet().m_ItemType == E_BLOCK_PUMPKIN) + { + return false; + } + + + Vector3d LookVector = a_Player->GetLookVector(); + double dot = Direction.Dot(LookVector); + + // 0.09 rad ~ 5 degrees + // If the player's crosshair is within 5 degrees of the enderman, it counts as looking + if (dot <= cos(0.09)) + { + return false; + } + + cTracer LineOfSight(a_Player->GetWorld()); + if (LineOfSight.Trace(m_EndermanPos, Direction, (int)Direction.Length())) + { + // No direct line of sight + return false; + } + + m_Player = a_Player; + return true; + } + + cPlayer * GetPlayer(void) const { return m_Player; } + +protected: + cPlayer * m_Player; + Vector3d m_EndermanPos; + int m_SightDistance; +} ; + + + + + +cEnderman::cEnderman(void) : + super("Enderman", mtEnderman, "mob.endermen.hit", "mob.endermen.death", 0.5, 2.9), + m_bIsScreaming(false), + CarriedBlock(E_BLOCK_AIR), + CarriedMeta(0) +{ +} + + + + + +void cEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ENDER_PEARL); +} + + + + +void cEnderman::CheckEventSeePlayer() +{ + if (m_Target != NULL) + { + return; + } + + cPlayerLookCheck Callback(GetPosition(), m_SightDistance); + if (m_World->ForEachPlayer(Callback)) + { + return; + } + + ASSERT(Callback.GetPlayer() != NULL); + + if (!CheckLight()) + { + // Insufficient light for enderman to become aggravated + // TODO: Teleport to a suitable location + return; + } + + if (!Callback.GetPlayer()->IsGameModeCreative()) + { + super::EventSeePlayer(Callback.GetPlayer()); + m_EMState = CHASING; + m_bIsScreaming = true; + GetWorld()->BroadcastEntityMetadata(*this); + } +} + + + + + +void cEnderman::CheckEventLostPlayer(void) +{ + super::CheckEventLostPlayer(); + if (!CheckLight()) + { + EventLosePlayer(); + } +} + + + + + +void cEnderman::EventLosePlayer() +{ + super::EventLosePlayer(); + m_bIsScreaming = false; + GetWorld()->BroadcastEntityMetadata(*this); +} + + + + + +bool cEnderman::CheckLight() +{ + int ChunkX, ChunkZ; + cChunkDef::BlockToChunk(POSX_TOINT, POSZ_TOINT, ChunkX, ChunkZ); + + // Check if the chunk the enderman is in is lit + if (!m_World->IsChunkLighted(ChunkX, ChunkZ)) + { + m_World->QueueLightChunk(ChunkX, ChunkZ); + return true; + } + + // Enderman only attack if the skylight is lower or equal to 8 + if (m_World->GetBlockSkyLight(POSX_TOINT, POSY_TOINT, POSZ_TOINT) - GetWorld()->GetSkyDarkness() > 8) + { + return false; + } + + return true; +} diff --git a/src/Mobs/Old Mobs/Enderman.h b/src/Mobs/Old Mobs/Enderman.h new file mode 100644 index 000000000..5e61f9ac0 --- /dev/null +++ b/src/Mobs/Old Mobs/Enderman.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "PassiveAggressiveMonster.h" + + + + + +class cEnderman : + public cPassiveAggressiveMonster +{ + typedef cPassiveAggressiveMonster super; + +public: + cEnderman(void); + + CLASS_PROTODEF(cEnderman) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void CheckEventSeePlayer(void) /*override*/; + virtual void CheckEventLostPlayer(void) /*override*/; + virtual void EventLosePlayer(void) /*override*/; + + bool IsScreaming(void) const {return m_bIsScreaming; } + BLOCKTYPE GetCarriedBlock(void) const {return CarriedBlock; } + NIBBLETYPE GetCarriedMeta(void) const {return CarriedMeta; } + + /** Returns if the current sky light level is sufficient for the enderman to become aggravated */ + bool CheckLight(void); + +private: + + bool m_bIsScreaming; + BLOCKTYPE CarriedBlock; + NIBBLETYPE CarriedMeta; + +} ; + + + + diff --git a/src/Mobs/Old Mobs/Ghast.cpp b/src/Mobs/Old Mobs/Ghast.cpp new file mode 100644 index 000000000..6aac14779 --- /dev/null +++ b/src/Mobs/Old Mobs/Ghast.cpp @@ -0,0 +1,61 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Ghast.h" +#include "../World.h" +#include "../Entities/GhastFireballEntity.h" + + + + +cGhast::cGhast(void) : + super("Ghast", mtGhast, "mob.ghast.scream", "mob.ghast.death", 4, 4) +{ +} + + + + + +void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER); + AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GHAST_TEAR); +} + + + + + +void cGhast::Attack(float a_Dt) +{ + m_AttackInterval += a_Dt * m_AttackRate; + + if (m_Target != NULL && m_AttackInterval > 3.0) + { + // Setting this higher gives us more wiggle room for attackrate + Vector3d Speed = GetLookVector() * 20; + Speed.y = Speed.y + 1; + cGhastFireballEntity * GhastBall = new cGhastFireballEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); + if (GhastBall == NULL) + { + return; + } + if (!GhastBall->Initialize(*m_World)) + { + delete GhastBall; + GhastBall = NULL; + return; + } + m_World->BroadcastSpawnEntity(*GhastBall); + m_AttackInterval = 0.0; + } +} + + + diff --git a/src/Mobs/Old Mobs/Ghast.h b/src/Mobs/Old Mobs/Ghast.h new file mode 100644 index 000000000..86e9ad9ba --- /dev/null +++ b/src/Mobs/Old Mobs/Ghast.h @@ -0,0 +1,28 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cGhast : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cGhast(void); + + CLASS_PROTODEF(cGhast) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void Attack(float a_Dt) /*override*/; + + bool IsCharging(void) const {return false; } +} ; + + + + diff --git a/src/Mobs/Old Mobs/Giant.cpp b/src/Mobs/Old Mobs/Giant.cpp new file mode 100644 index 000000000..bbcad46f0 --- /dev/null +++ b/src/Mobs/Old Mobs/Giant.cpp @@ -0,0 +1,27 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Giant.h" + + + + + +cGiant::cGiant(void) : + super("Giant", mtGiant, "mob.zombie.hurt", "mob.zombie.death", 3.6, 10.8) +{ + +} + + + + + +void cGiant::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + AddRandomDropItem(a_Drops, 10, 50, E_ITEM_ROTTEN_FLESH); +} + + + + diff --git a/src/Mobs/Old Mobs/Giant.h b/src/Mobs/Old Mobs/Giant.h new file mode 100644 index 000000000..ee2d4f795 --- /dev/null +++ b/src/Mobs/Old Mobs/Giant.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cGiant : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cGiant(void); + + CLASS_PROTODEF(cGiant) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; +} ; + + + + diff --git a/src/Mobs/Old Mobs/Horse.cpp b/src/Mobs/Old Mobs/Horse.cpp new file mode 100644 index 000000000..67a09d4ab --- /dev/null +++ b/src/Mobs/Old Mobs/Horse.cpp @@ -0,0 +1,157 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Horse.h" +#include "../World.h" +#include "../Entities/Player.h" + + + + + +cHorse::cHorse(int Type, int Color, int Style, int TameTimes) : + super("Horse", mtHorse, "mob.horse.hit", "mob.horse.death", 1.4, 1.6), + m_bHasChest(false), + m_bIsEating(false), + m_bIsRearing(false), + m_bIsMouthOpen(false), + m_bIsTame(false), + m_bIsSaddled(false), + m_Type(Type), + m_Color(Color), + m_Style(Style), + m_Armour(0), + m_TimesToTame(TameTimes), + m_TameAttemptTimes(0), + m_RearTickCount(0) +{ +} + + + + + +void cHorse::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + if (!m_bIsMouthOpen) + { + if (m_World->GetTickRandomNumber(50) == 25) + { + m_bIsMouthOpen = true; + } + } + else + { + if (m_World->GetTickRandomNumber(10) == 5) + { + m_bIsMouthOpen = false; + } + } + + if ((m_Attachee != NULL) && (!m_bIsTame)) + { + if (m_TameAttemptTimes < m_TimesToTame) + { + if (m_World->GetTickRandomNumber(50) == 25) + { + m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 0); + m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 2); + m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 6); + m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 8); + + m_Attachee->Detach(); + m_bIsRearing = true; + } + } + else + { + m_bIsTame = true; + } + } + + if (m_bIsRearing) + { + if (m_RearTickCount == 20) + { + m_bIsRearing = false; + m_RearTickCount = 0; + } + else + { + m_RearTickCount++; + } + } + + m_World->BroadcastEntityMetadata(*this); +} + + + + + +void cHorse::OnRightClicked(cPlayer & a_Player) +{ + if (!m_bIsSaddled && m_bIsTame) + { + if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE) + { + // Saddle the horse: + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + m_bIsSaddled = true; + m_World->BroadcastEntityMetadata(*this); + } + else if (!a_Player.GetEquippedItem().IsEmpty()) + { + // The horse doesn't like being hit, make it rear: + m_bIsRearing = true; + m_RearTickCount = 0; + } + } + else + { + if (m_Attachee != NULL) + { + if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID()) + { + a_Player.Detach(); + return; + } + + if (m_Attachee->IsPlayer()) + { + return; + } + + m_Attachee->Detach(); + } + + m_TameAttemptTimes++; + a_Player.AttachTo(this); + } +} + + + + + +void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER); + if (m_bIsSaddled) + { + a_Drops.push_back(cItem(E_ITEM_SADDLE, 1)); + } +} + + + + diff --git a/src/Mobs/Old Mobs/Horse.h b/src/Mobs/Old Mobs/Horse.h new file mode 100644 index 000000000..935e7c614 --- /dev/null +++ b/src/Mobs/Old Mobs/Horse.h @@ -0,0 +1,44 @@ + +#pragma once + +#include "PassiveMonster.h" + + + + + +class cHorse : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + cHorse(int Type, int Color, int Style, int TameTimes); + + CLASS_PROTODEF(cHorse) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + + bool IsSaddled (void) const {return m_bIsSaddled; } + bool IsChested (void) const {return m_bHasChest; } + bool IsEating (void) const {return m_bIsEating; } + bool IsRearing (void) const {return m_bIsRearing; } + bool IsMthOpen (void) const {return m_bIsMouthOpen; } + bool IsTame (void) const {return m_bIsTame; } + int GetHorseType (void) const {return m_Type; } + int GetHorseColor (void) const {return m_Color; } + int GetHorseStyle (void) const {return m_Style; } + int GetHorseArmour (void) const {return m_Armour;} + +private: + + bool m_bHasChest, m_bIsEating, m_bIsRearing, m_bIsMouthOpen, m_bIsTame, m_bIsSaddled; + int m_Type, m_Color, m_Style, m_Armour, m_TimesToTame, m_TameAttemptTimes, m_RearTickCount; + +} ; + + + + diff --git a/src/Mobs/Old Mobs/IronGolem.cpp b/src/Mobs/Old Mobs/IronGolem.cpp new file mode 100644 index 000000000..dae4615e4 --- /dev/null +++ b/src/Mobs/Old Mobs/IronGolem.cpp @@ -0,0 +1,28 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "IronGolem.h" + + + + + +cIronGolem::cIronGolem(void) : + super("IronGolem", mtIronGolem, "mob.IronGolem.hit", "mob.IronGolem.death", 1.4, 2.9) +{ +} + + + + + +void cIronGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + UNUSED(a_Killer); + AddRandomDropItem(a_Drops, 0, 5, E_ITEM_IRON); + AddRandomDropItem(a_Drops, 0, 2, E_BLOCK_FLOWER); +} + + + + diff --git a/src/Mobs/Old Mobs/IronGolem.h b/src/Mobs/Old Mobs/IronGolem.h new file mode 100644 index 000000000..c526e1ba9 --- /dev/null +++ b/src/Mobs/Old Mobs/IronGolem.h @@ -0,0 +1,29 @@ + +#pragma once + +#include "PassiveAggressiveMonster.h" + + + + + +class cIronGolem : + public cPassiveAggressiveMonster +{ + typedef cPassiveAggressiveMonster super; + +public: + cIronGolem(void); + + CLASS_PROTODEF(cIronGolem) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + + // Iron golems do not drown nor float + virtual void HandleAir(void) /*override*/ {} + virtual void SetSwimState(cChunk & a_Chunk) /*override*/ {} +} ; + + + + diff --git a/src/Mobs/Old Mobs/MagmaCube.cpp b/src/Mobs/Old Mobs/MagmaCube.cpp new file mode 100644 index 000000000..3e9abc108 --- /dev/null +++ b/src/Mobs/Old Mobs/MagmaCube.cpp @@ -0,0 +1,30 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "MagmaCube.h" + + + + + +cMagmaCube::cMagmaCube(int a_Size) : + super("MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size), + m_Size(a_Size) +{ +} + + + + + +void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + UNUSED(a_Killer); + if (GetSize() > 1) + { + AddRandomUncommonDropItem(a_Drops, 25.0f, E_ITEM_MAGMA_CREAM); + } +} + + + + diff --git a/src/Mobs/Old Mobs/MagmaCube.h b/src/Mobs/Old Mobs/MagmaCube.h new file mode 100644 index 000000000..695f72ed2 --- /dev/null +++ b/src/Mobs/Old Mobs/MagmaCube.h @@ -0,0 +1,31 @@ +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cMagmaCube : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest + cMagmaCube(int a_Size); + + CLASS_PROTODEF(cMagmaCube) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + int GetSize(void) const { return m_Size; } + +protected: + + /// Size of the MagmaCube, 1 .. 3, with 1 being the smallest + int m_Size; +} ; + + + + diff --git a/src/Mobs/Old Mobs/Monster.cpp b/src/Mobs/Old Mobs/Monster.cpp new file mode 100644 index 000000000..fe8a7346f --- /dev/null +++ b/src/Mobs/Old Mobs/Monster.cpp @@ -0,0 +1,1045 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "IncludeAllMonsters.h" +#include "../Root.h" +#include "../Server.h" +#include "../ClientHandle.h" +#include "../World.h" +#include "../Entities/Player.h" +#include "../Entities/ExpOrb.h" +#include "../MonsterConfig.h" +#include "../MersenneTwister.h" + +#include "../Chunk.h" +#include "../FastRandom.h" + + + + + +/** Map for eType <-> string +Needs to be alpha-sorted by the strings, because binary search is used in StringToMobType() +The strings need to be lowercase (for more efficient comparisons in StringToMobType()) +*/ +static const struct +{ + cMonster::eType m_Type; + const char * m_lcName; +} g_MobTypeNames[] = +{ + {cMonster::mtBat, "bat"}, + {cMonster::mtBlaze, "blaze"}, + {cMonster::mtCaveSpider, "cavespider"}, + {cMonster::mtChicken, "chicken"}, + {cMonster::mtCow, "cow"}, + {cMonster::mtCreeper, "creeper"}, + {cMonster::mtEnderman, "enderman"}, + {cMonster::mtEnderDragon, "enderdragon"}, + {cMonster::mtGhast, "ghast"}, + {cMonster::mtHorse, "horse"}, + {cMonster::mtIronGolem, "irongolem"}, + {cMonster::mtMagmaCube, "magmacube"}, + {cMonster::mtMooshroom, "mooshroom"}, + {cMonster::mtOcelot, "ocelot"}, + {cMonster::mtPig, "pig"}, + {cMonster::mtSheep, "sheep"}, + {cMonster::mtSilverfish, "silverfish"}, + {cMonster::mtSkeleton, "skeleton"}, + {cMonster::mtSlime, "slime"}, + {cMonster::mtSnowGolem, "snowgolem"}, + {cMonster::mtSpider, "spider"}, + {cMonster::mtSquid, "squid"}, + {cMonster::mtVillager, "villager"}, + {cMonster::mtWitch, "witch"}, + {cMonster::mtWither, "wither"}, + {cMonster::mtWolf, "wolf"}, + {cMonster::mtZombie, "zombie"}, + {cMonster::mtZombiePigman, "zombiepigman"}, +} ; + + + + + +//////////////////////////////////////////////////////////////////////////////// +// cMonster: + +cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) + : super(etMonster, a_Width, a_Height) + , m_EMState(IDLE) + , m_EMPersonality(AGGRESSIVE) + , m_Target(NULL) + , m_bMovingToDestination(false) + , m_LastGroundHeight(POSY_TOINT) + , m_IdleInterval(0) + , m_DestroyTimer(0) + , m_MobType(a_MobType) + , m_SoundHurt(a_SoundHurt) + , m_SoundDeath(a_SoundDeath) + , m_AttackRate(3) + , m_AttackDamage(1) + , m_AttackRange(2) + , m_AttackInterval(0) + , m_SightDistance(25) + , m_DropChanceWeapon(0.085f) + , m_DropChanceHelmet(0.085f) + , m_DropChanceChestplate(0.085f) + , m_DropChanceLeggings(0.085f) + , m_DropChanceBoots(0.085f) + , m_CanPickUpLoot(true) + , m_BurnsInDaylight(false) +{ + if (!a_ConfigName.empty()) + { + GetMonsterConfig(a_ConfigName); + } +} + + + + + +void cMonster::SpawnOn(cClientHandle & a_Client) +{ + a_Client.SendSpawnMob(*this); +} + + + + + +void cMonster::TickPathFinding() +{ + const int PosX = POSX_TOINT; + const int PosY = POSY_TOINT; + const int PosZ = POSZ_TOINT; + + std::vector<Vector3d> m_PotentialCoordinates; + m_TraversedCoordinates.push_back(Vector3i(PosX, PosY, PosZ)); + + static const struct // Define which directions to try to move to + { + int x, z; + } gCrossCoords[] = + { + { 1, 0}, + {-1, 0}, + { 0, 1}, + { 0, -1}, + } ; + + if ((PosY - 1 < 0) || (PosY + 2 > cChunkDef::Height) /* PosY + 1 will never be true if PosY + 2 is not */) + { + // Too low/high, can't really do anything + FinishPathFinding(); + return; + } + + for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++) + { + if (IsCoordinateInTraversedList(Vector3i(gCrossCoords[i].x + PosX, PosY, gCrossCoords[i].z + PosZ))) + { + continue; + } + + BLOCKTYPE BlockAtY = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY, gCrossCoords[i].z + PosZ); + BLOCKTYPE BlockAtYP = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY + 1, gCrossCoords[i].z + PosZ); + BLOCKTYPE BlockAtYPP = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY + 2, gCrossCoords[i].z + PosZ); + int LowestY = FindFirstNonAirBlockPosition(gCrossCoords[i].x + PosX, gCrossCoords[i].z + PosZ); + BLOCKTYPE BlockAtLowestY = m_World->GetBlock(gCrossCoords[i].x + PosX, LowestY, gCrossCoords[i].z + PosZ); + + if ( + (!cBlockInfo::IsSolid(BlockAtY)) && + (!cBlockInfo::IsSolid(BlockAtYP)) && + (!IsBlockLava(BlockAtLowestY)) && + (BlockAtLowestY != E_BLOCK_CACTUS) && + (PosY - LowestY < FALL_DAMAGE_HEIGHT) + ) + { + m_PotentialCoordinates.push_back(Vector3d((gCrossCoords[i].x + PosX), PosY, gCrossCoords[i].z + PosZ)); + } + else if ( + (cBlockInfo::IsSolid(BlockAtY)) && + (BlockAtY != E_BLOCK_CACTUS) && + (!cBlockInfo::IsSolid(BlockAtYP)) && + (!cBlockInfo::IsSolid(BlockAtYPP)) && + (BlockAtY != E_BLOCK_FENCE) && + (BlockAtY != E_BLOCK_FENCE_GATE) + ) + { + m_PotentialCoordinates.push_back(Vector3d((gCrossCoords[i].x + PosX), PosY + 1, gCrossCoords[i].z + PosZ)); + } + } + + if (!m_PotentialCoordinates.empty()) + { + Vector3f ShortestCoords = m_PotentialCoordinates.front(); + for (std::vector<Vector3d>::const_iterator itr = m_PotentialCoordinates.begin(); itr != m_PotentialCoordinates.end(); ++itr) + { + Vector3f Distance = m_FinalDestination - ShortestCoords; + Vector3f Distance2 = m_FinalDestination - *itr; + if (Distance.SqrLength() > Distance2.SqrLength()) + { + ShortestCoords = *itr; + } + } + + m_Destination = ShortestCoords; + m_Destination.z += 0.5f; + m_Destination.x += 0.5f; + } + else + { + FinishPathFinding(); + } +} + + + + + +void cMonster::MoveToPosition(const Vector3d & a_Position) +{ + FinishPathFinding(); + + m_FinalDestination = a_Position; + m_bMovingToDestination = true; + TickPathFinding(); +} + + + +bool cMonster::IsCoordinateInTraversedList(Vector3i a_Coords) +{ + return (std::find(m_TraversedCoordinates.begin(), m_TraversedCoordinates.end(), a_Coords) != m_TraversedCoordinates.end()); +} + + + + + +bool cMonster::ReachedDestination() +{ + if ((m_Destination - GetPosition()).Length() < 0.5f) + { + return true; + } + + return false; +} + + + + +bool cMonster::ReachedFinalDestination() +{ + if ((GetPosition() - m_FinalDestination).Length() <= m_AttackRange) + { + return true; + } + + return false; +} + + + + + +void cMonster::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + if (m_Health <= 0) + { + // The mob is dead, but we're still animating the "puff" they leave when they die + m_DestroyTimer += a_Dt / 1000; + if (m_DestroyTimer > 1) + { + Destroy(true); + } + return; + } + + if ((m_Target != NULL) && m_Target->IsDestroyed()) + m_Target = NULL; + + // Burning in daylight + HandleDaylightBurning(a_Chunk); + + a_Dt /= 1000; + + if (m_bMovingToDestination) + { + if (m_bOnGround) + { + if (DoesPosYRequireJump((int)floor(m_Destination.y))) + { + m_bOnGround = false; + + // TODO: Change to AddSpeedY once collision detection is fixed - currently, mobs will go into blocks attempting to jump without a teleport + AddPosY(1.2); // Jump!! + } + } + + Vector3f Distance = m_Destination - GetPosition(); + if (!ReachedDestination() && !ReachedFinalDestination()) // If we haven't reached any sort of destination, move + { + Distance.y = 0; + Distance.Normalize(); + + if (m_bOnGround) + { + Distance *= 2.5f; + } + else if (IsSwimming()) + { + Distance *= 1.3f; + } + else + { + // Don't let the mob move too much if he's falling. + Distance *= 0.25f; + } + + AddSpeedX(Distance.x); + AddSpeedZ(Distance.z); + + // It's too buggy! + /* + if (m_EMState == ESCAPING) + { + // Runs Faster when escaping :D otherwise they just walk away + SetSpeedX (GetSpeedX() * 2.f); + SetSpeedZ (GetSpeedZ() * 2.f); + } + */ + } + else + { + if (ReachedFinalDestination()) // If we have reached the ultimate, final destination, stop pathfinding and attack if appropriate + { + FinishPathFinding(); + } + else + { + TickPathFinding(); // We have reached the next point in our path, calculate another point + } + } + } + + SetPitchAndYawFromDestination(); + HandleFalling(); + + switch (m_EMState) + { + case IDLE: + { + // If enemy passive we ignore checks for player visibility + InStateIdle(a_Dt); + break; + } + case CHASING: + { + // If we do not see a player anymore skip chasing action + InStateChasing(a_Dt); + break; + } + case ESCAPING: + { + InStateEscaping(a_Dt); + break; + } + + case ATTACKING: break; + } // switch (m_EMState) + + BroadcastMovementUpdate(); +} + + + + +void cMonster::SetPitchAndYawFromDestination() +{ + Vector3d FinalDestination = m_FinalDestination; + if (m_Target != NULL) + { + if (m_Target->IsPlayer()) + { + FinalDestination.y = ((cPlayer *)m_Target)->GetStance(); + } + else + { + FinalDestination.y = GetHeight(); + } + } + + Vector3d Distance = FinalDestination - GetPosition(); + if (Distance.SqrLength() > 0.1f) + { + { + double Rotation, Pitch; + Distance.Normalize(); + VectorToEuler(Distance.x, Distance.y, Distance.z, Rotation, Pitch); + SetHeadYaw(Rotation); + SetPitch(-Pitch); + } + + { + Vector3d BodyDistance = m_Destination - GetPosition(); + double Rotation, Pitch; + Distance.Normalize(); + VectorToEuler(BodyDistance.x, BodyDistance.y, BodyDistance.z, Rotation, Pitch); + SetYaw(Rotation); + } + } +} + + + + +void cMonster::HandleFalling() +{ + if (m_bOnGround) + { + int Damage = (m_LastGroundHeight - POSY_TOINT) - 3; + + if (Damage > 0) + { + TakeDamage(dtFalling, NULL, Damage, Damage, 0); + + // Fall particles + GetWorld()->BroadcastSoundParticleEffect(2006, POSX_TOINT, POSY_TOINT - 1, POSZ_TOINT, Damage /* Used as particle effect speed modifier */); + } + + m_LastGroundHeight = POSY_TOINT; + } +} + + + + + +int cMonster::FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ) +{ + int PosY = POSY_TOINT; + PosY = Clamp(PosY, 0, cChunkDef::Height); + + if (!cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ)))) + { + while (!cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))) && (PosY > 0)) + { + PosY--; + } + + return PosY + 1; + } + else + { + while (cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))) && (PosY < cChunkDef::Height)) + { + PosY++; + } + + return PosY; + } +} + + + + + + +bool cMonster::DoTakeDamage(TakeDamageInfo & a_TDI) +{ + if (!super::DoTakeDamage(a_TDI)) + { + return false; + } + + if (!m_SoundHurt.empty() && (m_Health > 0)) + { + m_World->BroadcastSoundEffect(m_SoundHurt, GetPosX(), GetPosY(), GetPosZ(), 1.0f, 0.8f); + } + + if (a_TDI.Attacker != NULL) + { + m_Target = a_TDI.Attacker; + } + return true; +} + + + + + +void cMonster::KilledBy(TakeDamageInfo & a_TDI) +{ + super::KilledBy(a_TDI); + if (m_SoundHurt != "") + { + m_World->BroadcastSoundEffect(m_SoundDeath, GetPosX(), GetPosY(), GetPosZ(), 1.0f, 0.8f); + } + int Reward; + switch (m_MobType) + { + // Animals + case cMonster::mtChicken: + case cMonster::mtCow: + case cMonster::mtHorse: + case cMonster::mtPig: + case cMonster::mtSheep: + case cMonster::mtSquid: + case cMonster::mtMooshroom: + case cMonster::mtOcelot: + case cMonster::mtWolf: + { + Reward = m_World->GetTickRandomNumber(2) + 1; + break; + } + + // Monsters + case cMonster::mtCaveSpider: + case cMonster::mtCreeper: + case cMonster::mtEnderman: + case cMonster::mtGhast: + case cMonster::mtSilverfish: + case cMonster::mtSkeleton: + case cMonster::mtSpider: + case cMonster::mtWitch: + case cMonster::mtZombie: + case cMonster::mtZombiePigman: + case cMonster::mtSlime: + case cMonster::mtMagmaCube: + { + Reward = 6 + (m_World->GetTickRandomNumber(2)); + break; + } + case cMonster::mtBlaze: + { + Reward = 10; + break; + } + + // Bosses + case cMonster::mtEnderDragon: + { + Reward = 12000; + break; + } + case cMonster::mtWither: + { + Reward = 50; + break; + } + + default: + { + Reward = 0; + break; + } + } + if ((a_TDI.Attacker != NULL) && (!IsBaby())) + { + m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), Reward); + } + m_DestroyTimer = 0; +} + + + + + +// Checks to see if EventSeePlayer should be fired +// monster sez: Do I see the player +void cMonster::CheckEventSeePlayer(void) +{ + // TODO: Rewrite this to use cWorld's DoWithPlayers() + cPlayer * Closest = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance, false); + + if (Closest != NULL) + { + EventSeePlayer(Closest); + } +} + + + + + +void cMonster::CheckEventLostPlayer(void) +{ + if (m_Target != NULL) + { + if ((m_Target->GetPosition() - GetPosition()).Length() > m_SightDistance) + { + EventLosePlayer(); + } + } + else + { + EventLosePlayer(); + } +} + + + + + +// What to do if player is seen +// default to change state to chasing +void cMonster::EventSeePlayer(cEntity * a_SeenPlayer) +{ + m_Target = a_SeenPlayer; +} + + + + + +void cMonster::EventLosePlayer(void) +{ + m_Target = NULL; + m_EMState = IDLE; +} + + + + + +void cMonster::InStateIdle(float a_Dt) +{ + if (m_bMovingToDestination) + { + return; // Still getting there + } + + m_IdleInterval += a_Dt; + + if (m_IdleInterval > 1) + { + // At this interval the results are predictable + int rem = m_World->GetTickRandomNumber(6) + 1; + m_IdleInterval -= 1; // So nothing gets dropped when the server hangs for a few seconds + + Vector3d Dist; + Dist.x = (double)m_World->GetTickRandomNumber(10) - 5; + Dist.z = (double)m_World->GetTickRandomNumber(10) - 5; + + if ((Dist.SqrLength() > 2) && (rem >= 3)) + { + Vector3d Destination(GetPosX() + Dist.x, 0, GetPosZ() + Dist.z); + + int NextHeight = FindFirstNonAirBlockPosition(Destination.x, Destination.z); + + if (IsNextYPosReachable(NextHeight)) + { + Destination.y = NextHeight; + MoveToPosition(Destination); + } + } + } +} + + + + + +// What to do if in Chasing State +// This state should always be defined in each child class +void cMonster::InStateChasing(float a_Dt) +{ + UNUSED(a_Dt); +} + + + + + +// What to do if in Escaping State +void cMonster::InStateEscaping(float a_Dt) +{ + UNUSED(a_Dt); + + if (m_Target != NULL) + { + Vector3d newloc = GetPosition(); + newloc.x = (m_Target->GetPosition().x < newloc.x)? (newloc.x + m_SightDistance): (newloc.x - m_SightDistance); + newloc.z = (m_Target->GetPosition().z < newloc.z)? (newloc.z + m_SightDistance): (newloc.z - m_SightDistance); + MoveToPosition(newloc); + } + else + { + m_EMState = IDLE; // This shouldnt be required but just to be safe + } +} + + + + + +void cMonster::GetMonsterConfig(const AString & a_Name) +{ + cRoot::Get()->GetMonsterConfig()->AssignAttributes(this, a_Name); +} + + + + + +bool cMonster::IsUndead(void) +{ + return false; +} + + + + + +AString cMonster::MobTypeToString(cMonster::eType a_MobType) +{ + // Mob types aren't sorted, so we need to search linearly: + for (size_t i = 0; i < ARRAYCOUNT(g_MobTypeNames); i++) + { + if (g_MobTypeNames[i].m_Type == a_MobType) + { + return g_MobTypeNames[i].m_lcName; + } + } + + // Not found: + return ""; +} + + + + + +cMonster::eType cMonster::StringToMobType(const AString & a_Name) +{ + AString lcName = StrToLower(a_Name); + + // Binary-search for the lowercase name: + int lo = 0, hi = ARRAYCOUNT(g_MobTypeNames) - 1; + while (hi - lo > 1) + { + int mid = (lo + hi) / 2; + int res = strcmp(g_MobTypeNames[mid].m_lcName, lcName.c_str()); + if (res == 0) + { + return g_MobTypeNames[mid].m_Type; + } + if (res < 0) + { + lo = mid; + } + else + { + hi = mid; + } + } + // Range has collapsed to at most two elements, compare each: + if (strcmp(g_MobTypeNames[lo].m_lcName, lcName.c_str()) == 0) + { + return g_MobTypeNames[lo].m_Type; + } + if ((lo != hi) && (strcmp(g_MobTypeNames[hi].m_lcName, lcName.c_str()) == 0)) + { + return g_MobTypeNames[hi].m_Type; + } + + // Not found: + return mtInvalidType; +} + + + + + +cMonster::eFamily cMonster::FamilyFromType(eType a_Type) +{ + // Passive-agressive mobs are counted in mob spawning code as passive + + switch (a_Type) + { + case mtBat: return mfAmbient; + case mtBlaze: return mfHostile; + case mtCaveSpider: return mfHostile; + case mtChicken: return mfPassive; + case mtCow: return mfPassive; + case mtCreeper: return mfHostile; + case mtEnderDragon: return mfNoSpawn; + case mtEnderman: return mfHostile; + case mtGhast: return mfHostile; + case mtGiant: return mfNoSpawn; + case mtHorse: return mfPassive; + case mtIronGolem: return mfPassive; + case mtMagmaCube: return mfHostile; + case mtMooshroom: return mfHostile; + case mtOcelot: return mfPassive; + case mtPig: return mfPassive; + case mtSheep: return mfPassive; + case mtSilverfish: return mfHostile; + case mtSkeleton: return mfHostile; + case mtSlime: return mfHostile; + case mtSnowGolem: return mfNoSpawn; + case mtSpider: return mfHostile; + case mtSquid: return mfWater; + case mtVillager: return mfPassive; + case mtWitch: return mfHostile; + case mtWither: return mfNoSpawn; + case mtWolf: return mfHostile; + case mtZombie: return mfHostile; + case mtZombiePigman: return mfHostile; + + case mtInvalidType: break; + } + ASSERT(!"Unhandled mob type"); + return mfUnhandled; +} + + + + + +int cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily) +{ + switch (a_MobFamily) + { + case mfHostile: return 40; + case mfPassive: return 40; + case mfAmbient: return 40; + case mfWater: return 400; + case mfNoSpawn: return -1; + case mfUnhandled: break; + } + ASSERT(!"Unhandled mob family"); + return -1; +} + + + + + +cMonster * cMonster::NewMonsterFromType(cMonster::eType a_MobType) +{ + cFastRandom Random; + cMonster * toReturn = NULL; + + // Create the mob entity + switch (a_MobType) + { + case mtMagmaCube: + { + toReturn = new cMagmaCube(Random.NextInt(2) + 1); + break; + } + case mtSlime: + { + toReturn = new cSlime(1 << Random.NextInt(3)); // Size 1, 2 or 4 + break; + } + case mtSkeleton: + { + // TODO: Actual detection of spawning in Nether + toReturn = new cSkeleton((Random.NextInt(1) == 0) ? false : true); + break; + } + case mtVillager: + { + int VillagerType = Random.NextInt(6); + if (VillagerType == 6) + { + // Give farmers a better chance of spawning + VillagerType = 0; + } + + toReturn = new cVillager((cVillager::eVillagerType)VillagerType); + break; + } + case mtHorse: + { + // Horses take a type (species), a colour, and a style (dots, stripes, etc.) + int HorseType = Random.NextInt(7); + int HorseColor = Random.NextInt(6); + int HorseStyle = Random.NextInt(6); + int HorseTameTimes = Random.NextInt(6) + 1; + + if ((HorseType == 5) || (HorseType == 6) || (HorseType == 7)) + { + // Increase chances of normal horse (zero) + HorseType = 0; + } + + toReturn = new cHorse(HorseType, HorseColor, HorseStyle, HorseTameTimes); + break; + } + + case mtBat: toReturn = new cBat(); break; + case mtBlaze: toReturn = new cBlaze(); break; + case mtCaveSpider: toReturn = new cCaveSpider(); break; + case mtChicken: toReturn = new cChicken(); break; + case mtCow: toReturn = new cCow(); break; + case mtCreeper: toReturn = new cCreeper(); break; + case mtEnderDragon: toReturn = new cEnderDragon(); break; + case mtEnderman: toReturn = new cEnderman(); break; + case mtGhast: toReturn = new cGhast(); break; + case mtGiant: toReturn = new cGiant(); break; + case mtIronGolem: toReturn = new cIronGolem(); break; + case mtMooshroom: toReturn = new cMooshroom(); break; + case mtOcelot: toReturn = new cOcelot(); break; + case mtPig: toReturn = new cPig(); break; + case mtSheep: toReturn = new cSheep(); break; + case mtSilverfish: toReturn = new cSilverfish(); break; + case mtSnowGolem: toReturn = new cSnowGolem(); break; + case mtSpider: toReturn = new cSpider(); break; + case mtSquid: toReturn = new cSquid(); break; + case mtWitch: toReturn = new cWitch(); break; + case mtWither: toReturn = new cWither(); break; + case mtWolf: toReturn = new cWolf(); break; + case mtZombie: toReturn = new cZombie(false); break; // TODO: Infected zombie parameter + case mtZombiePigman: toReturn = new cZombiePigman(); break; + default: + { + ASSERT(!"Unhandled mob type whilst trying to spawn mob!"); + } + } + return toReturn; +} + + + + + +void cMonster::AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth) +{ + MTRand r1; + int Count = r1.randInt() % (a_Max + 1 - a_Min) + a_Min; + if (Count > 0) + { + a_Drops.push_back(cItem(a_Item, Count, a_ItemHealth)); + } +} + + + + + +void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth) +{ + MTRand r1; + int Count = r1.randInt() % 1000; + if (Count < (a_Chance * 10)) + { + a_Drops.push_back(cItem(a_Item, 1, a_ItemHealth)); + } +} + + + + + +void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel) +{ + MTRand r1; + int Count = r1.randInt() % 200; + if (Count < (5 + a_LootingLevel)) + { + int Rare = r1.randInt() % a_Items.Size(); + a_Drops.push_back(a_Items.at(Rare)); + } +} + + + + + +void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel) +{ + MTRand r1; + if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2))) + { + if (!GetEquippedHelmet().IsEmpty()) a_Drops.push_back(GetEquippedHelmet()); + } + + if (r1.randInt() % 200 < ((m_DropChanceChestplate * 200) + (a_LootingLevel * 2))) + { + if (!GetEquippedChestplate().IsEmpty()) a_Drops.push_back(GetEquippedChestplate()); + } + + if (r1.randInt() % 200 < ((m_DropChanceLeggings * 200) + (a_LootingLevel * 2))) + { + if (!GetEquippedLeggings().IsEmpty()) a_Drops.push_back(GetEquippedLeggings()); + } + + if (r1.randInt() % 200 < ((m_DropChanceBoots * 200) + (a_LootingLevel * 2))) + { + if (!GetEquippedBoots().IsEmpty()) a_Drops.push_back(GetEquippedBoots()); + } +} + + + + + +void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel) +{ + MTRand r1; + if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2))) + { + if (!GetEquippedWeapon().IsEmpty()) a_Drops.push_back(GetEquippedWeapon()); + } +} + + + + + +void cMonster::HandleDaylightBurning(cChunk & a_Chunk) +{ + if (!m_BurnsInDaylight) + { + return; + } + + int RelY = POSY_TOINT; + if ((RelY < 0) || (RelY >= cChunkDef::Height)) + { + // Outside the world + return; + } + + int RelX = POSX_TOINT - GetChunkX() * cChunkDef::Width; + int RelZ = POSZ_TOINT - GetChunkZ() * cChunkDef::Width; + + if (!a_Chunk.IsLightValid()) + { + m_World->QueueLightChunk(GetChunkX(), GetChunkZ()); + return; + } + + if ( + (a_Chunk.GetSkyLight(RelX, RelY, RelZ) == 15) && // In the daylight + (a_Chunk.GetBlock(RelX, RelY, RelZ) != E_BLOCK_SOULSAND) && // Not on soulsand + (GetWorld()->GetTimeOfDay() < (12000 + 1000)) && // It is nighttime + !IsOnFire() && // Not already burning + GetWorld()->IsWeatherWetAt(POSX_TOINT, POSZ_TOINT) // Not raining + ) + { + // Burn for 100 ticks, then decide again + StartBurning(100); + } +} + + + + +cMonster::eFamily cMonster::GetMobFamily(void) const +{ + return FamilyFromType(m_MobType); +} + + + + diff --git a/src/Mobs/Old Mobs/Monster.h b/src/Mobs/Old Mobs/Monster.h new file mode 100644 index 000000000..f0ecc7a93 --- /dev/null +++ b/src/Mobs/Old Mobs/Monster.h @@ -0,0 +1,271 @@ + +#pragma once + +#include "../Entities/Pawn.h" +#include "../Defines.h" +#include "../BlockID.h" +#include "../Item.h" +#include "../Enchantments.h" + + + + + +class cClientHandle; +class cWorld; + + + + +// tolua_begin +class cMonster : + public cPawn +{ + typedef cPawn super; +public: + /// This identifies individual monster type, as well as their network type-ID + enum eType + { + mtInvalidType = -1, + + mtBat = E_META_SPAWN_EGG_BAT, + mtBlaze = E_META_SPAWN_EGG_BLAZE, + mtCaveSpider = E_META_SPAWN_EGG_CAVE_SPIDER, + mtChicken = E_META_SPAWN_EGG_CHICKEN, + mtCow = E_META_SPAWN_EGG_COW, + mtCreeper = E_META_SPAWN_EGG_CREEPER, + mtEnderDragon = E_META_SPAWN_EGG_ENDER_DRAGON, + mtEnderman = E_META_SPAWN_EGG_ENDERMAN, + mtGhast = E_META_SPAWN_EGG_GHAST, + mtGiant = E_META_SPAWN_EGG_GIANT, + mtHorse = E_META_SPAWN_EGG_HORSE, + mtIronGolem = E_META_SPAWN_EGG_IRON_GOLEM, + mtMagmaCube = E_META_SPAWN_EGG_MAGMA_CUBE, + mtMooshroom = E_META_SPAWN_EGG_MOOSHROOM, + mtOcelot = E_META_SPAWN_EGG_OCELOT, + mtPig = E_META_SPAWN_EGG_PIG, + mtSheep = E_META_SPAWN_EGG_SHEEP, + mtSilverfish = E_META_SPAWN_EGG_SILVERFISH, + mtSkeleton = E_META_SPAWN_EGG_SKELETON, + mtSlime = E_META_SPAWN_EGG_SLIME, + mtSnowGolem = E_META_SPAWN_EGG_SNOW_GOLEM, + mtSpider = E_META_SPAWN_EGG_SPIDER, + mtSquid = E_META_SPAWN_EGG_SQUID, + mtVillager = E_META_SPAWN_EGG_VILLAGER, + mtWitch = E_META_SPAWN_EGG_WITCH, + mtWither = E_META_SPAWN_EGG_WITHER, + mtWolf = E_META_SPAWN_EGG_WOLF, + mtZombie = E_META_SPAWN_EGG_ZOMBIE, + mtZombiePigman = E_META_SPAWN_EGG_ZOMBIE_PIGMAN, + } ; + + enum eFamily + { + mfHostile = 0, // Spider, Zombies ... + mfPassive = 1, // Cows, Pigs + mfAmbient = 2, // Bats + mfWater = 3, // Squid + + mfNoSpawn, + mfUnhandled, // Nothing. Be sure this is the last and the others are in order + } ; + + // tolua_end + + enum MState{ATTACKING, IDLE, CHASING, ESCAPING} m_EMState; + enum MPersonality{PASSIVE, AGGRESSIVE, COWARDLY} m_EMPersonality; + + /** Creates the mob object. + If a_ConfigName is not empty, the configuration is loaded using GetMonsterConfig() + a_MobType is the type of the mob (also used in the protocol ( http://wiki.vg/Entities#Mobs 2012_12_22)) + a_SoundHurt and a_SoundDeath are assigned into m_SoundHurt and m_SoundDeath, respectively + */ + cMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); + + CLASS_PROTODEF(cMonster) + + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; + + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + + virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) /*override*/; + + virtual void KilledBy(TakeDamageInfo & a_TDI) /*override*/; + + virtual void MoveToPosition(const Vector3d & a_Position); // tolua_export + virtual bool ReachedDestination(void); + + // tolua_begin + eType GetMobType(void) const {return m_MobType; } + eFamily GetMobFamily(void) const; + // tolua_end + + virtual void CheckEventSeePlayer(void); + virtual void EventSeePlayer(cEntity * a_Player); + + /// Reads the monster configuration for the specified monster name and assigns it to this object. + void GetMonsterConfig(const AString & a_Name); + + /** Returns whether this mob is undead (skeleton, zombie, etc.) */ + virtual bool IsUndead(void); + + virtual void EventLosePlayer(void); + virtual void CheckEventLostPlayer(void); + + virtual void InStateIdle (float a_Dt); + virtual void InStateChasing (float a_Dt); + virtual void InStateEscaping(float a_Dt); + + int GetAttackRate() { return (int)m_AttackRate; } + void SetAttackRate(float a_AttackRate) { m_AttackRate = a_AttackRate; } + void SetAttackRange(int a_AttackRange) { m_AttackRange = a_AttackRange; } + void SetAttackDamage(int a_AttackDamage) { m_AttackDamage = a_AttackDamage; } + void SetSightDistance(int a_SightDistance) { m_SightDistance = a_SightDistance; } + + float GetDropChanceWeapon() { return m_DropChanceWeapon; } + float GetDropChanceHelmet() { return m_DropChanceHelmet; } + float GetDropChanceChestplate() { return m_DropChanceChestplate; } + float GetDropChanceLeggings() { return m_DropChanceLeggings; } + float GetDropChanceBoots() { return m_DropChanceBoots; } + bool CanPickUpLoot() { return m_CanPickUpLoot; } + void SetDropChanceWeapon(float a_DropChanceWeapon) { m_DropChanceWeapon = a_DropChanceWeapon; } + void SetDropChanceHelmet(float a_DropChanceHelmet) { m_DropChanceHelmet = a_DropChanceHelmet; } + void SetDropChanceChestplate(float a_DropChanceChestplate) { m_DropChanceChestplate = a_DropChanceChestplate; } + void SetDropChanceLeggings(float a_DropChanceLeggings) { m_DropChanceLeggings = a_DropChanceLeggings; } + void SetDropChanceBoots(float a_DropChanceBoots) { m_DropChanceBoots = a_DropChanceBoots; } + void SetCanPickUpLoot(bool a_CanPickUpLoot) { m_CanPickUpLoot = a_CanPickUpLoot; } + + /// Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick + void SetBurnsInDaylight(bool a_BurnsInDaylight) { m_BurnsInDaylight = a_BurnsInDaylight; } + + // Overridables to handle ageable mobs + virtual bool IsBaby (void) const { return false; } + virtual bool IsTame (void) const { return false; } + virtual bool IsSitting (void) const { return false; } + + // tolua_begin + + /// Translates MobType enum to a string, empty string if unknown + static AString MobTypeToString(eType a_MobType); + + /// Translates MobType string to the enum, mtInvalidType if not recognized + static eType StringToMobType(const AString & a_MobTypeName); + + /// Returns the mob family based on the type + static eFamily FamilyFromType(eType a_MobType); + + /// Returns the spawn delay (number of game ticks between spawn attempts) for the given mob family + static int GetSpawnDelay(cMonster::eFamily a_MobFamily); + + // tolua_end + + /** Creates a new object of the specified mob. + a_MobType is the type of the mob to be created + Asserts and returns null if mob type is not specified + */ + static cMonster * NewMonsterFromType(eType a_MobType); + +protected: + + /* ======= PATHFINDING ======= */ + + /** A pointer to the entity this mobile is aiming to reach */ + cEntity * m_Target; + /** Coordinates of the next position that should be reached */ + Vector3d m_Destination; + /** Coordinates for the ultimate, final destination. */ + Vector3d m_FinalDestination; + /** Returns if the ultimate, final destination has been reached */ + bool ReachedFinalDestination(void); + + /** Stores if mobile is currently moving towards the ultimate, final destination */ + bool m_bMovingToDestination; + + /** Finds the first non-air block position (not the highest, as cWorld::GetHeight does) + If current Y is nonsolid, goes down to try to find a solid block, then returns that + 1 + If current Y is solid, goes up to find first nonsolid block, and returns that */ + int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ); + /** Returns if a monster can actually reach a given height by jumping or walking */ + inline bool IsNextYPosReachable(int a_PosY) + { + return ( + (a_PosY <= POSY_TOINT) || + DoesPosYRequireJump(a_PosY) + ); + } + /** Returns if a monster can reach a given height by jumping */ + inline bool DoesPosYRequireJump(int a_PosY) + { + return ((a_PosY > POSY_TOINT) && (a_PosY == POSY_TOINT + 1)); + } + + /** A semi-temporary list to store the traversed coordinates during active pathfinding so we don't visit them again */ + std::vector<Vector3i> m_TraversedCoordinates; + /** Returns if coordinate is in the traversed list */ + bool IsCoordinateInTraversedList(Vector3i a_Coords); + + /** Finds the next place to go + This is based on the ultimate, final destination and the current position, as well as the traversed coordinates, and any environmental hazards */ + void TickPathFinding(void); + /** Finishes a pathfinding task, be it due to failure or something else */ + inline void FinishPathFinding(void) + { + m_TraversedCoordinates.clear(); + m_bMovingToDestination = false; + } + /** Sets the body yaw and head yaw/pitch based on next/ultimate destinations */ + void SetPitchAndYawFromDestination(void); + + /* =========================== */ + /* ========= FALLING ========= */ + + virtual void HandleFalling(void); + int m_LastGroundHeight; + + /* =========================== */ + + float m_IdleInterval; + float m_DestroyTimer; + + eType m_MobType; + + AString m_SoundHurt; + AString m_SoundDeath; + + float m_AttackRate; + int m_AttackDamage; + int m_AttackRange; + float m_AttackInterval; + int m_SightDistance; + + float m_DropChanceWeapon; + float m_DropChanceHelmet; + float m_DropChanceChestplate; + float m_DropChanceLeggings; + float m_DropChanceBoots; + bool m_CanPickUpLoot; + + void HandleDaylightBurning(cChunk & a_Chunk); + bool m_BurnsInDaylight; + + /** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/ + void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0); + + /** Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops*/ + void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0); + + /** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/ + void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel); + + /** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/ + void AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel); + + /** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/ + void AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel); + + +} ; // tolua_export + + + + diff --git a/src/Mobs/Old Mobs/Mooshroom.cpp b/src/Mobs/Old Mobs/Mooshroom.cpp new file mode 100644 index 000000000..81bd3e3b4 --- /dev/null +++ b/src/Mobs/Old Mobs/Mooshroom.cpp @@ -0,0 +1,75 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Mooshroom.h" +#include "../Entities/Player.h" + + + + + + + + + + +cMooshroom::cMooshroom(void) : + super("Mooshroom", mtMooshroom, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3) +{ +} + + + + + +void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER); + AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF); +} + + + + + +void cMooshroom::OnRightClicked(cPlayer & a_Player) +{ + switch (a_Player.GetEquippedItem().m_ItemType) + { + case E_ITEM_BUCKET: + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + a_Player.GetInventory().AddItem(E_ITEM_MILK); + } + } break; + case E_ITEM_BOWL: + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + a_Player.GetInventory().AddItem(E_ITEM_MUSHROOM_SOUP); + } + } break; + case E_ITEM_SHEARS: + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.UseEquippedItem(); + } + + cItems Drops; + Drops.push_back(cItem(E_BLOCK_RED_MUSHROOM, 5, 0)); + m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); + m_World->SpawnMob(GetPosX(), GetPosY(), GetPosZ(), cMonster::mtCow); + Destroy(); + } break; + } +} + diff --git a/src/Mobs/Old Mobs/Mooshroom.h b/src/Mobs/Old Mobs/Mooshroom.h new file mode 100644 index 000000000..55b6ff0d9 --- /dev/null +++ b/src/Mobs/Old Mobs/Mooshroom.h @@ -0,0 +1,28 @@ + +#pragma once + +#include "PassiveMonster.h" + + + + + +class cMooshroom : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + cMooshroom(void); + + CLASS_PROTODEF(cMooshroom) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + + virtual const cItem GetFollowedItem(void) const /*override*/ { return cItem(E_ITEM_WHEAT); } +} ; + + + + diff --git a/src/Mobs/Old Mobs/Ocelot.h b/src/Mobs/Old Mobs/Ocelot.h new file mode 100644 index 000000000..f2727d354 --- /dev/null +++ b/src/Mobs/Old Mobs/Ocelot.h @@ -0,0 +1,26 @@ + +#pragma once + +#include "PassiveMonster.h" + + + + + +class cOcelot : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + cOcelot(void) : + super("Ocelot", mtOcelot, "mob.cat.hitt", "mob.cat.hitt", 0.6, 0.8) + { + } + + CLASS_PROTODEF(cOcelot) +} ; + + + + diff --git a/src/Mobs/PassiveAggressiveMonster.cpp b/src/Mobs/Old Mobs/PassiveAggressiveMonster.cpp index 24501b1ba..24501b1ba 100644 --- a/src/Mobs/PassiveAggressiveMonster.cpp +++ b/src/Mobs/Old Mobs/PassiveAggressiveMonster.cpp diff --git a/src/Mobs/PassiveAggressiveMonster.h b/src/Mobs/Old Mobs/PassiveAggressiveMonster.h index a0da50e8e..0fa5af34f 100644 --- a/src/Mobs/PassiveAggressiveMonster.h +++ b/src/Mobs/Old Mobs/PassiveAggressiveMonster.h @@ -15,7 +15,7 @@ class cPassiveAggressiveMonster : public: cPassiveAggressiveMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); - virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; + virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) /*override*/; } ; diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/Old Mobs/PassiveMonster.cpp index 2861d7314..2861d7314 100644 --- a/src/Mobs/PassiveMonster.cpp +++ b/src/Mobs/Old Mobs/PassiveMonster.cpp diff --git a/src/Mobs/PassiveMonster.h b/src/Mobs/Old Mobs/PassiveMonster.h index 70574585a..70033fe09 100644 --- a/src/Mobs/PassiveMonster.h +++ b/src/Mobs/Old Mobs/PassiveMonster.h @@ -15,10 +15,10 @@ class cPassiveMonster : public: cPassiveMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; /// When hit by someone, run away - virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; + virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) /*override*/; /** Returns the item that the animal of this class follows when a player holds it in hand Return an empty item not to follow (default). */ virtual const cItem GetFollowedItem(void) const { return cItem(); } diff --git a/src/Mobs/Old Mobs/Pig.cpp b/src/Mobs/Old Mobs/Pig.cpp new file mode 100644 index 000000000..1f77cf613 --- /dev/null +++ b/src/Mobs/Old Mobs/Pig.cpp @@ -0,0 +1,100 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Pig.h" +#include "../Entities/Player.h" +#include "../World.h" + + + + + +cPig::cPig(void) : + super("Pig", mtPig, "mob.pig.say", "mob.pig.death", 0.9, 0.9), + m_bIsSaddled(false) +{ +} + + + + + +void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP); + if (m_bIsSaddled) + { + a_Drops.push_back(cItem(E_ITEM_SADDLE, 1)); + } +} + + + + + +void cPig::OnRightClicked(cPlayer & a_Player) +{ + if (m_bIsSaddled) + { + if (m_Attachee != NULL) + { + if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID()) + { + // This player is already sitting in, they want out. + a_Player.Detach(); + return; + } + + if (m_Attachee->IsPlayer()) + { + // Another player is already sitting in here, cannot attach + return; + } + + // Detach whatever is sitting in this pig now: + m_Attachee->Detach(); + } + + // Attach the player to this pig + a_Player.AttachTo(this); + } + else if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE) + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + + // Set saddle state & broadcast metadata + m_bIsSaddled = true; + m_World->BroadcastEntityMetadata(*this); + } +} + + + + + +void cPig::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + // If the attachee player is holding a carrot-on-stick, let them drive this pig: + if (m_bIsSaddled && (m_Attachee != NULL)) + { + if (m_Attachee->IsPlayer() && (m_Attachee->GetEquippedWeapon().m_ItemType == E_ITEM_CARROT_ON_STICK)) + { + MoveToPosition((m_Attachee->GetPosition()) + (m_Attachee->GetLookVector()*10)); + m_bMovingToDestination = true; + } + } +} + + + + diff --git a/src/Mobs/Old Mobs/Pig.h b/src/Mobs/Old Mobs/Pig.h new file mode 100644 index 000000000..abd2d2299 --- /dev/null +++ b/src/Mobs/Old Mobs/Pig.h @@ -0,0 +1,36 @@ + +#pragma once + +#include "PassiveMonster.h" + + + + + +class cPig : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + cPig(void); + + CLASS_PROTODEF(cPig) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + + virtual const cItem GetFollowedItem(void) const /*override*/ { return cItem(E_ITEM_CARROT); } + + bool IsSaddled(void) const { return m_bIsSaddled; } + +private: + + bool m_bIsSaddled; + +} ; + + + + diff --git a/src/Mobs/Old Mobs/Sheep.cpp b/src/Mobs/Old Mobs/Sheep.cpp new file mode 100644 index 000000000..9fb47201d --- /dev/null +++ b/src/Mobs/Old Mobs/Sheep.cpp @@ -0,0 +1,154 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Sheep.h" +#include "../BlockID.h" +#include "../Entities/Player.h" +#include "../World.h" +#include "FastRandom.h" + + + + + +cSheep::cSheep(int a_Color) : + super("Sheep", mtSheep, "mob.sheep.say", "mob.sheep.say", 0.6, 1.3), + m_IsSheared(false), + m_WoolColor(a_Color), + m_TimeToStopEating(-1) +{ + // Generate random wool color. + if (m_WoolColor == -1) + { + m_WoolColor = GenerateNaturalRandomColor(); + } + + if ((m_WoolColor < 0) || (m_WoolColor > 15)) + { + m_WoolColor = 0; + } +} + + + + + +void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + if (!m_IsSheared) + { + a_Drops.push_back(cItem(E_BLOCK_WOOL, 1, m_WoolColor)); + } +} + + + + + +void cSheep::OnRightClicked(cPlayer & a_Player) +{ + const cItem & EquippedItem = a_Player.GetEquippedItem(); + if ((EquippedItem.m_ItemType == E_ITEM_SHEARS) && !IsSheared() && !IsBaby()) + { + m_IsSheared = true; + m_World->BroadcastEntityMetadata(*this); + a_Player.UseEquippedItem(); + + cItems Drops; + int NumDrops = m_World->GetTickRandomNumber(2) + 1; + Drops.push_back(cItem(E_BLOCK_WOOL, NumDrops, m_WoolColor)); + m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); + m_World->BroadcastSoundEffect("mob.sheep.shear", GetPosX(), GetPosY(), GetPosZ(), 1.0f, 1.0f); + } + else if ((EquippedItem.m_ItemType == E_ITEM_DYE) && (m_WoolColor != 15 - EquippedItem.m_ItemDamage)) + { + m_WoolColor = 15 - EquippedItem.m_ItemDamage; + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + m_World->BroadcastEntityMetadata(*this); + } +} + + + + + +void cSheep::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + int PosX = POSX_TOINT; + int PosY = POSY_TOINT - 1; + int PosZ = POSZ_TOINT; + + if ((PosY <= 0) || (PosY > cChunkDef::Height)) + { + return; + } + + if (m_TimeToStopEating > 0) + { + m_bMovingToDestination = false; // The sheep should not move when he's eating + m_TimeToStopEating--; + + if (m_TimeToStopEating == 0) + { + if (m_World->GetBlock(PosX, PosY, PosZ) == E_BLOCK_GRASS) // Make sure grass hasn't been destroyed in the meantime + { + // The sheep ate the grass so we change it to dirt + m_World->SetBlock(PosX, PosY, PosZ, E_BLOCK_DIRT, 0); + GetWorld()->BroadcastSoundParticleEffect(2001, PosX, PosY, PosX, E_BLOCK_GRASS); + m_IsSheared = false; + m_World->BroadcastEntityMetadata(*this); + } + } + } + else + { + if (m_World->GetTickRandomNumber(600) == 1) + { + if (m_World->GetBlock(PosX, PosY, PosZ) == E_BLOCK_GRASS) + { + m_World->BroadcastEntityStatus(*this, esSheepEating); + m_TimeToStopEating = 40; + } + } + } +} + + + + + +NIBBLETYPE cSheep::GenerateNaturalRandomColor(void) +{ + cFastRandom Random; + int Chance = Random.NextInt(101); + + if (Chance <= 81) + { + return E_META_WOOL_WHITE; + } + else if (Chance <= 86) + { + return E_META_WOOL_BLACK; + } + else if (Chance <= 91) + { + return E_META_WOOL_GRAY; + } + else if (Chance <= 96) + { + return E_META_WOOL_LIGHTGRAY; + } + else if (Chance <= 99) + { + return E_META_WOOL_BROWN; + } + else + { + return E_META_WOOL_PINK; + } +} + diff --git a/src/Mobs/Old Mobs/Sheep.h b/src/Mobs/Old Mobs/Sheep.h new file mode 100644 index 000000000..b19fca244 --- /dev/null +++ b/src/Mobs/Old Mobs/Sheep.h @@ -0,0 +1,50 @@ + +#pragma once + +#include "PassiveMonster.h" + + + + + +class cSheep : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + + /** The number is the color of the sheep. + Use E_META_WOOL_* constants for the wool color. + If you type -1, the server will generate a random color + with the GenerateNaturalRandomColor() function. */ + cSheep(int a_Color = -1); + + CLASS_PROTODEF(cSheep) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + + virtual const cItem GetFollowedItem(void) const /*override*/ { return cItem(E_ITEM_WHEAT); } + + /** Generates a random color for the sheep like the vanilla server. + The percent's where used are from the wiki: http://minecraft.gamepedia.com/Sheep#Breeding */ + static NIBBLETYPE GenerateNaturalRandomColor(void); + + bool IsSheared(void) const { return m_IsSheared; } + void SetSheared(bool a_IsSheared) { m_IsSheared = a_IsSheared; } + + int GetFurColor(void) const { return m_WoolColor; } + void SetFurColor(int a_WoolColor) { m_WoolColor = a_WoolColor; } + +private: + bool m_IsSheared; + int m_WoolColor; + int m_TimeToStopEating; + +} ; + + + + diff --git a/src/Mobs/Old Mobs/Silverfish.h b/src/Mobs/Old Mobs/Silverfish.h new file mode 100644 index 000000000..2df333dbc --- /dev/null +++ b/src/Mobs/Old Mobs/Silverfish.h @@ -0,0 +1,26 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cSilverfish : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cSilverfish(void) : + super("Silverfish", mtSilverfish, "mob.silverfish.hit", "mob.silverfish.kill", 0.3, 0.7) + { + } + + CLASS_PROTODEF(cSilverfish) +} ; + + + + diff --git a/src/Mobs/Old Mobs/Skeleton.cpp b/src/Mobs/Old Mobs/Skeleton.cpp new file mode 100644 index 000000000..cd707f4bb --- /dev/null +++ b/src/Mobs/Old Mobs/Skeleton.cpp @@ -0,0 +1,107 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Skeleton.h" +#include "../World.h" +#include "../Entities/ArrowEntity.h" +#include "ClientHandle.h" + + + + +cSkeleton::cSkeleton(bool IsWither) : + super("Skeleton", mtSkeleton, "mob.skeleton.hurt", "mob.skeleton.death", 0.6, 1.8), + m_bIsWither(IsWither) +{ + SetBurnsInDaylight(true); +} + + + + + +void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + if (IsWither()) + { + AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_COAL); + cItems RareDrops; + RareDrops.Add(cItem(E_ITEM_HEAD, 1, 1)); + AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel); + } + else + { + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ARROW); + + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE); + AddRandomArmorDropItem(a_Drops, LootingLevel); + AddRandomWeaponDropItem(a_Drops, LootingLevel); +} + + + + + +void cSkeleton::MoveToPosition(const Vector3d & a_Position) +{ + // If the destination is sufficiently skylight challenged AND the skeleton isn't on fire then block the movement + if ( + !IsOnFire() && + (m_World->GetBlockSkyLight((int)floor(a_Position.x), (int)floor(a_Position.y), (int)floor(a_Position.z)) - m_World->GetSkyDarkness() > 8) + ) + { + m_bMovingToDestination = false; + return; + } + + super::MoveToPosition(a_Position); +} + + + + + +void cSkeleton::Attack(float a_Dt) +{ + m_AttackInterval += a_Dt * m_AttackRate; + + if (m_Target != NULL && m_AttackInterval > 3.0) + { + // Setting this higher gives us more wiggle room for attackrate + Vector3d Speed = GetLookVector() * 20; + Speed.y = Speed.y + 1; + cArrowEntity * Arrow = new cArrowEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); + if (Arrow == NULL) + { + return; + } + if (!Arrow->Initialize(*m_World)) + { + delete Arrow; + Arrow = NULL; + return; + } + m_World->BroadcastSpawnEntity(*Arrow); + m_AttackInterval = 0.0; + } +} + + + + + +void cSkeleton::SpawnOn(cClientHandle & a_ClientHandle) +{ + super::SpawnOn(a_ClientHandle); + a_ClientHandle.SendEntityEquipment(*this, 0, cItem(E_ITEM_BOW)); +} + + + + diff --git a/src/Mobs/Old Mobs/Skeleton.h b/src/Mobs/Old Mobs/Skeleton.h new file mode 100644 index 000000000..2206a5203 --- /dev/null +++ b/src/Mobs/Old Mobs/Skeleton.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cSkeleton : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cSkeleton(bool IsWither); + + CLASS_PROTODEF(cSkeleton) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void MoveToPosition(const Vector3d & a_Position) /*override*/; + virtual void Attack(float a_Dt) /*override*/; + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; + + virtual bool IsUndead(void) /*override*/ { return true; } + + bool IsWither(void) const { return m_bIsWither; } + +private: + + bool m_bIsWither; + +} ; + + + + diff --git a/src/Mobs/Old Mobs/Slime.cpp b/src/Mobs/Old Mobs/Slime.cpp new file mode 100644 index 000000000..b709ec664 --- /dev/null +++ b/src/Mobs/Old Mobs/Slime.cpp @@ -0,0 +1,106 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Slime.h" +#include "FastRandom.h" +#include "World.h" + + + + + +cSlime::cSlime(int a_Size) : + super("Slime", + mtSlime, + Printf("mob.slime.%s", GetSizeName(a_Size).c_str()), + Printf("mob.slime.%s", GetSizeName(a_Size).c_str()), + 0.6 * a_Size, + 0.6 * a_Size + ), + m_Size(a_Size) +{ + SetMaxHealth(a_Size * a_Size); + SetAttackDamage(a_Size); +} + + + + + +void cSlime::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + + // Only slimes with the size 1 can drop slimeballs. + if (m_Size == 1) + { + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SLIMEBALL); + } +} + + + + + +void cSlime::Attack(float a_Dt) +{ + if (m_Size > 1) + { + // Only slimes larger than size 1 attack a player. + super::Attack(a_Dt); + } +} + + + + + +void cSlime::KilledBy(TakeDamageInfo & a_TDI) +{ + if (GetHealth() > 0) + { + return; + } + + if (m_Size != 1) + { + cFastRandom Random; + int SpawnAmount = 2 + Random.NextInt(3); + + for (int i = 0; i < SpawnAmount; ++i) + { + double AddX = (i % 2 - 0.5) * m_Size / 4.0; + double AddZ = (i / 2 - 0.5) * m_Size / 4.0; + + cSlime * NewSlime = new cSlime(m_Size / 2); + NewSlime->SetPosition(GetPosX() + AddX, GetPosY() + 0.5, GetPosZ() + AddZ); + NewSlime->SetYaw(Random.NextFloat(1.0f) * 360.0f); + m_World->SpawnMobFinalize(NewSlime); + } + } + super::KilledBy(a_TDI); +} + + + + + +const AString cSlime::GetSizeName(int a_Size) const +{ + if (a_Size > 1) + { + return "big"; + } + else + { + return "small"; + } +} + + + + diff --git a/src/Mobs/Old Mobs/Slime.h b/src/Mobs/Old Mobs/Slime.h new file mode 100644 index 000000000..433660c22 --- /dev/null +++ b/src/Mobs/Old Mobs/Slime.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cSlime : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + /** Creates a slime of the specified size; size can be 1, 2 or 4, with 1 is the smallest and 4 is the tallest. */ + cSlime(int a_Size); + + CLASS_PROTODEF(cSlime) + + // cAggressiveMonster /*override*/s: + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void Attack(float a_Dt) /*override*/; + virtual void KilledBy(TakeDamageInfo & a_TDI) /*override*/; + + int GetSize(void) const { return m_Size; } + + /** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds. + Returns either "big" or "small". */ + const AString GetSizeName(int a_Size) const; + +protected: + + /** Size of the slime, with 1 being the smallest. + Vanilla uses sizes 1, 2 and 4 only. */ + int m_Size; +} ; + + + + diff --git a/src/Mobs/Old Mobs/SnowGolem.cpp b/src/Mobs/Old Mobs/SnowGolem.cpp new file mode 100644 index 000000000..76334d970 --- /dev/null +++ b/src/Mobs/Old Mobs/SnowGolem.cpp @@ -0,0 +1,46 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "SnowGolem.h" +#include "../World.h" + + + + + +cSnowGolem::cSnowGolem(void) : + super("SnowGolem", mtSnowGolem, "", "", 0.4, 1.8) +{ +} + + + + + +void cSnowGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + UNUSED(a_Killer); + AddRandomDropItem(a_Drops, 0, 15, E_ITEM_SNOWBALL); +} + + + + + +void cSnowGolem::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + if (IsBiomeNoDownfall(m_World->GetBiomeAt((int) floor(GetPosX()), (int) floor(GetPosZ())))) + { + TakeDamage(*this); + } + else + { + BLOCKTYPE BlockBelow = m_World->GetBlock((int) floor(GetPosX()), (int) floor(GetPosY()) - 1, (int) floor(GetPosZ())); + BLOCKTYPE Block = m_World->GetBlock((int) floor(GetPosX()), (int) floor(GetPosY()), (int) floor(GetPosZ())); + if (Block == E_BLOCK_AIR && cBlockInfo::IsSolid(BlockBelow)) + { + m_World->SetBlock((int) floor(GetPosX()), (int) floor(GetPosY()), (int) floor(GetPosZ()), E_BLOCK_SNOW, 0); + } + } +} diff --git a/src/Mobs/Old Mobs/SnowGolem.h b/src/Mobs/Old Mobs/SnowGolem.h new file mode 100644 index 000000000..9ab665bc7 --- /dev/null +++ b/src/Mobs/Old Mobs/SnowGolem.h @@ -0,0 +1,26 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cSnowGolem : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cSnowGolem(void); + + CLASS_PROTODEF(cSnowGolem) + + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; +} ; + + + + diff --git a/src/Mobs/Old Mobs/Spider.cpp b/src/Mobs/Old Mobs/Spider.cpp new file mode 100644 index 000000000..8b978ff6b --- /dev/null +++ b/src/Mobs/Old Mobs/Spider.cpp @@ -0,0 +1,35 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Spider.h" + + + + + +cSpider::cSpider(void) : + super("Spider", mtSpider, "mob.spider.say", "mob.spider.death", 1.4, 0.9) +{ +} + + + + + +void cSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING); + if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf"))) + { + AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE); + } +} + + + + diff --git a/src/Mobs/Old Mobs/Spider.h b/src/Mobs/Old Mobs/Spider.h new file mode 100644 index 000000000..2cf3ac0e3 --- /dev/null +++ b/src/Mobs/Old Mobs/Spider.h @@ -0,0 +1,25 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cSpider : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cSpider(void); + + CLASS_PROTODEF(cSpider) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; +} ; + + + + diff --git a/src/Mobs/Old Mobs/Squid.cpp b/src/Mobs/Old Mobs/Squid.cpp new file mode 100644 index 000000000..bd0e141a0 --- /dev/null +++ b/src/Mobs/Old Mobs/Squid.cpp @@ -0,0 +1,62 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Squid.h" +#include "../Vector3.h" +#include "../Chunk.h" + + + + + +cSquid::cSquid(void) : + super("Squid", mtSquid, "", "", 0.95, 0.95) +{ +} + + + + + +void cSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + // Drops 0-3 Ink Sacs + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 3 + LootingLevel, E_ITEM_DYE, E_META_DYE_BLACK); +} + + + + + +void cSquid::Tick(float a_Dt, cChunk & a_Chunk) +{ + // We must first process current location, and only then tick, otherwise we risk processing a location in a chunk + // that is not where the entity currently resides (FS #411) + + Vector3d Pos = GetPosition(); + + // TODO: Not a real behavior, but cool :D + int RelY = (int)floor(Pos.y); + if ((RelY < 0) || (RelY >= cChunkDef::Height)) + { + return; + } + int RelX = (int)floor(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width; + int RelZ = (int)floor(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width; + BLOCKTYPE BlockType; + if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire()) + { + // Burn for 10 ticks, then decide again + StartBurning(10); + } + + super::Tick(a_Dt, a_Chunk); +} + + + diff --git a/src/Mobs/Old Mobs/Squid.h b/src/Mobs/Old Mobs/Squid.h new file mode 100644 index 000000000..884a80de3 --- /dev/null +++ b/src/Mobs/Old Mobs/Squid.h @@ -0,0 +1,31 @@ + +#pragma once + +#include "PassiveMonster.h" + + + + + +class cSquid : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + cSquid(); + + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + + CLASS_PROTODEF(cSquid) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + + // Squids do not drown (or float) + virtual void HandleAir(void) /*override*/ {} + virtual void SetSwimState(cChunk & a_Chunk) /*override*/ {} +} ; + + + + diff --git a/src/Mobs/Old Mobs/Villager.cpp b/src/Mobs/Old Mobs/Villager.cpp new file mode 100644 index 000000000..1cdac7c74 --- /dev/null +++ b/src/Mobs/Old Mobs/Villager.cpp @@ -0,0 +1,197 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Villager.h" +#include "../World.h" +#include "../BlockArea.h" +#include "../Blocks/BlockHandler.h" +#include "../BlockInServerPluginInterface.h" + + + + + +cVillager::cVillager(eVillagerType VillagerType) : + super("Villager", mtVillager, "", "", 0.6, 1.8), + m_ActionCountDown(-1), + m_Type(VillagerType), + m_VillagerAction(false) +{ +} + + + + + +bool cVillager::DoTakeDamage(TakeDamageInfo & a_TDI) +{ + if (!super::DoTakeDamage(a_TDI)) + { + return false; + } + + if ((a_TDI.Attacker != NULL) && a_TDI.Attacker->IsPlayer()) + { + if (m_World->GetTickRandomNumber(5) == 3) + { + m_World->BroadcastEntityStatus(*this, esVillagerAngry); + } + } + return true; +} + + + + + +void cVillager::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + if (m_ActionCountDown > -1) + { + m_ActionCountDown--; + if (m_ActionCountDown == 0) + { + switch (m_Type) + { + case vtFarmer: + { + HandleFarmerPlaceCrops(); + } + } + } + return; + } + + if (m_VillagerAction) + { + switch (m_Type) + { + case vtFarmer: + { + HandleFarmerTryHarvestCrops(); + } + } + m_VillagerAction = false; + return; + } + + // Don't always try to do a special action. Each tick has 1% to do a special action. + if (m_World->GetTickRandomNumber(99) != 0) + { + return; + } + + switch (m_Type) + { + case vtFarmer: + { + HandleFarmerPrepareFarmCrops(); + } + } +} + + + + +//////////////////////////////////////////////////////////////////////////////// +// Farmer functions. +void cVillager::HandleFarmerPrepareFarmCrops() +{ + if (!m_World->VillagersShouldHarvestCrops()) + { + return; + } + + cBlockArea Surrounding; + /// Read a 11x7x11 area. + Surrounding.Read( + m_World, + (int) GetPosX() - 5, + (int) GetPosX() + 5, + (int) GetPosY() - 3, + (int) GetPosY() + 3, + (int) GetPosZ() - 5, + (int) GetPosZ() + 5 + ); + + for (int I = 0; I < 5; I++) + { + for (int Y = 0; Y < 6; Y++) + { + // Pick random coordinates and check for crops. + int X = m_World->GetTickRandomNumber(11); + int Z = m_World->GetTickRandomNumber(11); + + // A villager can't farm this. + if (!IsBlockFarmable(Surrounding.GetRelBlockType(X, Y, Z))) + { + continue; + } + if (Surrounding.GetRelBlockMeta(X, Y, Z) != 0x7) + { + continue; + } + + m_VillagerAction = true; + m_CropsPos = Vector3i((int) GetPosX() + X - 5, (int) GetPosY() + Y - 3, (int) GetPosZ() + Z - 5); + MoveToPosition(Vector3f((float) (m_CropsPos.x + 0.5), (float) m_CropsPos.y, (float) (m_CropsPos.z + 0.5))); + return; + } // for Y loop. + } // Repeat the procces 5 times. +} + + + + + +void cVillager::HandleFarmerTryHarvestCrops() +{ + // Harvest the crops if the villager isn't moving and if the crops are closer then 2 blocks. + if (!m_bMovingToDestination && (GetPosition() - m_CropsPos).Length() < 2) + { + // Check if the blocks didn't change while the villager was walking to the coordinates. + BLOCKTYPE CropBlock = m_World->GetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z); + if (IsBlockFarmable(CropBlock) && m_World->GetBlockMeta(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z) == 0x7) + { + cBlockHandler * Handler = cBlockInfo::GetHandler(CropBlock); + cChunkInterface ChunkInterface(m_World->GetChunkMap()); + cBlockInServerPluginInterface PluginInterface(*m_World); + Handler->DropBlock(ChunkInterface, *m_World, PluginInterface, this, m_CropsPos.x, m_CropsPos.y, m_CropsPos.z); + m_World->SetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z, E_BLOCK_AIR, 0); + m_ActionCountDown = 20; + } + } +} + + + + +void cVillager::HandleFarmerPlaceCrops() +{ + // Check if there is still farmland at the spot where the crops were. + if (m_World->GetBlock(m_CropsPos.x, m_CropsPos.y - 1, m_CropsPos.z) == E_BLOCK_FARMLAND) + { + m_World->SetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z, E_BLOCK_CROPS, 0); + } +} + + + + + +bool cVillager::IsBlockFarmable(BLOCKTYPE a_BlockType) +{ + switch (a_BlockType) + { + case E_BLOCK_CROPS: + case E_BLOCK_POTATOES: + case E_BLOCK_CARROTS: + { + return true; + } + } + return false; +} + diff --git a/src/Mobs/Old Mobs/Villager.h b/src/Mobs/Old Mobs/Villager.h new file mode 100644 index 000000000..0ee24eb50 --- /dev/null +++ b/src/Mobs/Old Mobs/Villager.h @@ -0,0 +1,66 @@ + +#pragma once + +#include "PassiveMonster.h" + + + + + +class cVillager : + public cPassiveMonster +{ + typedef cPassiveMonster super; + +public: + + enum eVillagerType + { + vtFarmer = 0, + vtLibrarian = 1, + vtPriest = 2, + vtBlacksmith = 3, + vtButcher = 4, + vtGeneric = 5, + vtMax + } ; + + cVillager(eVillagerType VillagerType); + + CLASS_PROTODEF(cVillager) + + // cEntity /*override*/s + virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) /*override*/; + virtual void Tick (float a_Dt, cChunk & a_Chunk) /*override*/; + + // cVillager functions + /** return true if the given blocktype are: crops, potatoes or carrots.*/ + bool IsBlockFarmable(BLOCKTYPE a_BlockType); + + // Farmer functions + /** Searches in a 11x7x11 area for crops. If it found some it will navigate to them.*/ + void HandleFarmerPrepareFarmCrops(); + + /** Looks if the farmer has reached it's destination, and if it's still crops and the destination is closer then 2 blocks it will harvest them.*/ + void HandleFarmerTryHarvestCrops(); + + /** Replaces the crops he harvested.*/ + void HandleFarmerPlaceCrops(); + + // Get and set functions. + int GetVilType(void) const { return m_Type; } + Vector3i GetCropsPos(void) const { return m_CropsPos; } + bool DoesHaveActionActivated(void) const { return m_VillagerAction; } + +private: + + int m_ActionCountDown; + int m_Type; + bool m_VillagerAction; + Vector3i m_CropsPos; + +} ; + + + + diff --git a/src/Mobs/Old Mobs/Witch.cpp b/src/Mobs/Old Mobs/Witch.cpp new file mode 100644 index 000000000..6956f7b7a --- /dev/null +++ b/src/Mobs/Old Mobs/Witch.cpp @@ -0,0 +1,47 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Witch.h" + + + + + +cWitch::cWitch(void) : + super("Witch", mtWitch, "", "", 0.6, 1.8) +{ +} + + + + + +void cWitch::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + MTRand r1; + int DropTypeCount = (r1.randInt() % 3) + 1; + for (int i = 0; i < DropTypeCount; i++) + { + int DropType = r1.randInt() % 7; + switch (DropType) + { + case 0: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLASS_BOTTLE); break; + case 1: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLOWSTONE_DUST); break; + case 2: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER); break; + case 3: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_REDSTONE_DUST); break; + case 4: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SPIDER_EYE); break; + case 5: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STICK); break; + case 6: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SUGAR); break; + } + } + AddRandomWeaponDropItem(a_Drops, LootingLevel); +} + + + + diff --git a/src/Mobs/Old Mobs/Witch.h b/src/Mobs/Old Mobs/Witch.h new file mode 100644 index 000000000..18a99d053 --- /dev/null +++ b/src/Mobs/Old Mobs/Witch.h @@ -0,0 +1,28 @@ + +#pragma once + +#include "AggressiveMonster.h" +#include "../MersenneTwister.h" + + + + + +class cWitch : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cWitch(); + + CLASS_PROTODEF(cWitch) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + + bool IsAngry(void) const {return ((m_EMState == ATTACKING) || (m_EMState == CHASING)); } +} ; + + + + diff --git a/src/Mobs/Old Mobs/Wither.cpp b/src/Mobs/Old Mobs/Wither.cpp new file mode 100644 index 000000000..578b47995 --- /dev/null +++ b/src/Mobs/Old Mobs/Wither.cpp @@ -0,0 +1,136 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Wither.h" + +#include "../World.h" +#include "../Entities/Player.h" + + + + + +cWither::cWither(void) : + super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0), + m_WitherInvulnerableTicks(220) +{ + SetMaxHealth(300); +} + + + + + +bool cWither::IsArmored(void) const +{ + return GetHealth() <= (GetMaxHealth() / 2); +} + + + + + +bool cWither::Initialize(cWorld & a_World) +{ + // Set health before BroadcastSpawnEntity() + SetHealth(GetMaxHealth() / 3); + + return super::Initialize(a_World); +} + + + + + +bool cWither::DoTakeDamage(TakeDamageInfo & a_TDI) +{ + if (a_TDI.DamageType == dtDrowning) + { + return false; + } + + if (m_WitherInvulnerableTicks > 0) + { + return false; + } + + if (IsArmored() && (a_TDI.DamageType == dtRangedAttack)) + { + return false; + } + + return super::DoTakeDamage(a_TDI); +} + + + + + +void cWither::Tick(float a_Dt, cChunk & a_Chunk) +{ + super::Tick(a_Dt, a_Chunk); + + if (m_WitherInvulnerableTicks > 0) + { + unsigned int NewTicks = m_WitherInvulnerableTicks - 1; + + if (NewTicks == 0) + { + m_World->DoExplosionAt(7.0, GetPosX(), GetPosY(), GetPosZ(), false, esWitherBirth, this); + } + + m_WitherInvulnerableTicks = NewTicks; + + if ((NewTicks % 10) == 0) + { + Heal(10); + } + } + + m_World->BroadcastEntityMetadata(*this); +} + + + + + +void cWither::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + AddRandomDropItem(a_Drops, 1, 1, E_ITEM_NETHER_STAR); +} + + + + + +void cWither::KilledBy(TakeDamageInfo & a_TDI) +{ + super::KilledBy(a_TDI); + + class cPlayerCallback : public cPlayerListCallback + { + Vector3f m_Pos; + + virtual bool Item(cPlayer * a_Player) + { + // TODO 2014-05-21 xdot: Vanilla minecraft uses an AABB check instead of a radius one + double Dist = (a_Player->GetPosition() - m_Pos).Length(); + if (Dist < 50.0) + { + // If player is close, award achievement + a_Player->AwardAchievement(achKillWither); + } + return false; + } + + public: + cPlayerCallback(const Vector3f & a_Pos) : m_Pos(a_Pos) {} + + } PlayerCallback(GetPosition()); + + m_World->ForEachPlayer(PlayerCallback); +} + + + + diff --git a/src/Mobs/Old Mobs/Wither.h b/src/Mobs/Old Mobs/Wither.h new file mode 100644 index 000000000..7d307c360 --- /dev/null +++ b/src/Mobs/Old Mobs/Wither.h @@ -0,0 +1,45 @@ + +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cWither : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cWither(void); + + CLASS_PROTODEF(cWither) + + unsigned int GetWitherInvulnerableTicks(void) const { return m_WitherInvulnerableTicks; } + + void SetWitherInvulnerableTicks(unsigned int a_Ticks) { m_WitherInvulnerableTicks = a_Ticks; } + + /** Returns whether the wither is invulnerable to arrows. */ + bool IsArmored(void) const; + + // cEntity /*override*/s + virtual bool Initialize(cWorld & a_World) /*override*/; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void KilledBy(TakeDamageInfo & a_TDI) /*override*/; + + virtual bool IsUndead(void) /*override*/ { return true; } + +private: + + /** The number of ticks of invulnerability left after being initially created. Zero once invulnerability has expired. */ + unsigned int m_WitherInvulnerableTicks; + +} ; + + + + diff --git a/src/Mobs/Old Mobs/Wolf.cpp b/src/Mobs/Old Mobs/Wolf.cpp new file mode 100644 index 000000000..8b5f06f01 --- /dev/null +++ b/src/Mobs/Old Mobs/Wolf.cpp @@ -0,0 +1,246 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Wolf.h" +#include "../World.h" +#include "../Entities/Player.h" +#include "../Items/ItemHandler.h" + + + + + +cWolf::cWolf(void) : + super("Wolf", mtWolf, "mob.wolf.hurt", "mob.wolf.death", 0.6, 0.8), + m_IsSitting(false), + m_IsTame(false), + m_IsBegging(false), + m_IsAngry(false), + m_OwnerName(""), + m_CollarColor(14) +{ +} + + + + + +bool cWolf::DoTakeDamage(TakeDamageInfo & a_TDI) +{ + if (super::DoTakeDamage(a_TDI)) + { + return false; + } + + if (!m_IsTame) + { + m_IsAngry = true; + } + m_World->BroadcastEntityMetadata(*this); // Broadcast health and possibly angry face + return true; +} + + + + +void cWolf::Attack(float a_Dt) +{ + UNUSED(a_Dt); + + if ((m_Target != NULL) && (m_Target->IsPlayer())) + { + if (((cPlayer *)m_Target)->GetName() != m_OwnerName) + { + super::Attack(a_Dt); + } + } + else + { + super::Attack(a_Dt); + } +} + + + + + +void cWolf::OnRightClicked(cPlayer & a_Player) +{ + if (!IsTame() && !IsAngry()) + { + // If the player is holding a bone, try to tame the wolf: + if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_BONE) + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + + if (m_World->GetTickRandomNumber(7) == 0) + { + // Taming succeeded + SetMaxHealth(20); + SetIsTame(true); + SetOwner(a_Player.GetName(), a_Player.GetUUID()); + m_World->BroadcastEntityStatus(*this, esWolfTamed); + m_World->BroadcastParticleEffect("heart", (float) GetPosX(), (float) GetPosY(), (float) GetPosZ(), 0, 0, 0, 0, 5); + } + else + { + // Taming failed + m_World->BroadcastEntityStatus(*this, esWolfTaming); + m_World->BroadcastParticleEffect("smoke", (float) GetPosX(), (float) GetPosY(), (float) GetPosZ(), 0, 0, 0, 0, 5); + } + } + } + else if (IsTame()) + { + // Feed the wolf, restoring its health, or dye its collar: + switch (a_Player.GetEquippedItem().m_ItemType) + { + case E_ITEM_RAW_BEEF: + case E_ITEM_STEAK: + case E_ITEM_RAW_PORKCHOP: + case E_ITEM_COOKED_PORKCHOP: + case E_ITEM_RAW_CHICKEN: + case E_ITEM_COOKED_CHICKEN: + case E_ITEM_ROTTEN_FLESH: + { + if (m_Health < m_MaxHealth) + { + Heal(ItemHandler(a_Player.GetEquippedItem().m_ItemType)->GetFoodInfo().FoodLevel); + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + } + break; + } + case E_ITEM_DYE: + { + if (a_Player.GetName() == m_OwnerName) // Is the player the owner of the dog? + { + SetCollarColor(15 - a_Player.GetEquippedItem().m_ItemDamage); + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + } + break; + } + default: + { + if (a_Player.GetName() == m_OwnerName) // Is the player the owner of the dog? + { + SetIsSitting(!IsSitting()); + } + } + } + } + + m_World->BroadcastEntityMetadata(*this); +} + + + + + +void cWolf::Tick(float a_Dt, cChunk & a_Chunk) +{ + if (!IsAngry()) + { + cMonster::Tick(a_Dt, a_Chunk); + } + else + { + super::Tick(a_Dt, a_Chunk); + } + + cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance); + if (a_Closest_Player != NULL) + { + switch (a_Closest_Player->GetEquippedItem().m_ItemType) + { + case E_ITEM_BONE: + case E_ITEM_RAW_BEEF: + case E_ITEM_STEAK: + case E_ITEM_RAW_CHICKEN: + case E_ITEM_COOKED_CHICKEN: + case E_ITEM_ROTTEN_FLESH: + case E_ITEM_RAW_PORKCHOP: + case E_ITEM_COOKED_PORKCHOP: + { + if (!IsBegging()) + { + SetIsBegging(true); + m_World->BroadcastEntityMetadata(*this); + } + + m_FinalDestination = a_Closest_Player->GetPosition(); // So that we will look at a player holding food + + // Don't move to the player if the wolf is sitting. + if (!IsSitting()) + { + MoveToPosition(a_Closest_Player->GetPosition()); + } + + break; + } + default: + { + if (IsBegging()) + { + SetIsBegging(false); + m_World->BroadcastEntityMetadata(*this); + } + } + } + } + + if (IsTame() && !IsSitting()) + { + TickFollowPlayer(); + } + else if (IsSitting()) + { + m_bMovingToDestination = false; + } +} + + + + + +void cWolf::TickFollowPlayer() +{ + class cCallback : + public cPlayerListCallback + { + virtual bool Item(cPlayer * a_Player) /*override*/ + { + OwnerPos = a_Player->GetPosition(); + return false; + } + public: + Vector3d OwnerPos; + } Callback; + + if (m_World->DoWithPlayer(m_OwnerName, Callback)) + { + // The player is present in the world, follow him: + double Distance = (Callback.OwnerPos - GetPosition()).Length(); + if (Distance > 30) + { + Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z); + TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z); + } + else + { + MoveToPosition(Callback.OwnerPos); + } + } +} + + + + diff --git a/src/Mobs/Old Mobs/Wolf.h b/src/Mobs/Old Mobs/Wolf.h new file mode 100644 index 000000000..0ecb9d1f4 --- /dev/null +++ b/src/Mobs/Old Mobs/Wolf.h @@ -0,0 +1,61 @@ + +#pragma once + +#include "PassiveAggressiveMonster.h" +#include "../Entities/Entity.h" + + + + + +class cWolf : + public cPassiveAggressiveMonster +{ + typedef cPassiveAggressiveMonster super; + +public: + cWolf(void); + + CLASS_PROTODEF(cWolf) + + virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) /*override*/; + virtual void OnRightClicked(cPlayer & a_Player) /*override*/; + virtual void Tick(float a_Dt, cChunk & a_Chunk) /*override*/; + virtual void TickFollowPlayer(); + virtual void Attack(float a_Dt) /*override*/; + + // Get functions + bool IsSitting (void) const { return m_IsSitting; } + bool IsTame (void) const { return m_IsTame; } + bool IsBegging (void) const { return m_IsBegging; } + bool IsAngry (void) const { return m_IsAngry; } + AString GetOwnerName (void) const { return m_OwnerName; } + AString GetOwnerUUID (void) const { return m_OwnerUUID; } + int GetCollarColor(void) const { return m_CollarColor; } + + // Set functions + void SetIsSitting (bool a_IsSitting) { m_IsSitting = a_IsSitting; } + void SetIsTame (bool a_IsTame) { m_IsTame = a_IsTame; } + void SetIsBegging (bool a_IsBegging) { m_IsBegging = a_IsBegging; } + void SetIsAngry (bool a_IsAngry) { m_IsAngry = a_IsAngry; } + void SetCollarColor(int a_CollarColor) { m_CollarColor = a_CollarColor; } + void SetOwner (const AString & a_NewOwnerName, const AString & a_NewOwnerUUID) + { + m_OwnerName = a_NewOwnerName; + m_OwnerUUID = a_NewOwnerUUID; + } + +protected: + + bool m_IsSitting; + bool m_IsTame; + bool m_IsBegging; + bool m_IsAngry; + AString m_OwnerName; + AString m_OwnerUUID; + int m_CollarColor; +} ; + + + + diff --git a/src/Mobs/Old Mobs/Zombie.cpp b/src/Mobs/Old Mobs/Zombie.cpp new file mode 100644 index 000000000..30225c32d --- /dev/null +++ b/src/Mobs/Old Mobs/Zombie.cpp @@ -0,0 +1,62 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Zombie.h" +#include "../World.h" +#include "../LineBlockTracer.h" + + + + + +cZombie::cZombie(bool a_IsVillagerZombie) : + super("Zombie", mtZombie, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8), + m_IsVillagerZombie(a_IsVillagerZombie), + m_IsConverting(false) +{ + SetBurnsInDaylight(true); +} + + + + + +void cZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ROTTEN_FLESH); + cItems RareDrops; + RareDrops.Add(cItem(E_ITEM_IRON)); + RareDrops.Add(cItem(E_ITEM_CARROT)); + RareDrops.Add(cItem(E_ITEM_POTATO)); + AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel); + AddRandomArmorDropItem(a_Drops, LootingLevel); + AddRandomWeaponDropItem(a_Drops, LootingLevel); +} + + + + + +void cZombie::MoveToPosition(const Vector3d & a_Position) +{ + // If the destination is sufficiently skylight challenged AND the skeleton isn't on fire then block the movement + if ( + !IsOnFire() && + (m_World->GetBlockSkyLight((int)floor(a_Position.x), (int)floor(a_Position.y), (int)floor(a_Position.z)) - m_World->GetSkyDarkness() > 8) + ) + { + m_bMovingToDestination = false; + return; + } + + super::MoveToPosition(a_Position); +} + + + + diff --git a/src/Mobs/Old Mobs/Zombie.h b/src/Mobs/Old Mobs/Zombie.h new file mode 100644 index 000000000..458945c3f --- /dev/null +++ b/src/Mobs/Old Mobs/Zombie.h @@ -0,0 +1,36 @@ +#pragma once + +#include "AggressiveMonster.h" + + + + + +class cZombie : + public cAggressiveMonster +{ + typedef cAggressiveMonster super; + +public: + cZombie(bool a_IsVillagerZombie); + + CLASS_PROTODEF(cZombie) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void MoveToPosition(const Vector3d & a_Position) /*override*/; + + virtual bool IsUndead(void) /*override*/ { return true; } + + bool IsVillagerZombie(void) const { return m_IsVillagerZombie; } + bool IsConverting (void) const { return m_IsConverting; } + +private: + + bool m_IsVillagerZombie; + bool m_IsConverting; + +} ; + + + + diff --git a/src/Mobs/Old Mobs/ZombiePigman.cpp b/src/Mobs/Old Mobs/ZombiePigman.cpp new file mode 100644 index 000000000..05350f877 --- /dev/null +++ b/src/Mobs/Old Mobs/ZombiePigman.cpp @@ -0,0 +1,53 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "ZombiePigman.h" +#include "../World.h" + + + + + +cZombiePigman::cZombiePigman(void) : + super("ZombiePigman", mtZombiePigman, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath", 0.6, 1.8) +{ +} + + + + + +void cZombiePigman::GetDrops(cItems & a_Drops, cEntity * a_Killer) +{ + int LootingLevel = 0; + if (a_Killer != NULL) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ROTTEN_FLESH); + AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GOLD_NUGGET); + + cItems RareDrops; + RareDrops.Add(cItem(E_ITEM_GOLD)); + AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel); + AddRandomArmorDropItem(a_Drops, LootingLevel); + AddRandomWeaponDropItem(a_Drops, LootingLevel); +} + + + + + +void cZombiePigman::KilledBy(TakeDamageInfo & a_TDI) +{ + super::KilledBy(a_TDI); + + if ((a_TDI.Attacker != NULL) && (a_TDI.Attacker->IsPlayer())) + { + // TODO: Anger all nearby zombie pigmen + // TODO: In vanilla, if one player angers ZPs, do they attack any nearby player, or only that one attacker? + } +} + + + + diff --git a/src/Mobs/Old Mobs/ZombiePigman.h b/src/Mobs/Old Mobs/ZombiePigman.h new file mode 100644 index 000000000..861d05385 --- /dev/null +++ b/src/Mobs/Old Mobs/ZombiePigman.h @@ -0,0 +1,27 @@ +#pragma once + +#include "PassiveAggressiveMonster.h" + + + + + +class cZombiePigman : + public cPassiveAggressiveMonster +{ + typedef cPassiveAggressiveMonster super; + +public: + cZombiePigman(void); + + CLASS_PROTODEF(cZombiePigman) + + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; + virtual void KilledBy(TakeDamageInfo & a_TDI) /*override*/; + + virtual bool IsUndead(void) /*override*/ { return true; } +} ; + + + + diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp index 1f77cf613..fe0434a89 100644 --- a/src/Mobs/Pig.cpp +++ b/src/Mobs/Pig.cpp @@ -36,65 +36,3 @@ void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer) - -void cPig::OnRightClicked(cPlayer & a_Player) -{ - if (m_bIsSaddled) - { - if (m_Attachee != NULL) - { - if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID()) - { - // This player is already sitting in, they want out. - a_Player.Detach(); - return; - } - - if (m_Attachee->IsPlayer()) - { - // Another player is already sitting in here, cannot attach - return; - } - - // Detach whatever is sitting in this pig now: - m_Attachee->Detach(); - } - - // Attach the player to this pig - a_Player.AttachTo(this); - } - else if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE) - { - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - } - - // Set saddle state & broadcast metadata - m_bIsSaddled = true; - m_World->BroadcastEntityMetadata(*this); - } -} - - - - - -void cPig::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - - // If the attachee player is holding a carrot-on-stick, let them drive this pig: - if (m_bIsSaddled && (m_Attachee != NULL)) - { - if (m_Attachee->IsPlayer() && (m_Attachee->GetEquippedWeapon().m_ItemType == E_ITEM_CARROT_ON_STICK)) - { - MoveToPosition((m_Attachee->GetPosition()) + (m_Attachee->GetLookVector()*10)); - m_bMovingToDestination = true; - } - } -} - - - - diff --git a/src/Mobs/Pig.h b/src/Mobs/Pig.h index 534a0ca6f..0d62b085e 100644 --- a/src/Mobs/Pig.h +++ b/src/Mobs/Pig.h @@ -1,27 +1,23 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cPig : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: cPig(void); CLASS_PROTODEF(cPig) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void OnRightClicked(cPlayer & a_Player) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - - virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_CARROT); } + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; bool IsSaddled(void) const { return m_bIsSaddled; } diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp index 1a82115d2..a3a873b37 100644 --- a/src/Mobs/Sheep.cpp +++ b/src/Mobs/Sheep.cpp @@ -14,8 +14,8 @@ cSheep::cSheep(int a_Color) : super("Sheep", mtSheep, "mob.sheep.say", "mob.sheep.say", 0.6, 1.3), m_IsSheared(false), - m_WoolColor(a_Color), - m_TimeToStopEating(-1) + m_WoolColor(a_Color) + // m_TimeToStopEating(-1) { // Generate random wool color. if (m_WoolColor == -1) @@ -52,82 +52,6 @@ void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer) -void cSheep::OnRightClicked(cPlayer & a_Player) -{ - const cItem & EquippedItem = a_Player.GetEquippedItem(); - if ((EquippedItem.m_ItemType == E_ITEM_SHEARS) && !IsSheared() && !IsBaby()) - { - m_IsSheared = true; - m_World->BroadcastEntityMetadata(*this); - a_Player.UseEquippedItem(); - - cItems Drops; - int NumDrops = m_World->GetTickRandomNumber(2) + 1; - Drops.push_back(cItem(E_BLOCK_WOOL, NumDrops, m_WoolColor)); - m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); - m_World->BroadcastSoundEffect("mob.sheep.shear", GetPosX(), GetPosY(), GetPosZ(), 1.0f, 1.0f); - } - else if ((EquippedItem.m_ItemType == E_ITEM_DYE) && (m_WoolColor != 15 - EquippedItem.m_ItemDamage)) - { - m_WoolColor = 15 - EquippedItem.m_ItemDamage; - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - } - m_World->BroadcastEntityMetadata(*this); - } -} - - - - - -void cSheep::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - int PosX = POSX_TOINT; - int PosY = POSY_TOINT - 1; - int PosZ = POSZ_TOINT; - - if ((PosY <= 0) || (PosY > cChunkDef::Height)) - { - return; - } - - if (m_TimeToStopEating > 0) - { - m_bMovingToDestination = false; // The sheep should not move when he's eating - m_TimeToStopEating--; - - if (m_TimeToStopEating == 0) - { - if (m_World->GetBlock(PosX, PosY, PosZ) == E_BLOCK_GRASS) // Make sure grass hasn't been destroyed in the meantime - { - // The sheep ate the grass so we change it to dirt - m_World->SetBlock(PosX, PosY, PosZ, E_BLOCK_DIRT, 0); - GetWorld()->BroadcastSoundParticleEffect(2001, PosX, PosY, PosX, E_BLOCK_GRASS); - m_IsSheared = false; - m_World->BroadcastEntityMetadata(*this); - } - } - } - else - { - if (m_World->GetTickRandomNumber(600) == 1) - { - if (m_World->GetBlock(PosX, PosY, PosZ) == E_BLOCK_GRASS) - { - m_World->BroadcastEntityStatus(*this, esSheepEating); - m_TimeToStopEating = 40; - } - } - } -} - - - - - NIBBLETYPE cSheep::GenerateNaturalRandomColor(void) { cFastRandom Random; diff --git a/src/Mobs/Sheep.h b/src/Mobs/Sheep.h index 28e1c7254..4b65d2636 100644 --- a/src/Mobs/Sheep.h +++ b/src/Mobs/Sheep.h @@ -1,16 +1,16 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cSheep : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: @@ -22,11 +22,7 @@ public: CLASS_PROTODEF(cSheep) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void OnRightClicked(cPlayer & a_Player) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - - virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_WHEAT); } + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; /** Generates a random color for the sheep like the vanilla server. The percent's where used are from the wiki: http://minecraft.gamepedia.com/Sheep#Breeding */ @@ -41,7 +37,7 @@ public: private: bool m_IsSheared; int m_WoolColor; - int m_TimeToStopEating; + // int m_TimeToStopEating; } ; diff --git a/src/Mobs/Silverfish.h b/src/Mobs/Silverfish.h index 2df333dbc..1211aa06f 100644 --- a/src/Mobs/Silverfish.h +++ b/src/Mobs/Silverfish.h @@ -1,16 +1,16 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cSilverfish : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cSilverfish(void) : diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp index cd707f4bb..090f881f2 100644 --- a/src/Mobs/Skeleton.cpp +++ b/src/Mobs/Skeleton.cpp @@ -13,7 +13,6 @@ cSkeleton::cSkeleton(bool IsWither) : super("Skeleton", mtSkeleton, "mob.skeleton.hurt", "mob.skeleton.death", 0.6, 1.8), m_bIsWither(IsWither) { - SetBurnsInDaylight(true); } @@ -48,54 +47,6 @@ void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer) -void cSkeleton::MoveToPosition(const Vector3d & a_Position) -{ - // If the destination is sufficiently skylight challenged AND the skeleton isn't on fire then block the movement - if ( - !IsOnFire() && - (m_World->GetBlockSkyLight((int)floor(a_Position.x), (int)floor(a_Position.y), (int)floor(a_Position.z)) - m_World->GetSkyDarkness() > 8) - ) - { - m_bMovingToDestination = false; - return; - } - - super::MoveToPosition(a_Position); -} - - - - - -void cSkeleton::Attack(float a_Dt) -{ - m_AttackInterval += a_Dt * m_AttackRate; - - if (m_Target != NULL && m_AttackInterval > 3.0) - { - // Setting this higher gives us more wiggle room for attackrate - Vector3d Speed = GetLookVector() * 20; - Speed.y = Speed.y + 1; - cArrowEntity * Arrow = new cArrowEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); - if (Arrow == NULL) - { - return; - } - if (!Arrow->Initialize(*m_World)) - { - delete Arrow; - Arrow = NULL; - return; - } - m_World->BroadcastSpawnEntity(*Arrow); - m_AttackInterval = 0.0; - } -} - - - - - void cSkeleton::SpawnOn(cClientHandle & a_ClientHandle) { super::SpawnOn(a_ClientHandle); diff --git a/src/Mobs/Skeleton.h b/src/Mobs/Skeleton.h index 577588b32..1b0216ad2 100644 --- a/src/Mobs/Skeleton.h +++ b/src/Mobs/Skeleton.h @@ -1,28 +1,24 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cSkeleton : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cSkeleton(bool IsWither); CLASS_PROTODEF(cSkeleton) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void MoveToPosition(const Vector3d & a_Position) override; - virtual void Attack(float a_Dt) override; - virtual void SpawnOn(cClientHandle & a_ClientHandle) override; - - virtual bool IsUndead(void) override { return true; } + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/;\ + virtual void SpawnOn(cClientHandle & a_ClientHandle) /*override*/; bool IsWither(void) const { return m_bIsWither; } diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp index b709ec664..c9498b036 100644 --- a/src/Mobs/Slime.cpp +++ b/src/Mobs/Slime.cpp @@ -19,8 +19,6 @@ cSlime::cSlime(int a_Size) : ), m_Size(a_Size) { - SetMaxHealth(a_Size * a_Size); - SetAttackDamage(a_Size); } @@ -46,49 +44,6 @@ void cSlime::GetDrops(cItems & a_Drops, cEntity * a_Killer) -void cSlime::Attack(float a_Dt) -{ - if (m_Size > 1) - { - // Only slimes larger than size 1 attack a player. - super::Attack(a_Dt); - } -} - - - - - -void cSlime::KilledBy(TakeDamageInfo & a_TDI) -{ - if (GetHealth() > 0) - { - return; - } - - if (m_Size != 1) - { - cFastRandom Random; - int SpawnAmount = 2 + Random.NextInt(3); - - for (int i = 0; i < SpawnAmount; ++i) - { - double AddX = (i % 2 - 0.5) * m_Size / 4.0; - double AddZ = (i / 2 - 0.5) * m_Size / 4.0; - - cSlime * NewSlime = new cSlime(m_Size / 2); - NewSlime->SetPosition(GetPosX() + AddX, GetPosY() + 0.5, GetPosZ() + AddZ); - NewSlime->SetYaw(Random.NextFloat(1.0f) * 360.0f); - m_World->SpawnMobFinalize(NewSlime); - } - } - super::KilledBy(a_TDI); -} - - - - - const AString cSlime::GetSizeName(int a_Size) const { if (a_Size > 1) diff --git a/src/Mobs/Slime.h b/src/Mobs/Slime.h index f0b800f94..2e8266523 100644 --- a/src/Mobs/Slime.h +++ b/src/Mobs/Slime.h @@ -1,16 +1,16 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cSlime : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: /** Creates a slime of the specified size; size can be 1, 2 or 4, with 1 is the smallest and 4 is the tallest. */ @@ -18,10 +18,8 @@ public: CLASS_PROTODEF(cSlime) - // cAggressiveMonster overrides: - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void Attack(float a_Dt) override; - virtual void KilledBy(TakeDamageInfo & a_TDI) override; + // cAggressiveMonster /*override*/s: + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; int GetSize(void) const { return m_Size; } diff --git a/src/Mobs/SnowGolem.cpp b/src/Mobs/SnowGolem.cpp index 76334d970..b1b0099fa 100644 --- a/src/Mobs/SnowGolem.cpp +++ b/src/Mobs/SnowGolem.cpp @@ -22,25 +22,3 @@ void cSnowGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer) UNUSED(a_Killer); AddRandomDropItem(a_Drops, 0, 15, E_ITEM_SNOWBALL); } - - - - - -void cSnowGolem::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - if (IsBiomeNoDownfall(m_World->GetBiomeAt((int) floor(GetPosX()), (int) floor(GetPosZ())))) - { - TakeDamage(*this); - } - else - { - BLOCKTYPE BlockBelow = m_World->GetBlock((int) floor(GetPosX()), (int) floor(GetPosY()) - 1, (int) floor(GetPosZ())); - BLOCKTYPE Block = m_World->GetBlock((int) floor(GetPosX()), (int) floor(GetPosY()), (int) floor(GetPosZ())); - if (Block == E_BLOCK_AIR && cBlockInfo::IsSolid(BlockBelow)) - { - m_World->SetBlock((int) floor(GetPosX()), (int) floor(GetPosY()), (int) floor(GetPosZ()), E_BLOCK_SNOW, 0); - } - } -} diff --git a/src/Mobs/SnowGolem.h b/src/Mobs/SnowGolem.h index aba89e52d..d61c0ade5 100644 --- a/src/Mobs/SnowGolem.h +++ b/src/Mobs/SnowGolem.h @@ -1,24 +1,23 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cSnowGolem : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cSnowGolem(void); CLASS_PROTODEF(cSnowGolem) - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/Spider.h b/src/Mobs/Spider.h index 813d2e266..1eafae764 100644 --- a/src/Mobs/Spider.h +++ b/src/Mobs/Spider.h @@ -1,23 +1,23 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cSpider : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cSpider(void); CLASS_PROTODEF(cSpider) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/Squid.cpp b/src/Mobs/Squid.cpp index bd0e141a0..55939ee98 100644 --- a/src/Mobs/Squid.cpp +++ b/src/Mobs/Squid.cpp @@ -31,32 +31,3 @@ void cSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer) - - -void cSquid::Tick(float a_Dt, cChunk & a_Chunk) -{ - // We must first process current location, and only then tick, otherwise we risk processing a location in a chunk - // that is not where the entity currently resides (FS #411) - - Vector3d Pos = GetPosition(); - - // TODO: Not a real behavior, but cool :D - int RelY = (int)floor(Pos.y); - if ((RelY < 0) || (RelY >= cChunkDef::Height)) - { - return; - } - int RelX = (int)floor(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width; - int RelZ = (int)floor(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width; - BLOCKTYPE BlockType; - if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire()) - { - // Burn for 10 ticks, then decide again - StartBurning(10); - } - - super::Tick(a_Dt, a_Chunk); -} - - - diff --git a/src/Mobs/Squid.h b/src/Mobs/Squid.h index b57340427..30f3afe23 100644 --- a/src/Mobs/Squid.h +++ b/src/Mobs/Squid.h @@ -1,29 +1,23 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cSquid : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: cSquid(); - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - CLASS_PROTODEF(cSquid) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - - // Squids do not drown (or float) - virtual void HandleAir(void) override {} - virtual void SetSwimState(cChunk & a_Chunk) override {} + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/Mobs/Villager.cpp b/src/Mobs/Villager.cpp index 1cdac7c74..9e3559f08 100644 --- a/src/Mobs/Villager.cpp +++ b/src/Mobs/Villager.cpp @@ -13,185 +13,7 @@ cVillager::cVillager(eVillagerType VillagerType) : super("Villager", mtVillager, "", "", 0.6, 1.8), - m_ActionCountDown(-1), - m_Type(VillagerType), - m_VillagerAction(false) + m_Type(VillagerType) { } - - - - -bool cVillager::DoTakeDamage(TakeDamageInfo & a_TDI) -{ - if (!super::DoTakeDamage(a_TDI)) - { - return false; - } - - if ((a_TDI.Attacker != NULL) && a_TDI.Attacker->IsPlayer()) - { - if (m_World->GetTickRandomNumber(5) == 3) - { - m_World->BroadcastEntityStatus(*this, esVillagerAngry); - } - } - return true; -} - - - - - -void cVillager::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - - if (m_ActionCountDown > -1) - { - m_ActionCountDown--; - if (m_ActionCountDown == 0) - { - switch (m_Type) - { - case vtFarmer: - { - HandleFarmerPlaceCrops(); - } - } - } - return; - } - - if (m_VillagerAction) - { - switch (m_Type) - { - case vtFarmer: - { - HandleFarmerTryHarvestCrops(); - } - } - m_VillagerAction = false; - return; - } - - // Don't always try to do a special action. Each tick has 1% to do a special action. - if (m_World->GetTickRandomNumber(99) != 0) - { - return; - } - - switch (m_Type) - { - case vtFarmer: - { - HandleFarmerPrepareFarmCrops(); - } - } -} - - - - -//////////////////////////////////////////////////////////////////////////////// -// Farmer functions. -void cVillager::HandleFarmerPrepareFarmCrops() -{ - if (!m_World->VillagersShouldHarvestCrops()) - { - return; - } - - cBlockArea Surrounding; - /// Read a 11x7x11 area. - Surrounding.Read( - m_World, - (int) GetPosX() - 5, - (int) GetPosX() + 5, - (int) GetPosY() - 3, - (int) GetPosY() + 3, - (int) GetPosZ() - 5, - (int) GetPosZ() + 5 - ); - - for (int I = 0; I < 5; I++) - { - for (int Y = 0; Y < 6; Y++) - { - // Pick random coordinates and check for crops. - int X = m_World->GetTickRandomNumber(11); - int Z = m_World->GetTickRandomNumber(11); - - // A villager can't farm this. - if (!IsBlockFarmable(Surrounding.GetRelBlockType(X, Y, Z))) - { - continue; - } - if (Surrounding.GetRelBlockMeta(X, Y, Z) != 0x7) - { - continue; - } - - m_VillagerAction = true; - m_CropsPos = Vector3i((int) GetPosX() + X - 5, (int) GetPosY() + Y - 3, (int) GetPosZ() + Z - 5); - MoveToPosition(Vector3f((float) (m_CropsPos.x + 0.5), (float) m_CropsPos.y, (float) (m_CropsPos.z + 0.5))); - return; - } // for Y loop. - } // Repeat the procces 5 times. -} - - - - - -void cVillager::HandleFarmerTryHarvestCrops() -{ - // Harvest the crops if the villager isn't moving and if the crops are closer then 2 blocks. - if (!m_bMovingToDestination && (GetPosition() - m_CropsPos).Length() < 2) - { - // Check if the blocks didn't change while the villager was walking to the coordinates. - BLOCKTYPE CropBlock = m_World->GetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z); - if (IsBlockFarmable(CropBlock) && m_World->GetBlockMeta(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z) == 0x7) - { - cBlockHandler * Handler = cBlockInfo::GetHandler(CropBlock); - cChunkInterface ChunkInterface(m_World->GetChunkMap()); - cBlockInServerPluginInterface PluginInterface(*m_World); - Handler->DropBlock(ChunkInterface, *m_World, PluginInterface, this, m_CropsPos.x, m_CropsPos.y, m_CropsPos.z); - m_World->SetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z, E_BLOCK_AIR, 0); - m_ActionCountDown = 20; - } - } -} - - - - -void cVillager::HandleFarmerPlaceCrops() -{ - // Check if there is still farmland at the spot where the crops were. - if (m_World->GetBlock(m_CropsPos.x, m_CropsPos.y - 1, m_CropsPos.z) == E_BLOCK_FARMLAND) - { - m_World->SetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z, E_BLOCK_CROPS, 0); - } -} - - - - - -bool cVillager::IsBlockFarmable(BLOCKTYPE a_BlockType) -{ - switch (a_BlockType) - { - case E_BLOCK_CROPS: - case E_BLOCK_POTATOES: - case E_BLOCK_CARROTS: - { - return true; - } - } - return false; -} - diff --git a/src/Mobs/Villager.h b/src/Mobs/Villager.h index aa81f0790..349eb7195 100644 --- a/src/Mobs/Villager.h +++ b/src/Mobs/Villager.h @@ -1,16 +1,16 @@ #pragma once -#include "PassiveMonster.h" +#include "Monster.h" class cVillager : - public cPassiveMonster + public cMonster { - typedef cPassiveMonster super; + typedef cMonster super; public: @@ -29,35 +29,12 @@ public: CLASS_PROTODEF(cVillager) - // cEntity overrides - virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; - virtual void Tick (float a_Dt, cChunk & a_Chunk) override; - - // cVillager functions - /** return true if the given blocktype are: crops, potatoes or carrots.*/ - bool IsBlockFarmable(BLOCKTYPE a_BlockType); - - // Farmer functions - /** Searches in a 11x7x11 area for crops. If it found some it will navigate to them.*/ - void HandleFarmerPrepareFarmCrops(); - - /** Looks if the farmer has reached it's destination, and if it's still crops and the destination is closer then 2 blocks it will harvest them.*/ - void HandleFarmerTryHarvestCrops(); - - /** Replaces the crops he harvested.*/ - void HandleFarmerPlaceCrops(); - // Get and set functions. int GetVilType(void) const { return m_Type; } - Vector3i GetCropsPos(void) const { return m_CropsPos; } - bool DoesHaveActionActivated(void) const { return m_VillagerAction; } private: - int m_ActionCountDown; int m_Type; - bool m_VillagerAction; - Vector3i m_CropsPos; } ; diff --git a/src/Mobs/Witch.h b/src/Mobs/Witch.h index bd059f61d..376d9b9c9 100644 --- a/src/Mobs/Witch.h +++ b/src/Mobs/Witch.h @@ -1,7 +1,7 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" #include "../MersenneTwister.h" @@ -9,18 +9,18 @@ class cWitch : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cWitch(); CLASS_PROTODEF(cWitch) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; - bool IsAngry(void) const {return ((m_EMState == ATTACKING) || (m_EMState == CHASING)); } + bool IsAngry(void) const {return false; } } ; diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp index 578b47995..e996078dc 100644 --- a/src/Mobs/Wither.cpp +++ b/src/Mobs/Wither.cpp @@ -12,7 +12,7 @@ cWither::cWither(void) : super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0), - m_WitherInvulnerableTicks(220) + m_WitherInvulnerableTicks(0) { SetMaxHealth(300); } @@ -21,15 +21,6 @@ cWither::cWither(void) : -bool cWither::IsArmored(void) const -{ - return GetHealth() <= (GetMaxHealth() / 2); -} - - - - - bool cWither::Initialize(cWorld & a_World) { // Set health before BroadcastSpawnEntity() @@ -42,58 +33,6 @@ bool cWither::Initialize(cWorld & a_World) -bool cWither::DoTakeDamage(TakeDamageInfo & a_TDI) -{ - if (a_TDI.DamageType == dtDrowning) - { - return false; - } - - if (m_WitherInvulnerableTicks > 0) - { - return false; - } - - if (IsArmored() && (a_TDI.DamageType == dtRangedAttack)) - { - return false; - } - - return super::DoTakeDamage(a_TDI); -} - - - - - -void cWither::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - - if (m_WitherInvulnerableTicks > 0) - { - unsigned int NewTicks = m_WitherInvulnerableTicks - 1; - - if (NewTicks == 0) - { - m_World->DoExplosionAt(7.0, GetPosX(), GetPosY(), GetPosZ(), false, esWitherBirth, this); - } - - m_WitherInvulnerableTicks = NewTicks; - - if ((NewTicks % 10) == 0) - { - Heal(10); - } - } - - m_World->BroadcastEntityMetadata(*this); -} - - - - - void cWither::GetDrops(cItems & a_Drops, cEntity * a_Killer) { AddRandomDropItem(a_Drops, 1, 1, E_ITEM_NETHER_STAR); @@ -102,35 +41,3 @@ void cWither::GetDrops(cItems & a_Drops, cEntity * a_Killer) - -void cWither::KilledBy(TakeDamageInfo & a_TDI) -{ - super::KilledBy(a_TDI); - - class cPlayerCallback : public cPlayerListCallback - { - Vector3f m_Pos; - - virtual bool Item(cPlayer * a_Player) - { - // TODO 2014-05-21 xdot: Vanilla minecraft uses an AABB check instead of a radius one - double Dist = (a_Player->GetPosition() - m_Pos).Length(); - if (Dist < 50.0) - { - // If player is close, award achievement - a_Player->AwardAchievement(achKillWither); - } - return false; - } - - public: - cPlayerCallback(const Vector3f & a_Pos) : m_Pos(a_Pos) {} - - } PlayerCallback(GetPosition()); - - m_World->ForEachPlayer(PlayerCallback); -} - - - - diff --git a/src/Mobs/Wither.h b/src/Mobs/Wither.h index 2403823ed..409419efb 100644 --- a/src/Mobs/Wither.h +++ b/src/Mobs/Wither.h @@ -1,37 +1,30 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cWither : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cWither(void); CLASS_PROTODEF(cWither) - unsigned int GetWitherInvulnerableTicks(void) const { return m_WitherInvulnerableTicks; } - - void SetWitherInvulnerableTicks(unsigned int a_Ticks) { m_WitherInvulnerableTicks = a_Ticks; } - /** Returns whether the wither is invulnerable to arrows. */ bool IsArmored(void) const; + int GetWitherInvulnerableTicks() const { return m_WitherInvulnerableTicks; } + void SetWitherInvulnerableTicks(unsigned int a_Ticks) { m_WitherInvulnerableTicks = a_Ticks; } - // cEntity overrides - virtual bool Initialize(cWorld & a_World) override; - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void KilledBy(TakeDamageInfo & a_TDI) override; - - virtual bool IsUndead(void) override { return true; } + // cEntity /*override*/s + virtual bool Initialize(cWorld & a_World) /*override*/; + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; private: diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index 4fe1ff1d6..c3ff4b2eb 100644 --- a/src/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp @@ -13,10 +13,8 @@ cWolf::cWolf(void) : super("Wolf", mtWolf, "mob.wolf.hurt", "mob.wolf.death", 0.6, 0.8), m_IsSitting(false), - m_IsTame(false), m_IsBegging(false), m_IsAngry(false), - m_OwnerName(""), m_CollarColor(14) { } @@ -24,223 +22,3 @@ cWolf::cWolf(void) : - -bool cWolf::DoTakeDamage(TakeDamageInfo & a_TDI) -{ - if (super::DoTakeDamage(a_TDI)) - { - return false; - } - - if (!m_IsTame) - { - m_IsAngry = true; - } - m_World->BroadcastEntityMetadata(*this); // Broadcast health and possibly angry face - return true; -} - - - - -void cWolf::Attack(float a_Dt) -{ - UNUSED(a_Dt); - - if ((m_Target != NULL) && (m_Target->IsPlayer())) - { - if (((cPlayer *)m_Target)->GetName() != m_OwnerName) - { - super::Attack(a_Dt); - } - } - else - { - super::Attack(a_Dt); - } -} - - - - - -void cWolf::OnRightClicked(cPlayer & a_Player) -{ - if (!IsTame() && !IsAngry()) - { - // If the player is holding a bone, try to tame the wolf: - if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_BONE) - { - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - } - - if (m_World->GetTickRandomNumber(7) == 0) - { - // Taming succeeded - SetMaxHealth(20); - SetIsTame(true); - SetOwner(a_Player.GetName(), a_Player.GetUUID()); - m_World->BroadcastEntityStatus(*this, esWolfTamed); - m_World->BroadcastParticleEffect("heart", (float) GetPosX(), (float) GetPosY(), (float) GetPosZ(), 0, 0, 0, 0, 5); - } - else - { - // Taming failed - m_World->BroadcastEntityStatus(*this, esWolfTaming); - m_World->BroadcastParticleEffect("smoke", (float) GetPosX(), (float) GetPosY(), (float) GetPosZ(), 0, 0, 0, 0, 5); - } - } - } - else if (IsTame()) - { - // Feed the wolf, restoring its health, or dye its collar: - switch (a_Player.GetEquippedItem().m_ItemType) - { - case E_ITEM_RAW_BEEF: - case E_ITEM_STEAK: - case E_ITEM_RAW_PORKCHOP: - case E_ITEM_COOKED_PORKCHOP: - case E_ITEM_RAW_CHICKEN: - case E_ITEM_COOKED_CHICKEN: - case E_ITEM_ROTTEN_FLESH: - { - if (m_Health < m_MaxHealth) - { - Heal(ItemHandler(a_Player.GetEquippedItem().m_ItemType)->GetFoodInfo().FoodLevel); - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - } - } - break; - } - case E_ITEM_DYE: - { - if (a_Player.GetName() == m_OwnerName) // Is the player the owner of the dog? - { - SetCollarColor(15 - a_Player.GetEquippedItem().m_ItemDamage); - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - } - } - break; - } - default: - { - if (a_Player.GetName() == m_OwnerName) // Is the player the owner of the dog? - { - SetIsSitting(!IsSitting()); - } - } - } - } - - m_World->BroadcastEntityMetadata(*this); -} - - - - - -void cWolf::Tick(float a_Dt, cChunk & a_Chunk) -{ - if (!IsAngry()) - { - cMonster::Tick(a_Dt, a_Chunk); - } - else - { - super::Tick(a_Dt, a_Chunk); - } - - cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance); - if (a_Closest_Player != NULL) - { - switch (a_Closest_Player->GetEquippedItem().m_ItemType) - { - case E_ITEM_BONE: - case E_ITEM_RAW_BEEF: - case E_ITEM_STEAK: - case E_ITEM_RAW_CHICKEN: - case E_ITEM_COOKED_CHICKEN: - case E_ITEM_ROTTEN_FLESH: - case E_ITEM_RAW_PORKCHOP: - case E_ITEM_COOKED_PORKCHOP: - { - if (!IsBegging()) - { - SetIsBegging(true); - m_World->BroadcastEntityMetadata(*this); - } - - m_FinalDestination = a_Closest_Player->GetPosition(); // So that we will look at a player holding food - - // Don't move to the player if the wolf is sitting. - if (!IsSitting()) - { - MoveToPosition(a_Closest_Player->GetPosition()); - } - - break; - } - default: - { - if (IsBegging()) - { - SetIsBegging(false); - m_World->BroadcastEntityMetadata(*this); - } - } - } - } - - if (IsTame() && !IsSitting()) - { - TickFollowPlayer(); - } - else if (IsSitting()) - { - m_bMovingToDestination = false; - } -} - - - - - -void cWolf::TickFollowPlayer() -{ - class cCallback : - public cPlayerListCallback - { - virtual bool Item(cPlayer * a_Player) override - { - OwnerPos = a_Player->GetPosition(); - return false; - } - public: - Vector3d OwnerPos; - } Callback; - - if (m_World->DoWithPlayer(m_OwnerName, Callback)) - { - // The player is present in the world, follow him: - double Distance = (Callback.OwnerPos - GetPosition()).Length(); - if (Distance > 30) - { - Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z); - TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z); - } - else - { - MoveToPosition(Callback.OwnerPos); - } - } -} - - - - diff --git a/src/Mobs/Wolf.h b/src/Mobs/Wolf.h index 7500854f8..da8366e6f 100644 --- a/src/Mobs/Wolf.h +++ b/src/Mobs/Wolf.h @@ -1,7 +1,7 @@ #pragma once -#include "PassiveAggressiveMonster.h" +#include "Monster.h" #include "../Entities/Entity.h" @@ -9,50 +9,32 @@ class cWolf : - public cPassiveAggressiveMonster + public cMonster { - typedef cPassiveAggressiveMonster super; + typedef cMonster super; public: cWolf(void); CLASS_PROTODEF(cWolf) - virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; - virtual void OnRightClicked(cPlayer & a_Player) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void TickFollowPlayer(); - virtual void Attack(float a_Dt) override; - // Get functions bool IsSitting (void) const { return m_IsSitting; } - bool IsTame (void) const { return m_IsTame; } bool IsBegging (void) const { return m_IsBegging; } bool IsAngry (void) const { return m_IsAngry; } - AString GetOwnerName (void) const { return m_OwnerName; } - AString GetOwnerUUID (void) const { return m_OwnerUUID; } int GetCollarColor(void) const { return m_CollarColor; } // Set functions void SetIsSitting (bool a_IsSitting) { m_IsSitting = a_IsSitting; } - void SetIsTame (bool a_IsTame) { m_IsTame = a_IsTame; } void SetIsBegging (bool a_IsBegging) { m_IsBegging = a_IsBegging; } void SetIsAngry (bool a_IsAngry) { m_IsAngry = a_IsAngry; } void SetCollarColor(int a_CollarColor) { m_CollarColor = a_CollarColor; } - void SetOwner (const AString & a_NewOwnerName, const AString & a_NewOwnerUUID) - { - m_OwnerName = a_NewOwnerName; - m_OwnerUUID = a_NewOwnerUUID; - } protected: bool m_IsSitting; - bool m_IsTame; bool m_IsBegging; bool m_IsAngry; - AString m_OwnerName; - AString m_OwnerUUID; int m_CollarColor; } ; diff --git a/src/Mobs/Zombie.cpp b/src/Mobs/Zombie.cpp index 30225c32d..f96db6942 100644 --- a/src/Mobs/Zombie.cpp +++ b/src/Mobs/Zombie.cpp @@ -14,7 +14,6 @@ cZombie::cZombie(bool a_IsVillagerZombie) : m_IsVillagerZombie(a_IsVillagerZombie), m_IsConverting(false) { - SetBurnsInDaylight(true); } @@ -41,22 +40,3 @@ void cZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer) - -void cZombie::MoveToPosition(const Vector3d & a_Position) -{ - // If the destination is sufficiently skylight challenged AND the skeleton isn't on fire then block the movement - if ( - !IsOnFire() && - (m_World->GetBlockSkyLight((int)floor(a_Position.x), (int)floor(a_Position.y), (int)floor(a_Position.z)) - m_World->GetSkyDarkness() > 8) - ) - { - m_bMovingToDestination = false; - return; - } - - super::MoveToPosition(a_Position); -} - - - - diff --git a/src/Mobs/Zombie.h b/src/Mobs/Zombie.h index 118b6e6e7..364c54a0a 100644 --- a/src/Mobs/Zombie.h +++ b/src/Mobs/Zombie.h @@ -1,25 +1,22 @@ #pragma once -#include "AggressiveMonster.h" +#include "Monster.h" class cZombie : - public cAggressiveMonster + public cMonster { - typedef cAggressiveMonster super; + typedef cMonster super; public: cZombie(bool a_IsVillagerZombie); CLASS_PROTODEF(cZombie) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void MoveToPosition(const Vector3d & a_Position) override; - - virtual bool IsUndead(void) override { return true; } + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; bool IsVillagerZombie(void) const { return m_IsVillagerZombie; } bool IsConverting (void) const { return m_IsConverting; } diff --git a/src/Mobs/ZombiePigman.cpp b/src/Mobs/ZombiePigman.cpp index 05350f877..a8e5ffd39 100644 --- a/src/Mobs/ZombiePigman.cpp +++ b/src/Mobs/ZombiePigman.cpp @@ -36,18 +36,3 @@ void cZombiePigman::GetDrops(cItems & a_Drops, cEntity * a_Killer) - -void cZombiePigman::KilledBy(TakeDamageInfo & a_TDI) -{ - super::KilledBy(a_TDI); - - if ((a_TDI.Attacker != NULL) && (a_TDI.Attacker->IsPlayer())) - { - // TODO: Anger all nearby zombie pigmen - // TODO: In vanilla, if one player angers ZPs, do they attack any nearby player, or only that one attacker? - } -} - - - - diff --git a/src/Mobs/ZombiePigman.h b/src/Mobs/ZombiePigman.h index bae0115eb..39c6e23fe 100644 --- a/src/Mobs/ZombiePigman.h +++ b/src/Mobs/ZombiePigman.h @@ -1,25 +1,22 @@ #pragma once -#include "PassiveAggressiveMonster.h" +#include "Monster.h" class cZombiePigman : - public cPassiveAggressiveMonster + public cMonster { - typedef cPassiveAggressiveMonster super; + typedef cMonster super; public: cZombiePigman(void); CLASS_PROTODEF(cZombiePigman) - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual void KilledBy(TakeDamageInfo & a_TDI) override; - - virtual bool IsUndead(void) override { return true; } + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) /*override*/; } ; diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp index f5e078213..c4bad1263 100644 --- a/src/MonsterConfig.cpp +++ b/src/MonsterConfig.cpp @@ -90,10 +90,10 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na { if (itr->m_Name.compare(a_Name) == 0) { - a_Monster->SetAttackDamage (itr->m_AttackDamage); - a_Monster->SetAttackRange (itr->m_AttackRange); - a_Monster->SetSightDistance(itr->m_SightDistance); - a_Monster->SetAttackRate ((float)itr->m_AttackRate); + // a_Monster->SetAttackDamage (itr->m_AttackDamage); + // a_Monster->SetAttackRange (itr->m_AttackRange); + // a_Monster->SetSightDistance(itr->m_SightDistance); + // a_Monster->SetAttackRate ((float)itr->m_AttackRate); a_Monster->SetMaxHealth (itr->m_MaxHealth); a_Monster->SetIsFireproof (itr->m_IsFireproof); return; diff --git a/src/OSSupport/IsThread.h b/src/OSSupport/IsThread.h index c20fc3e7e..f349d0895 100644 --- a/src/OSSupport/IsThread.h +++ b/src/OSSupport/IsThread.h @@ -29,7 +29,7 @@ protected: /// This is the main thread entrypoint virtual void Execute(void) = 0; - /// The overriden Execute() method should check this value periodically and terminate if this is true + /// The overridden Execute() method should check this value periodically and terminate if this is true volatile bool m_ShouldTerminate; public: diff --git a/src/OSSupport/ListenThread.h b/src/OSSupport/ListenThread.h index b2d806c82..776b84e0e 100644 --- a/src/OSSupport/ListenThread.h +++ b/src/OSSupport/ListenThread.h @@ -76,8 +76,8 @@ protected: */ bool CreateSockets(const AString & a_PortsString); - // cIsThread override: - virtual void Execute(void) override; + // cIsThread /*override*/: + virtual void Execute(void) /*override*/; } ; diff --git a/src/OSSupport/SocketThreads.h b/src/OSSupport/SocketThreads.h index 944f5f3bc..e19a72409 100644 --- a/src/OSSupport/SocketThreads.h +++ b/src/OSSupport/SocketThreads.h @@ -157,7 +157,7 @@ private: sSlot m_Slots[MAX_SLOTS]; int m_NumSlots; // Number of slots actually used - virtual void Execute(void) override; + virtual void Execute(void) /*override*/; /** Prepares the Read and Write socket sets for select() Puts all sockets into the read set, along with m_ControlSocket1. diff --git a/src/PolarSSL++/BlockingSslClientSocket.h b/src/PolarSSL++/BlockingSslClientSocket.h index 7af897582..9eb53da91 100644 --- a/src/PolarSSL++/BlockingSslClientSocket.h +++ b/src/PolarSSL++/BlockingSslClientSocket.h @@ -70,9 +70,9 @@ protected: bool m_IsConnected; - // cCallbackSslContext::cDataCallbacks overrides: - virtual int ReceiveEncrypted(unsigned char * a_Buffer, size_t a_NumBytes) override; - virtual int SendEncrypted(const unsigned char * a_Buffer, size_t a_NumBytes) override; + // cCallbackSslContext::cDataCallbacks /*override*/s: + virtual int ReceiveEncrypted(unsigned char * a_Buffer, size_t a_NumBytes) /*override*/; + virtual int SendEncrypted(const unsigned char * a_Buffer, size_t a_NumBytes) /*override*/; } ; diff --git a/src/PolarSSL++/BufferedSslContext.h b/src/PolarSSL++/BufferedSslContext.h index 1b7e1af46..c84c16772 100644 --- a/src/PolarSSL++/BufferedSslContext.h +++ b/src/PolarSSL++/BufferedSslContext.h @@ -42,9 +42,9 @@ protected: cByteBuffer m_IncomingData; - // cSslContext overrides: - virtual int ReceiveEncrypted(unsigned char * a_Buffer, size_t a_NumBytes) override; - virtual int SendEncrypted(const unsigned char * a_Buffer, size_t a_NumBytes) override; + // cSslContext /*override*/s: + virtual int ReceiveEncrypted(unsigned char * a_Buffer, size_t a_NumBytes) /*override*/; + virtual int SendEncrypted(const unsigned char * a_Buffer, size_t a_NumBytes) /*override*/; } ; diff --git a/src/PolarSSL++/CallbackSslContext.h b/src/PolarSSL++/CallbackSslContext.h index 3e6edc5f4..34be7158c 100644 --- a/src/PolarSSL++/CallbackSslContext.h +++ b/src/PolarSSL++/CallbackSslContext.h @@ -54,9 +54,9 @@ protected: /** The callbacks to use to send and receive SSL peer data */ cDataCallbacks * m_Callbacks; - // cSslContext overrides: - virtual int ReceiveEncrypted(unsigned char * a_Buffer, size_t a_NumBytes) override; - virtual int SendEncrypted(const unsigned char * a_Buffer, size_t a_NumBytes) override; + // cSslContext /*override*/s: + virtual int ReceiveEncrypted(unsigned char * a_Buffer, size_t a_NumBytes) /*override*/; + virtual int SendEncrypted(const unsigned char * a_Buffer, size_t a_NumBytes) /*override*/; }; diff --git a/src/Protocol/Authenticator.h b/src/Protocol/Authenticator.h index 853eff535..b3bae5417 100644 --- a/src/Protocol/Authenticator.h +++ b/src/Protocol/Authenticator.h @@ -87,7 +87,7 @@ private: bool m_ShouldAuthenticate; /** cIsThread override: */ - virtual void Execute(void) override; + virtual void Execute(void) /*override*/; /** Returns true if the user authenticated okay, false on error Returns the case-corrected username, UUID, and properties (eg. skin). */ diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index 8e1842ec1..2e10d8a5b 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -134,7 +134,7 @@ protected: cClientHandle * m_Client; cCriticalSection m_CSPacket; // Each SendXYZ() function must acquire this CS in order to send the whole packet at once - /// A generic data-sending routine, all outgoing packet data needs to be routed through this so that descendants may override it + /// A generic data-sending routine, all outgoing packet data needs to be routed through this so that descendants may /*override*/ it virtual void SendData(const char * a_Data, size_t a_Size) = 0; /// Called after writing each packet, enables descendants to flush their buffers diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp index a66c64309..23e7b7406 100644 --- a/src/Protocol/Protocol125.cpp +++ b/src/Protocol/Protocol125.cpp @@ -2128,4 +2128,3 @@ void cProtocol125::WriteMobMetadata(const cMonster & a_Mob) - diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h index 1063777a2..254360533 100644 --- a/src/Protocol/Protocol125.h +++ b/src/Protocol/Protocol125.h @@ -25,81 +25,81 @@ public: cProtocol125(cClientHandle * a_Client); /// Called when client sends some data: - virtual void DataReceived(const char * a_Data, size_t a_Size) override; + virtual void DataReceived(const char * a_Data, size_t a_Size) /*override*/; /// Sending stuff to clients (alphabetically sorted): - virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override; - virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; - virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; - virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; - virtual void SendChat (const AString & a_Message) override; - virtual void SendChat (const cCompositeChat & a_Message) override; - virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; - virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; - virtual void SendDestroyEntity (const cEntity & a_Entity) override; - virtual void SendDisconnect (const AString & a_Reason) override; - virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+) - virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) override; - virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; - virtual void SendEntityHeadLook (const cEntity & a_Entity) override; - virtual void SendEntityLook (const cEntity & a_Entity) override; - virtual void SendEntityMetadata (const cEntity & a_Entity) override; - virtual void SendEntityProperties (const cEntity & a_Entity) override; - virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; - virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; - virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override; - virtual void SendEntityVelocity (const cEntity & a_Entity) override; - virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override; - virtual void SendGameMode (eGameMode a_GameMode) override; - virtual void SendHealth (void) override; - virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override; - virtual void SendKeepAlive (int a_PingID) override; - virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; - virtual void SendLoginSuccess (void) override; - virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override; - virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override; - virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override; - virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override; - virtual void SendPaintingSpawn (const cPainting & a_Painting) override; - virtual void SendPickupSpawn (const cPickup & a_Pickup) override; - virtual void SendPlayerAbilities (void) override {} // This protocol doesn't support such message - virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override; - virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override; - virtual void SendPlayerMaxSpeed (void) override; - virtual void SendPlayerMoveLook (void) override; - virtual void SendPlayerPosition (void) override; - virtual void SendPlayerSpawn (const cPlayer & a_Player) override; - virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override; - virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override; - virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override; - virtual void SendExperience (void) override; - virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; - virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override; - virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override {} // This protocol doesn't support such message - virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override {} // This protocol doesn't support such message - virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override; - virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; - virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; - virtual void SendSpawnMob (const cMonster & a_Mob) override; - virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override; - virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) override; - virtual void SendStatistics (const cStatManager & a_Manager) override; - virtual void SendTabCompletionResults(const AStringVector & a_Results) override; - virtual void SendTeleportEntity (const cEntity & a_Entity) override; - virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override; - virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; - virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override {} - virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override; - virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void SendWeather (eWeather a_Weather) override; - virtual void SendWholeInventory (const cWindow & a_Window) override; - virtual void SendWindowClose (const cWindow & a_Window) override; - virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) override; + virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) /*override*/; + virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) /*override*/; + virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) /*override*/; + virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/; + virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) /*override*/; + virtual void SendChat (const AString & a_Message) /*override*/; + virtual void SendChat (const cCompositeChat & a_Message) /*override*/; + virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) /*override*/; + virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) /*override*/; + virtual void SendDestroyEntity (const cEntity & a_Entity) /*override*/; + virtual void SendDisconnect (const AString & a_Reason) /*override*/; + virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; ///< Request the client to open up the sign editor for the sign (1.6+) + virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) /*override*/; + virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) /*override*/; + virtual void SendEntityHeadLook (const cEntity & a_Entity) /*override*/; + virtual void SendEntityLook (const cEntity & a_Entity) /*override*/; + virtual void SendEntityMetadata (const cEntity & a_Entity) /*override*/; + virtual void SendEntityProperties (const cEntity & a_Entity) /*override*/; + virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) /*override*/; + virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) /*override*/; + virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) /*override*/; + virtual void SendEntityVelocity (const cEntity & a_Entity) /*override*/; + virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) /*override*/; + virtual void SendGameMode (eGameMode a_GameMode) /*override*/; + virtual void SendHealth (void) /*override*/; + virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) /*override*/; + virtual void SendKeepAlive (int a_PingID) /*override*/; + virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) /*override*/; + virtual void SendLoginSuccess (void) /*override*/; + virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) /*override*/; + virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) /*override*/; + virtual void SendMapInfo (int a_ID, unsigned int a_Scale) /*override*/; + virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) /*override*/; + virtual void SendPaintingSpawn (const cPainting & a_Painting) /*override*/; + virtual void SendPickupSpawn (const cPickup & a_Pickup) /*override*/; + virtual void SendPlayerAbilities (void) /*override*/ {} // This protocol doesn't support such message + virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) /*override*/; + virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) /*override*/; + virtual void SendPlayerMaxSpeed (void) /*override*/; + virtual void SendPlayerMoveLook (void) /*override*/; + virtual void SendPlayerPosition (void) /*override*/; + virtual void SendPlayerSpawn (const cPlayer & a_Player) /*override*/; + virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) /*override*/; + virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) /*override*/; + virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) /*override*/; + virtual void SendExperience (void) /*override*/; + virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) /*override*/; + virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) /*override*/; + virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) /*override*/ {} // This protocol doesn't support such message + virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) /*override*/ {} // This protocol doesn't support such message + virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) /*override*/; + virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) /*override*/; + virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) /*override*/; + virtual void SendSpawnMob (const cMonster & a_Mob) /*override*/; + virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) /*override*/; + virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) /*override*/; + virtual void SendStatistics (const cStatManager & a_Manager) /*override*/; + virtual void SendTabCompletionResults(const AStringVector & a_Results) /*override*/; + virtual void SendTeleportEntity (const cEntity & a_Entity) /*override*/; + virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; + virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) /*override*/; + virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) /*override*/; + virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) /*override*/ {} + virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) /*override*/; + virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; + virtual void SendWeather (eWeather a_Weather) /*override*/; + virtual void SendWholeInventory (const cWindow & a_Window) /*override*/; + virtual void SendWindowClose (const cWindow & a_Window) /*override*/; + virtual void SendWindowOpen (const cWindow & a_Window) /*override*/; + virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) /*override*/; - virtual AString GetAuthServerID(void) override; + virtual AString GetAuthServerID(void) /*override*/; protected: /// Results of packet-parsing: @@ -119,7 +119,7 @@ protected: Used to avoid Respawning into the same dimension, which confuses the client. */ eDimension m_LastSentDimension; - virtual void SendData(const char * a_Data, size_t a_Size) override; + virtual void SendData(const char * a_Data, size_t a_Size) /*override*/; /// Sends the Handshake packet void SendHandshake(const AString & a_ConnectionHash); diff --git a/src/Protocol/Protocol132.h b/src/Protocol/Protocol132.h index 1124a7253..144d560fd 100644 --- a/src/Protocol/Protocol132.h +++ b/src/Protocol/Protocol132.h @@ -41,35 +41,35 @@ public: virtual ~cProtocol132(); /// Called when client sends some data: - virtual void DataReceived(const char * a_Data, size_t a_Size) override; + virtual void DataReceived(const char * a_Data, size_t a_Size) /*override*/; // Sending commands (alphabetically sorted): - virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; - virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; - virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; - virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; - virtual void SendDestroyEntity (const cEntity & a_Entity) override; - virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; - virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; - virtual void SendPlayerSpawn (const cPlayer & a_Player) override; - virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override; - virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; - virtual void SendSpawnMob (const cMonster & a_Mob) override; - virtual void SendTabCompletionResults(const AStringVector & a_Results) override; - virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; - virtual void SendWholeInventory (const cWindow & a_Window) override; - - virtual AString GetAuthServerID(void) override; + virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) /*override*/; + virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) /*override*/; + virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/; + virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) /*override*/; + virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) /*override*/; + virtual void SendDestroyEntity (const cEntity & a_Entity) /*override*/; + virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) /*override*/; + virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) /*override*/; + virtual void SendPlayerSpawn (const cPlayer & a_Player) /*override*/; + virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) /*override*/; + virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) /*override*/; + virtual void SendSpawnMob (const cMonster & a_Mob) /*override*/; + virtual void SendTabCompletionResults(const AStringVector & a_Results) /*override*/; + virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) /*override*/; + virtual void SendWholeInventory (const cWindow & a_Window) /*override*/; + + virtual AString GetAuthServerID(void) /*override*/; /// Handling of the additional packets: - virtual int ParsePacket(unsigned char a_PacketType) override; + virtual int ParsePacket(unsigned char a_PacketType) /*override*/; // Modified packets: - virtual int ParseBlockPlace (void) override; - virtual int ParseHandshake (void) override; - virtual int ParseLogin (void) override; - virtual int ParsePlayerAbilities(void) override; + virtual int ParseBlockPlace (void) /*override*/; + virtual int ParseHandshake (void) /*override*/; + virtual int ParseLogin (void) /*override*/; + virtual int ParsePlayerAbilities(void) /*override*/; // New packets: virtual int ParseClientStatuses (void); @@ -88,14 +88,14 @@ protected: /// The ServerID used for session authentication; set in StartEncryption(), used in GetAuthServerID() AString m_AuthServerID; - virtual void SendData(const char * a_Data, size_t a_Size) override; + virtual void SendData(const char * a_Data, size_t a_Size) /*override*/; // DEBUG: - virtual void Flush(void) override; + virtual void Flush(void) /*override*/; // Items in slots are sent differently - virtual void WriteItem(const cItem & a_Item) override; - virtual int ParseItem(cItem & a_Item) override; + virtual void WriteItem(const cItem & a_Item) /*override*/; + virtual int ParseItem(cItem & a_Item) /*override*/; /// Parses the metadata that may come with the item. int ParseItemMetadata(cItem & a_Item, const AString & a_Metadata); diff --git a/src/Protocol/Protocol14x.h b/src/Protocol/Protocol14x.h index 227cc8cc7..234c1a39e 100644 --- a/src/Protocol/Protocol14x.h +++ b/src/Protocol/Protocol14x.h @@ -32,12 +32,12 @@ public: cProtocol142(cClientHandle * a_Client); // Sending commands (alphabetically sorted): - virtual void SendPickupSpawn (const cPickup & a_Pickup) override; - virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; - virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override; + virtual void SendPickupSpawn (const cPickup & a_Pickup) /*override*/; + virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) /*override*/; + virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) /*override*/; // Specific packet parsers: - virtual int ParseLocaleViewDistance(void) override; + virtual int ParseLocaleViewDistance(void) /*override*/; } ; @@ -52,10 +52,10 @@ class cProtocol146 : public: cProtocol146(cClientHandle * a_Client); - virtual void SendPickupSpawn (const cPickup & a_Pickup) override; - virtual void SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) override; - virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override; - virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) override; + virtual void SendPickupSpawn (const cPickup & a_Pickup) /*override*/; + virtual void SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) /*override*/; + virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) /*override*/; + virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) /*override*/; } ; diff --git a/src/Protocol/Protocol15x.h b/src/Protocol/Protocol15x.h index 0d171a67c..9579e6cdc 100644 --- a/src/Protocol/Protocol15x.h +++ b/src/Protocol/Protocol15x.h @@ -28,11 +28,11 @@ class cProtocol150 : public: cProtocol150(cClientHandle * a_Client); - virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override; - virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override; - virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override; - virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override; + virtual void SendWindowOpen (const cWindow & a_Window) /*override*/; + virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) /*override*/; + virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) /*override*/; + virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) /*override*/; + virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) /*override*/; virtual int ParseWindowClick(void); } ; diff --git a/src/Protocol/Protocol16x.h b/src/Protocol/Protocol16x.h index add761d1e..68d548eb5 100644 --- a/src/Protocol/Protocol16x.h +++ b/src/Protocol/Protocol16x.h @@ -34,26 +34,26 @@ public: protected: - // cProtocol150 overrides: - virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override; - virtual void SendChat (const AString & a_Message) override; - virtual void SendChat (const cCompositeChat & a_Message) override; - virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+) - virtual void SendGameMode (eGameMode a_GameMode) override; - virtual void SendHealth (void) override; - virtual void SendPlayerMaxSpeed(void) override; - virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override; - virtual void SendWindowOpen (const cWindow & a_Window) override; + // cProtocol150 /*override*/s: + virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) /*override*/; + virtual void SendChat (const AString & a_Message) /*override*/; + virtual void SendChat (const cCompositeChat & a_Message) /*override*/; + virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; ///< Request the client to open up the sign editor for the sign (1.6+) + virtual void SendGameMode (eGameMode a_GameMode) /*override*/; + virtual void SendHealth (void) /*override*/; + virtual void SendPlayerMaxSpeed(void) /*override*/; + virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) /*override*/; + virtual void SendWindowOpen (const cWindow & a_Window) /*override*/; - virtual int ParseEntityAction (void) override; - virtual int ParseLogin (void) override; - virtual int ParsePlayerAbilities(void) override; + virtual int ParseEntityAction (void) /*override*/; + virtual int ParseLogin (void) /*override*/; + virtual int ParsePlayerAbilities(void) /*override*/; // New packets: virtual int ParseSteerVehicle(void); // Enable new packets' handling - virtual int ParsePacket(unsigned char a_PacketType) override; + virtual int ParsePacket(unsigned char a_PacketType) /*override*/; } ; @@ -69,8 +69,8 @@ public: cProtocol162(cClientHandle * a_Client); protected: - // cProtocol161 overrides: - virtual void SendPlayerMaxSpeed(void) override; + // cProtocol161 /*override*/s: + virtual void SendPlayerMaxSpeed(void) /*override*/; } ; diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h index ccfa19eb6..2ebd51d12 100644 --- a/src/Protocol/Protocol17x.h +++ b/src/Protocol/Protocol17x.h @@ -57,81 +57,81 @@ public: cProtocol172(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); /** Called when client sends some data: */ - virtual void DataReceived(const char * a_Data, size_t a_Size) override; + virtual void DataReceived(const char * a_Data, size_t a_Size) /*override*/; /** Sending stuff to clients (alphabetically sorted): */ - virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override; - virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; - virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; - virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; - virtual void SendChat (const AString & a_Message) override; - virtual void SendChat (const cCompositeChat & a_Message) override; - virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; - virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; - virtual void SendDestroyEntity (const cEntity & a_Entity) override; - virtual void SendDisconnect (const AString & a_Reason) override; - virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+) - virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) override; - virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; - virtual void SendEntityHeadLook (const cEntity & a_Entity) override; - virtual void SendEntityLook (const cEntity & a_Entity) override; - virtual void SendEntityMetadata (const cEntity & a_Entity) override; - virtual void SendEntityProperties (const cEntity & a_Entity) override; - virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; - virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; - virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override; - virtual void SendEntityVelocity (const cEntity & a_Entity) override; - virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override; - virtual void SendGameMode (eGameMode a_GameMode) override; - virtual void SendHealth (void) override; - virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override; - virtual void SendKeepAlive (int a_PingID) override; - virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; - virtual void SendLoginSuccess (void) override; - virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override; - virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override; - virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override; - virtual void SendPaintingSpawn (const cPainting & a_Painting) override; - virtual void SendPickupSpawn (const cPickup & a_Pickup) override; - virtual void SendPlayerAbilities (void) override; - virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override; - virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override; - virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override; - virtual void SendPlayerMaxSpeed (void) override; - virtual void SendPlayerMoveLook (void) override; - virtual void SendPlayerPosition (void) override; - virtual void SendPlayerSpawn (const cPlayer & a_Player) override; - virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override; - virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override; - virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override; - virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override; - virtual void SendExperience (void) override; - virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; - virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override; - virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override; - virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override; - virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; - virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; - virtual void SendSpawnMob (const cMonster & a_Mob) override; - virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override; - virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) override; - virtual void SendStatistics (const cStatManager & a_Manager) override; - virtual void SendTabCompletionResults(const AStringVector & a_Results) override; - virtual void SendTeleportEntity (const cEntity & a_Entity) override; - virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override; - virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; - virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override; - virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override; - virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void SendWeather (eWeather a_Weather) override; - virtual void SendWholeInventory (const cWindow & a_Window) override; - virtual void SendWindowClose (const cWindow & a_Window) override; - virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) override; - - virtual AString GetAuthServerID(void) override { return m_AuthServerID; } + virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) /*override*/; + virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) /*override*/; + virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) /*override*/; + virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/; + virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) /*override*/; + virtual void SendChat (const AString & a_Message) /*override*/; + virtual void SendChat (const cCompositeChat & a_Message) /*override*/; + virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) /*override*/; + virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) /*override*/; + virtual void SendDestroyEntity (const cEntity & a_Entity) /*override*/; + virtual void SendDisconnect (const AString & a_Reason) /*override*/; + virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; ///< Request the client to open up the sign editor for the sign (1.6+) + virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) /*override*/; + virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) /*override*/; + virtual void SendEntityHeadLook (const cEntity & a_Entity) /*override*/; + virtual void SendEntityLook (const cEntity & a_Entity) /*override*/; + virtual void SendEntityMetadata (const cEntity & a_Entity) /*override*/; + virtual void SendEntityProperties (const cEntity & a_Entity) /*override*/; + virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) /*override*/; + virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) /*override*/; + virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) /*override*/; + virtual void SendEntityVelocity (const cEntity & a_Entity) /*override*/; + virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) /*override*/; + virtual void SendGameMode (eGameMode a_GameMode) /*override*/; + virtual void SendHealth (void) /*override*/; + virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) /*override*/; + virtual void SendKeepAlive (int a_PingID) /*override*/; + virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) /*override*/; + virtual void SendLoginSuccess (void) /*override*/; + virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) /*override*/; + virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) /*override*/; + virtual void SendMapInfo (int a_ID, unsigned int a_Scale) /*override*/; + virtual void SendPaintingSpawn (const cPainting & a_Painting) /*override*/; + virtual void SendPickupSpawn (const cPickup & a_Pickup) /*override*/; + virtual void SendPlayerAbilities (void) /*override*/; + virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) /*override*/; + virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) /*override*/; + virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) /*override*/; + virtual void SendPlayerMaxSpeed (void) /*override*/; + virtual void SendPlayerMoveLook (void) /*override*/; + virtual void SendPlayerPosition (void) /*override*/; + virtual void SendPlayerSpawn (const cPlayer & a_Player) /*override*/; + virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) /*override*/; + virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) /*override*/; + virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) /*override*/; + virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) /*override*/; + virtual void SendExperience (void) /*override*/; + virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) /*override*/; + virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) /*override*/; + virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) /*override*/; + virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) /*override*/; + virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) /*override*/; + virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) /*override*/; + virtual void SendSpawnMob (const cMonster & a_Mob) /*override*/; + virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) /*override*/; + virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) /*override*/; + virtual void SendStatistics (const cStatManager & a_Manager) /*override*/; + virtual void SendTabCompletionResults(const AStringVector & a_Results) /*override*/; + virtual void SendTeleportEntity (const cEntity & a_Entity) /*override*/; + virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; + virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) /*override*/; + virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) /*override*/; + virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) /*override*/; + virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) /*override*/; + virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; + virtual void SendWeather (eWeather a_Weather) /*override*/; + virtual void SendWholeInventory (const cWindow & a_Window) /*override*/; + virtual void SendWindowClose (const cWindow & a_Window) /*override*/; + virtual void SendWindowOpen (const cWindow & a_Window) /*override*/; + virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) /*override*/; + + virtual AString GetAuthServerID(void) /*override*/ { return m_AuthServerID; } protected: @@ -295,7 +295,7 @@ protected: void WritePacket(cByteBuffer & a_Packet); /** Sends the data to the client, encrypting them if needed. */ - virtual void SendData(const char * a_Data, size_t a_Size) override; + virtual void SendData(const char * a_Data, size_t a_Size) /*override*/; void SendCompass(const cWorld & a_World); @@ -324,9 +324,9 @@ class cProtocol176 : public: cProtocol176(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); - // cProtocol172 overrides: - virtual void SendPlayerSpawn(const cPlayer & a_Player) override; - virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) override; + // cProtocol172 /*override*/s: + virtual void SendPlayerSpawn(const cPlayer & a_Player) /*override*/; + virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) /*override*/; } ; diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index a05aeda70..206d30e1f 100644 --- a/src/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h @@ -60,83 +60,83 @@ public: static AString GetVersionTextFromInt(int a_ProtocolVersion); /// Called when client sends some data: - virtual void DataReceived(const char * a_Data, size_t a_Size) override; + virtual void DataReceived(const char * a_Data, size_t a_Size) /*override*/; /// Sending stuff to clients (alphabetically sorted): - virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override; - virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; - virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; - virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; - virtual void SendChat (const AString & a_Message) override; - virtual void SendChat (const cCompositeChat & a_Message) override; - virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; - virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; - virtual void SendDestroyEntity (const cEntity & a_Entity) override; - virtual void SendDisconnect (const AString & a_Reason) override; - virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+) - virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) override; - virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; - virtual void SendEntityHeadLook (const cEntity & a_Entity) override; - virtual void SendEntityLook (const cEntity & a_Entity) override; - virtual void SendEntityMetadata (const cEntity & a_Entity) override; - virtual void SendEntityProperties (const cEntity & a_Entity) override; - virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; - virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; - virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override; - virtual void SendEntityVelocity (const cEntity & a_Entity) override; - virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override; - virtual void SendGameMode (eGameMode a_GameMode) override; - virtual void SendHealth (void) override; - virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override; - virtual void SendKeepAlive (int a_PingID) override; - virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; - virtual void SendLoginSuccess (void) override; - virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override; - virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override; - virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override; - virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override; - virtual void SendPaintingSpawn (const cPainting & a_Painting) override; - virtual void SendPickupSpawn (const cPickup & a_Pickup) override; - virtual void SendPlayerAbilities (void) override; - virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override; - virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override; - virtual void SendPlayerMaxSpeed (void) override; - virtual void SendPlayerMoveLook (void) override; - virtual void SendPlayerPosition (void) override; - virtual void SendPlayerSpawn (const cPlayer & a_Player) override; - virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override; - virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) override; - virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) override; - virtual void SendExperience (void) override; - virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; - virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override; - virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override; - virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override; - virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override; - virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; - virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; - virtual void SendSpawnMob (const cMonster & a_Mob) override; - virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override; - virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) override; - virtual void SendStatistics (const cStatManager & a_Manager) override; - virtual void SendTabCompletionResults(const AStringVector & a_Results) override; - virtual void SendTeleportEntity (const cEntity & a_Entity) override; - virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override; - virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; - virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override; - virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override; - virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void SendWeather (eWeather a_Weather) override; - virtual void SendWholeInventory (const cWindow & a_Window) override; - virtual void SendWindowClose (const cWindow & a_Window) override; - virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) override; + virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) /*override*/; + virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) /*override*/; + virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) /*override*/; + virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/; + virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) /*override*/; + virtual void SendChat (const AString & a_Message) /*override*/; + virtual void SendChat (const cCompositeChat & a_Message) /*override*/; + virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) /*override*/; + virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) /*override*/; + virtual void SendDestroyEntity (const cEntity & a_Entity) /*override*/; + virtual void SendDisconnect (const AString & a_Reason) /*override*/; + virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; ///< Request the client to open up the sign editor for the sign (1.6+) + virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration) /*override*/; + virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) /*override*/; + virtual void SendEntityHeadLook (const cEntity & a_Entity) /*override*/; + virtual void SendEntityLook (const cEntity & a_Entity) /*override*/; + virtual void SendEntityMetadata (const cEntity & a_Entity) /*override*/; + virtual void SendEntityProperties (const cEntity & a_Entity) /*override*/; + virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) /*override*/; + virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) /*override*/; + virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) /*override*/; + virtual void SendEntityVelocity (const cEntity & a_Entity) /*override*/; + virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) /*override*/; + virtual void SendGameMode (eGameMode a_GameMode) /*override*/; + virtual void SendHealth (void) /*override*/; + virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) /*override*/; + virtual void SendKeepAlive (int a_PingID) /*override*/; + virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) /*override*/; + virtual void SendLoginSuccess (void) /*override*/; + virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) /*override*/; + virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) /*override*/; + virtual void SendMapInfo (int a_ID, unsigned int a_Scale) /*override*/; + virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) /*override*/; + virtual void SendPaintingSpawn (const cPainting & a_Painting) /*override*/; + virtual void SendPickupSpawn (const cPickup & a_Pickup) /*override*/; + virtual void SendPlayerAbilities (void) /*override*/; + virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) /*override*/; + virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) /*override*/; + virtual void SendPlayerMaxSpeed (void) /*override*/; + virtual void SendPlayerMoveLook (void) /*override*/; + virtual void SendPlayerPosition (void) /*override*/; + virtual void SendPlayerSpawn (const cPlayer & a_Player) /*override*/; + virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) /*override*/; + virtual void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID) /*override*/; + virtual void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) /*override*/; + virtual void SendExperience (void) /*override*/; + virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) /*override*/; + virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) /*override*/; + virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) /*override*/; + virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) /*override*/; + virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) /*override*/; + virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) /*override*/; + virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) /*override*/; + virtual void SendSpawnMob (const cMonster & a_Mob) /*override*/; + virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) /*override*/; + virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) /*override*/; + virtual void SendStatistics (const cStatManager & a_Manager) /*override*/; + virtual void SendTabCompletionResults(const AStringVector & a_Results) /*override*/; + virtual void SendTeleportEntity (const cEntity & a_Entity) /*override*/; + virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; + virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) /*override*/; + virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) /*override*/; + virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) /*override*/; + virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) /*override*/; + virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; + virtual void SendWeather (eWeather a_Weather) /*override*/; + virtual void SendWholeInventory (const cWindow & a_Window) /*override*/; + virtual void SendWindowClose (const cWindow & a_Window) /*override*/; + virtual void SendWindowOpen (const cWindow & a_Window) /*override*/; + virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) /*override*/; - virtual AString GetAuthServerID(void) override; + virtual AString GetAuthServerID(void) /*override*/; - virtual void SendData(const char * a_Data, size_t a_Size) override; + virtual void SendData(const char * a_Data, size_t a_Size) /*override*/; protected: cProtocol * m_Protocol; ///< The recognized protocol diff --git a/src/RCONServer.cpp b/src/RCONServer.cpp index 141c67d1b..c33c33d21 100644 --- a/src/RCONServer.cpp +++ b/src/RCONServer.cpp @@ -51,13 +51,13 @@ public: { } - // cCommandOutputCallback overrides: - virtual void Out(const AString & a_Text) override + // cCommandOutputCallback /*override*/s: + virtual void Out(const AString & a_Text) /*override*/ { m_Buffer.append(a_Text); } - virtual void Finished(void) override + virtual void Finished(void) /*override*/ { m_Connection.SendResponse(m_RequestID, RCON_PACKET_RESPONSE, (int)m_Buffer.size(), m_Buffer.c_str()); delete this; diff --git a/src/RCONServer.h b/src/RCONServer.h index 47c746736..93604cf28 100644 --- a/src/RCONServer.h +++ b/src/RCONServer.h @@ -64,10 +64,10 @@ protected: AString m_IPAddress; - // cSocketThreads::cCallback overrides: - virtual bool DataReceived(const char * a_Data, size_t a_Size) override; - virtual void GetOutgoingData(AString & a_Data) override; - virtual void SocketClosed(void) override; + // cSocketThreads::cCallback /*override*/s: + virtual bool DataReceived(const char * a_Data, size_t a_Size) /*override*/; + virtual void GetOutgoingData(AString & a_Data) /*override*/; + virtual void SocketClosed(void) /*override*/; /// Processes the given packet and sends the response; returns true if successful, false if the connection is to be dropped bool ProcessPacket(int a_RequestID, int a_PacketType, int a_PayloadLength, const char * a_Payload); @@ -99,8 +99,8 @@ protected: AString m_Password; - // cListenThread::cCallback overrides: - virtual void OnConnectionAccepted(cSocket & a_Socket) override; + // cListenThread::cCallback /*override*/s: + virtual void OnConnectionAccepted(cSocket & a_Socket) /*override*/; } ; diff --git a/src/Server.cpp b/src/Server.cpp index 069e2a169..f3a1404aa 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -584,7 +584,7 @@ void cServer::PrintHelp(const AStringVector & a_Split, cCommandOutputCallback & public: cCallback(void) : m_MaxLen(0) {} - virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override + virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) /*override*/ { UNUSED(a_Plugin); UNUSED(a_Permission); diff --git a/src/Server.h b/src/Server.h index f20e6932f..8e190fdca 100644 --- a/src/Server.h +++ b/src/Server.h @@ -171,8 +171,8 @@ private: protected: cServer & m_Server; - // cIsThread overrides: - virtual void Execute(void) override; + // cIsThread /*override*/s: + virtual void Execute(void) /*override*/; } ; @@ -242,8 +242,8 @@ private: /** Ticks the clients in m_Clients, manages the list in respect to removing clients */ void TickClients(float a_Dt); - // cListenThread::cCallback overrides: - virtual void OnConnectionAccepted(cSocket & a_Socket) override; + // cListenThread::cCallback /*override*/s: + virtual void OnConnectionAccepted(cSocket & a_Socket) /*override*/; }; // tolua_export diff --git a/src/Simulator/DelayedFluidSimulator.h b/src/Simulator/DelayedFluidSimulator.h index 8a6c26c7a..cf74274cb 100644 --- a/src/Simulator/DelayedFluidSimulator.h +++ b/src/Simulator/DelayedFluidSimulator.h @@ -53,11 +53,11 @@ class cDelayedFluidSimulator : public: cDelayedFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, int a_TickDelay); - // cSimulator overrides: - virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override; - virtual void Simulate(float a_Dt) override; - virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override; - virtual cFluidSimulatorData * CreateChunkData(void) override { return new cDelayedFluidSimulatorChunkData(m_TickDelay); } + // cSimulator /*override*/s: + virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) /*override*/; + virtual void Simulate(float a_Dt) /*override*/; + virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) /*override*/; + virtual cFluidSimulatorData * CreateChunkData(void) /*override*/ { return new cDelayedFluidSimulatorChunkData(m_TickDelay); } protected: @@ -73,7 +73,7 @@ protected: | adding blocks here ^ | ^ simulating here */ - /// Called from SimulateChunk() to simulate each block in one slot of blocks. Descendants override this method to provide custom simulation. + /// Called from SimulateChunk() to simulate each block in one slot of blocks. Descendants /*override*/ this method to provide custom simulation. virtual void SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) = 0; } ; diff --git a/src/Simulator/FireSimulator.h b/src/Simulator/FireSimulator.h index 9ccc3ef4f..1174adf5c 100644 --- a/src/Simulator/FireSimulator.h +++ b/src/Simulator/FireSimulator.h @@ -22,10 +22,10 @@ public: cFireSimulator(cWorld & a_World, cIniFile & a_IniFile); ~cFireSimulator(); - 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 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; + virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) /*override*/; static bool IsFuel (BLOCKTYPE a_BlockType); static bool DoesBurnForever(BLOCKTYPE a_BlockType); @@ -44,7 +44,7 @@ protected: int m_ReplaceFuelChance; - virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override; + virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) /*override*/; /// Returns the time [msec] after which the specified fire block is stepped again; based on surrounding fuels int GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ); diff --git a/src/Simulator/FloodyFluidSimulator.h b/src/Simulator/FloodyFluidSimulator.h index 8e1be5e6b..c12dbd868 100644 --- a/src/Simulator/FloodyFluidSimulator.h +++ b/src/Simulator/FloodyFluidSimulator.h @@ -35,8 +35,8 @@ protected: NIBBLETYPE m_Falloff; int m_NumNeighborsForSource; - // cDelayedFluidSimulator overrides: - virtual void SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override; + // cDelayedFluidSimulator /*override*/s: + virtual void SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) /*override*/; /** Checks tributaries, if not fed, decreases the block's level and returns true. */ bool CheckTributaries(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_MyMeta); diff --git a/src/Simulator/FluidSimulator.h b/src/Simulator/FluidSimulator.h index 672b740a2..dcfa05782 100644 --- a/src/Simulator/FluidSimulator.h +++ b/src/Simulator/FluidSimulator.h @@ -43,8 +43,8 @@ class cFluidSimulator : public: cFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid); - // cSimulator overrides: - virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override; + // cSimulator /*override*/s: + virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) /*override*/; /// Gets the flowing direction. If a_Over is true also the block over the current block affects the direction (standard) virtual Direction GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a_Over = true); diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp index 7b3a2c2fa..c0a5f864f 100644 --- a/src/Simulator/IncrementalRedstoneSimulator.cpp +++ b/src/Simulator/IncrementalRedstoneSimulator.cpp @@ -846,7 +846,7 @@ void cIncrementalRedstoneSimulator::HandleDropSpenser(int a_RelBlockX, int a_Rel public: cSetPowerToDropSpenser(bool a_IsPowered) : m_IsPowered(a_IsPowered) {} - virtual bool Item(cRedstonePoweredEntity * a_DropSpenser) override + virtual bool Item(cRedstonePoweredEntity * a_DropSpenser) /*override*/ { a_DropSpenser->SetRedstonePower(m_IsPowered); return false; @@ -947,7 +947,7 @@ void cIncrementalRedstoneSimulator::HandleCommandBlock(int a_RelBlockX, int a_Re public: cSetPowerToCommandBlock(bool a_IsPowered) : m_IsPowered(a_IsPowered) {} - virtual bool Item(cCommandBlockEntity * a_CommandBlock) override + virtual bool Item(cCommandBlockEntity * a_CommandBlock) /*override*/ { a_CommandBlock->SetRedstonePower(m_IsPowered); return false; @@ -1037,7 +1037,7 @@ void cIncrementalRedstoneSimulator::HandleNoteBlock(int a_RelBlockX, int a_RelBl public: cSetPowerToNoteBlock() {} - virtual bool Item(cRedstonePoweredEntity * a_NoteBlock) override + virtual bool Item(cRedstonePoweredEntity * a_NoteBlock) /*override*/ { a_NoteBlock->SetRedstonePower(true); return false; @@ -1129,7 +1129,7 @@ void cIncrementalRedstoneSimulator::HandlePressurePlate(int a_RelBlockX, int a_R { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { Vector3f EntityPos = a_Entity->GetPosition(); Vector3f BlockPos(m_X + 0.5f, (float)m_Y, m_Z + 0.5f); @@ -1197,7 +1197,7 @@ void cIncrementalRedstoneSimulator::HandlePressurePlate(int a_RelBlockX, int a_R { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { Vector3f EntityPos = a_Entity->GetPosition(); Vector3f BlockPos(m_X + 0.5f, (float)m_Y, m_Z + 0.5f); @@ -1265,7 +1265,7 @@ void cIncrementalRedstoneSimulator::HandlePressurePlate(int a_RelBlockX, int a_R { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { Vector3f EntityPos = a_Entity->GetPosition(); Vector3f BlockPos(m_X + 0.5f, (float)m_Y, m_Z + 0.5f); @@ -1405,7 +1405,7 @@ void cIncrementalRedstoneSimulator::HandleTrappedChest(int a_RelBlockX, int a_Re { } - virtual bool Item(cChestEntity * a_Chest) override + virtual bool Item(cChestEntity * a_Chest) /*override*/ { ASSERT(a_Chest->GetBlockType() == E_BLOCK_TRAPPED_CHEST); m_NumberOfPlayers = a_Chest->GetNumberOfPlayers(); @@ -1455,7 +1455,7 @@ void cIncrementalRedstoneSimulator::HandleTripwire(int a_RelBlockX, int a_RelBlo { } - virtual bool Item(cEntity * a_Entity) override + virtual bool Item(cEntity * a_Entity) /*override*/ { cBoundingBox bbWire(m_X, m_X + 1, m_Y, m_Y + 0.1, m_Z, m_Z + 1); cBoundingBox bbEntity(a_Entity->GetPosition(), a_Entity->GetWidth() / 2, a_Entity->GetHeight()); diff --git a/src/Simulator/IncrementalRedstoneSimulator.h b/src/Simulator/IncrementalRedstoneSimulator.h index 79740a8f6..3a3945d23 100644 --- a/src/Simulator/IncrementalRedstoneSimulator.h +++ b/src/Simulator/IncrementalRedstoneSimulator.h @@ -19,10 +19,10 @@ public: cIncrementalRedstoneSimulator(cWorld & a_World); ~cIncrementalRedstoneSimulator(); - 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); } - virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override; + 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); } + virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) /*override*/; enum eRedstoneDirection { @@ -82,7 +82,7 @@ private: SimulatedPlayerToggleableList * m_SimulatedPlayerToggleableBlocks; RepeatersDelayList * m_RepeatersDelayList; - virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override { RedstoneAddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk); } + virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) /*override*/ { RedstoneAddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk); } void RedstoneAddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk, cChunk * a_OtherChunk = NULL); cChunk * m_Chunk; diff --git a/src/Simulator/NoopFluidSimulator.h b/src/Simulator/NoopFluidSimulator.h index 9fe2f9040..1a616f416 100644 --- a/src/Simulator/NoopFluidSimulator.h +++ b/src/Simulator/NoopFluidSimulator.h @@ -26,15 +26,15 @@ public: { } - // cSimulator overrides: - virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override + // cSimulator /*override*/s: + virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) /*override*/ { UNUSED(a_BlockX); UNUSED(a_BlockY); UNUSED(a_BlockZ); UNUSED(a_Chunk); } - virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} + virtual void Simulate(float a_Dt) /*override*/ { UNUSED(a_Dt);} } ; diff --git a/src/Simulator/NoopRedstoneSimulator.h b/src/Simulator/NoopRedstoneSimulator.h index f9ed47982..43b694db8 100644 --- a/src/Simulator/NoopRedstoneSimulator.h +++ b/src/Simulator/NoopRedstoneSimulator.h @@ -20,16 +20,16 @@ public: // ~cRedstoneNoopSimulator(); - 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 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*/ { UNUSED(a_Dt); UNUSED(a_ChunkX); UNUSED(a_ChunkZ); UNUSED(a_Chunk); } - virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType) override { return false; } - virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override + virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType) /*override*/ { return false; } + virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) /*override*/ { UNUSED(a_BlockX); UNUSED(a_BlockY); diff --git a/src/Simulator/SandSimulator.h b/src/Simulator/SandSimulator.h index 1262f2792..c6a54ee02 100644 --- a/src/Simulator/SandSimulator.h +++ b/src/Simulator/SandSimulator.h @@ -14,10 +14,10 @@ class cSandSimulator : public: cSandSimulator(cWorld & a_World, cIniFile & a_IniFile); - // cSimulator overrides: - 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; + // cSimulator /*override*/s: + 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*/; /// Returns true if a falling-able block can start falling through the specified block type static bool CanStartFallingThrough(BLOCKTYPE a_BlockType); @@ -46,7 +46,7 @@ protected: int m_TotalBlocks; // Total number of blocks currently in the queue for simulating - virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override; + virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) /*override*/; /// Performs the instant fall of the block - removes it from top, Finishes it at the bottom void DoInstantFall(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ); diff --git a/src/Simulator/VanillaFluidSimulator.h b/src/Simulator/VanillaFluidSimulator.h index 89a56ca14..964b5b466 100644 --- a/src/Simulator/VanillaFluidSimulator.h +++ b/src/Simulator/VanillaFluidSimulator.h @@ -29,8 +29,8 @@ public: cVanillaFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_Falloff, int a_TickDelay, int a_NumNeighborsForSource); protected: - // cFloodyFluidSimulator overrides: - virtual void SpreadXZ(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_NewMeta) override; + // cFloodyFluidSimulator /*override*/s: + virtual void SpreadXZ(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_NewMeta) /*override*/; /** Recursively calculates the minimum number of blocks needed to descend a level. */ int CalculateFlowCost(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, Direction a_Dir, unsigned a_Iteration = 0); diff --git a/src/Simulator/VaporizeFluidSimulator.h b/src/Simulator/VaporizeFluidSimulator.h index c8eb7802b..e1c345672 100644 --- a/src/Simulator/VaporizeFluidSimulator.h +++ b/src/Simulator/VaporizeFluidSimulator.h @@ -24,9 +24,9 @@ class cVaporizeFluidSimulator : public: cVaporizeFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid); - // cSimulator overrides: - virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override; - virtual void Simulate(float a_Dt) override; + // cSimulator /*override*/s: + virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) /*override*/; + virtual void Simulate(float a_Dt) /*override*/; } ; diff --git a/src/UI/SlotArea.h b/src/UI/SlotArea.h index 6bbc87b76..cf0a129df 100644 --- a/src/UI/SlotArea.h +++ b/src/UI/SlotArea.h @@ -99,10 +99,10 @@ public: cSlotAreaInventoryBase(int a_NumSlots, int a_SlotOffset, cWindow & a_ParentWindow); // Creative inventory's click handling is somewhat different from survival inventory's, handle that here: - virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override; + virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) /*override*/; - virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const override; - virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; + virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const /*override*/; + virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) /*override*/; protected: int m_SlotOffset; // Index that this area's slot 0 has in the underlying cInventory @@ -157,10 +157,10 @@ public: } /** Distributing the stack is allowed only for compatible items (helmets into helmet slot etc.) */ - virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) override; + virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) /*override*/; /** Called when a player clicks in the window. Parameters taken from the click packet. */ - virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override; + virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) /*override*/; static bool CanPlaceArmorInSlot(int a_SlotNum, const cItem & a_Item); } ; @@ -181,14 +181,14 @@ public: virtual ~cSlotAreaItemGrid(); - virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const override; - virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; + virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const /*override*/; + virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) /*override*/; protected: cItemGrid & m_ItemGrid; - // cItemGrid::cListener overrides: - virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override; + // cItemGrid::cListener /*override*/s: + virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) /*override*/; } ; @@ -207,11 +207,11 @@ class cSlotAreaTemporary : public: cSlotAreaTemporary(int a_NumSlots, cWindow & a_ParentWindow); - // cSlotArea overrides: - virtual const cItem * GetSlot (int a_SlotNum, cPlayer & a_Player) const override; - virtual void SetSlot (int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; - virtual void OnPlayerAdded (cPlayer & a_Player) override; - virtual void OnPlayerRemoved(cPlayer & a_Player) override; + // cSlotArea /*override*/s: + virtual const cItem * GetSlot (int a_SlotNum, cPlayer & a_Player) const /*override*/; + virtual void SetSlot (int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) /*override*/; + virtual void OnPlayerAdded (cPlayer & a_Player) /*override*/; + virtual void OnPlayerRemoved(cPlayer & a_Player) /*override*/; /// Tosses the player's items in slots [a_Begin, a_End) (ie. incl. a_Begin, but excl. a_End) void TossItems(cPlayer & a_Player, int a_Begin, int a_End); @@ -238,14 +238,14 @@ public: /// a_GridSize is allowed to be only 2 or 3 cSlotAreaCrafting(int a_GridSize, cWindow & a_ParentWindow); - // cSlotAreaTemporary overrides: - virtual void Clicked (cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override; + // cSlotAreaTemporary /*override*/s: + virtual void Clicked (cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) /*override*/; virtual void DblClicked (cPlayer & a_Player, int a_SlotNum); - virtual void OnPlayerRemoved(cPlayer & a_Player) override; - virtual void SetSlot (int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; + virtual void OnPlayerRemoved(cPlayer & a_Player) /*override*/; + virtual void SetSlot (int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) /*override*/; // Distributing items into this area is completely disabled - virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) override; + virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) /*override*/; protected: @@ -286,13 +286,13 @@ class cSlotAreaAnvil : public: cSlotAreaAnvil(cAnvilWindow & a_ParentWindow); - // cSlotArea overrides: - virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override; - virtual void ShiftClicked(cPlayer & a_Player, int a_SlotNum, const cItem & a_ClickedItem) override; - virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) override; + // cSlotArea /*override*/s: + virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) /*override*/; + virtual void ShiftClicked(cPlayer & a_Player, int a_SlotNum, const cItem & a_ClickedItem) /*override*/; + virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) /*override*/; - // cSlotAreaTemporary overrides: - virtual void OnPlayerRemoved(cPlayer & a_Player) override; + // cSlotAreaTemporary /*override*/s: + virtual void OnPlayerRemoved(cPlayer & a_Player) /*override*/; /** Can the player take the item from the slot? */ bool CanTakeResultItem(cPlayer & a_Player); @@ -327,16 +327,16 @@ public: bool IsPlaceableItem(short a_ItemType); - virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override; - virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) override; - virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const override; - virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; + virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) /*override*/; + virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) /*override*/; + virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const /*override*/; + virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) /*override*/; protected: cBeaconEntity * m_Beacon; - // cItemGrid::cListener overrides: - virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override; + // cItemGrid::cListener /*override*/s: + virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) /*override*/; } ; @@ -351,14 +351,14 @@ class cSlotAreaEnchanting : public: cSlotAreaEnchanting(cEnchantingWindow & a_ParentWindow, int a_BlockX, int a_BlockY, int a_BlockZ); - // cSlotArea overrides: - virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override; - virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) override; + // cSlotArea /*override*/s: + virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) /*override*/; + virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) /*override*/; virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; - // cSlotAreaTemporary overrides: + // cSlotAreaTemporary /*override*/s: virtual void OnPlayerAdded (cPlayer & a_Player) override; - virtual void OnPlayerRemoved(cPlayer & a_Player) override; + virtual void OnPlayerRemoved(cPlayer & a_Player) /*override*/; /* Get the count of bookshelves who stand in the near of the enchanting table */ int GetBookshelvesCount(cWorld * a_World); @@ -380,8 +380,8 @@ class cSlotAreaChest : public: cSlotAreaChest(cChestEntity * a_Chest, cWindow & a_ParentWindow); - virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const override; - virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; + virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const /*override*/; + virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) /*override*/; protected: cChestEntity * m_Chest; @@ -397,8 +397,8 @@ class cSlotAreaDoubleChest : public: cSlotAreaDoubleChest(cChestEntity * a_TopChest, cChestEntity * a_BottomChest, cWindow & a_ParentWindow); - virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const override; - virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; + virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const /*override*/; + virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) /*override*/; protected: cChestEntity * m_TopChest; @@ -415,8 +415,8 @@ class cSlotAreaEnderChest : public: cSlotAreaEnderChest(cEnderChestEntity * a_EnderChest, cWindow & a_ParentWindow); - virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const override; - virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; + virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const /*override*/; + virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) /*override*/; protected: cEnderChestEntity * m_EnderChest; @@ -437,16 +437,16 @@ public: virtual ~cSlotAreaFurnace(); - virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override; - virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) override; - virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const override; - virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override; + virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) /*override*/; + virtual void DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) /*override*/; + virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) const /*override*/; + virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) /*override*/; protected: cFurnaceEntity * m_Furnace; - // cItemGrid::cListener overrides: - virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override; + // cItemGrid::cListener /*override*/s: + virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) /*override*/; /// Called after an item has been smelted to handle statistics e.t.c. void HandleSmeltItem(const cItem & a_Result, cPlayer & a_Player); diff --git a/src/UI/Window.h b/src/UI/Window.h index 3d860407f..4546fb9ad 100644 --- a/src/UI/Window.h +++ b/src/UI/Window.h @@ -269,7 +269,7 @@ public: cBeaconEntity * GetBeaconEntity(void) const { return m_Beacon; } // cWindow Overrides: - virtual void OpenedByPlayer(cPlayer & a_Player) override; + virtual void OpenedByPlayer(cPlayer & a_Player) /*override*/; protected: cBeaconEntity * m_Beacon; @@ -285,8 +285,8 @@ class cEnchantingWindow : typedef cWindow super; public: cEnchantingWindow(int a_BlockX, int a_BlockY, int a_BlockZ); - virtual void SetProperty(int a_Property, int a_Value, cPlayer & a_Player) override; - virtual void SetProperty(int a_Property, int a_Value) override; + virtual void SetProperty(int a_Property, int a_Value, cPlayer & a_Player) /*override*/; + virtual void SetProperty(int a_Property, int a_Value) /*override*/; /** Return the Value of a Property */ int GetPropertyValue(int a_Property); @@ -346,8 +346,8 @@ public: cChestWindow(cChestEntity * a_PrimaryChest, cChestEntity * a_SecondaryChest); ~cChestWindow(); - virtual bool ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse) override; - virtual void OpenedByPlayer(cPlayer & a_Player) override; + virtual bool ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse) /*override*/; + virtual void OpenedByPlayer(cPlayer & a_Player) /*override*/; protected: cWorld * m_World; diff --git a/src/UI/WindowOwner.h b/src/UI/WindowOwner.h index 7a7941e37..5b41e9908 100644 --- a/src/UI/WindowOwner.h +++ b/src/UI/WindowOwner.h @@ -81,7 +81,7 @@ public: m_BlockEntity = a_BlockEntity; } - virtual void GetBlockPos(int & a_BlockX, int & a_BlockY, int & a_BlockZ) override + virtual void GetBlockPos(int & a_BlockX, int & a_BlockY, int & a_BlockZ) /*override*/ { a_BlockX = m_BlockEntity->GetPosX(); a_BlockY = m_BlockEntity->GetPosY(); @@ -113,7 +113,7 @@ public: m_Entity = a_Entity; } - virtual void GetBlockPos(int & a_BlockX, int & a_BlockY, int & a_BlockZ) override + virtual void GetBlockPos(int & a_BlockX, int & a_BlockY, int & a_BlockZ) /*override*/ { a_BlockX = (int)floor(m_Entity->GetPosX() + 0.5); a_BlockY = (int)floor(m_Entity->GetPosY() + 0.5); diff --git a/src/VoronoiMap.cpp b/src/VoronoiMap.cpp index 5efd09c01..3938e77ea 100644 --- a/src/VoronoiMap.cpp +++ b/src/VoronoiMap.cpp @@ -66,7 +66,7 @@ int cVoronoiMap::GetValueAt(int a_X, int a_Y, int & a_MinDist1, int & a_MinDist2 // Get 5x5 neighboring cell seeds, compare distance to each. Return the value in the minumim-distance cell int MinDist = m_CellSize * m_CellSize * 16; // There has to be a cell closer than this int MinDist2 = MinDist; - int res = 0; // Will be overriden + int res = 0; // Will be /*override*/n for (int x = 0; x < 5; x++) { for (int z = 0; z < 5; z++) diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp index 23eedbd14..00ac040b5 100644 --- a/src/WebAdmin.cpp +++ b/src/WebAdmin.cpp @@ -23,7 +23,7 @@ class cPlayerAccum : public cPlayerListCallback { - virtual bool Item(cPlayer * a_Player) override + virtual bool Item(cPlayer * a_Player) /*override*/ { m_Contents.append("<li>"); m_Contents.append(a_Player->GetName()); diff --git a/src/WebAdmin.h b/src/WebAdmin.h index aefc1d145..33b924c4b 100644 --- a/src/WebAdmin.h +++ b/src/WebAdmin.h @@ -171,20 +171,20 @@ protected: { } - // cRequestData overrides: - virtual void OnBody(const char * a_Data, size_t a_Size) override; + // cRequestData /*override*/s: + virtual void OnBody(const char * a_Data, size_t a_Size) /*override*/; - // cHTTPFormParser::cCallbacks overrides. Files are ignored: - virtual void OnFileStart(cHTTPFormParser &, const AString & a_FileName) override + // cHTTPFormParser::cCallbacks /*override*/s. Files are ignored: + virtual void OnFileStart(cHTTPFormParser &, const AString & a_FileName) /*override*/ { UNUSED(a_FileName); } - virtual void OnFileData(cHTTPFormParser &, const char * a_Data, size_t a_Size) override + virtual void OnFileData(cHTTPFormParser &, const char * a_Data, size_t a_Size) /*override*/ { UNUSED(a_Data); UNUSED(a_Size); } - virtual void OnFileEnd(cHTTPFormParser &) override {} + virtual void OnFileEnd(cHTTPFormParser &) /*override*/ {} } ; @@ -214,10 +214,10 @@ protected: /** Handles requests for the root page */ void HandleRootRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request); - // cHTTPServer::cCallbacks overrides: - virtual void OnRequestBegun (cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override; - virtual void OnRequestBody (cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, size_t a_Size) override; - virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override; + // cHTTPServer::cCallbacks /*override*/s: + virtual void OnRequestBegun (cHTTPConnection & a_Connection, cHTTPRequest & a_Request) /*override*/; + virtual void OnRequestBody (cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, size_t a_Size) /*override*/; + virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) /*override*/; } ; // tolua_export diff --git a/src/World.cpp b/src/World.cpp index 2a3336dee..50bc6224d 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -98,7 +98,7 @@ protected: cWorld * m_World; - virtual void Execute(void) override + virtual void Execute(void) /*override*/ { for (;;) { @@ -150,7 +150,7 @@ protected: cLightingThread * m_Lighting; - virtual void Execute(void) override + virtual void Execute(void) /*override*/ { for (;;) { @@ -489,7 +489,7 @@ void cWorld::InitializeSpawn(void) class cTracerCallbacks : public cBlockTracer::cCallbacks { - virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override + virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) /*override*/ { LOGD("Block {%d, %d, %d}: %d:%d (%s)", a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, @@ -498,7 +498,7 @@ void cWorld::InitializeSpawn(void) return false; } - virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/ { LOGD("Block {%d, %d, %d}: no data available", a_BlockX, a_BlockY, a_BlockZ @@ -506,19 +506,19 @@ void cWorld::InitializeSpawn(void) return false; } - virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override + virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) /*override*/ { LOGD("Out of world at {%f, %f, %f}", a_BlockX, a_BlockY, a_BlockZ); return false; } - virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override + virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) /*override*/ { LOGD("Into world at {%f, %f, %f}", a_BlockX, a_BlockY, a_BlockZ); return false; } - virtual void OnNoMoreHits(void) override + virtual void OnNoMoreHits(void) /*override*/ { LOGD("No more hits"); } @@ -559,7 +559,7 @@ void cWorld::Start(void) IniFile.AddKeyComment(" LinkedWorlds", "This section governs portal world linkage; leave a value blank to disabled that associated method of teleportation"); } - // The presence of a configuration value overrides everything + // The presence of a configuration value /*override*/s everything // If no configuration value is found, GetDimension() is written to file and the variable is written to again to ensure that cosmic rays haven't sneakily changed its value m_Dimension = StringToDimension(IniFile.GetValueSet("General", "Dimension", DimensionToString(GetDimension()))); @@ -2853,7 +2853,7 @@ bool cWorld::SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, co public: cUpdateCommandBlock(const AString & a_Command) : m_Command(a_Command) {} - virtual bool Item(cCommandBlockEntity * a_CommandBlock) override + virtual bool Item(cCommandBlockEntity * a_CommandBlock) /*override*/ { a_CommandBlock->SetCommand(m_Command); return false; diff --git a/src/World.h b/src/World.h index 49932ac9d..b9191caef 100644 --- a/src/World.h +++ b/src/World.h @@ -109,8 +109,8 @@ public: public cTask { protected: - // cTask overrides: - virtual void Run(cWorld & a_World) override; + // cTask /*override*/s: + virtual void Run(cWorld & a_World) /*override*/; } ; @@ -118,8 +118,8 @@ public: public cTask { protected: - // cTask overrides: - virtual void Run(cWorld & a_World) override; + // cTask /*override*/s: + virtual void Run(cWorld & a_World) /*override*/; }; @@ -130,8 +130,8 @@ public: cTaskSendBlockToAllPlayers(std::vector<Vector3i> & a_SendQueue); protected: - // cTask overrides: - virtual void Run(cWorld & a_World) override; + // cTask /*override*/s: + virtual void Run(cWorld & a_World) /*override*/; std::vector<Vector3i> m_SendQueue; }; @@ -156,15 +156,15 @@ public: BroadcastTimeUpdate(); } - virtual Int64 GetWorldAge (void) const override { return m_WorldAge; } - virtual Int64 GetTimeOfDay(void) const override { return m_TimeOfDay; } + virtual Int64 GetWorldAge (void) const /*override*/ { return m_WorldAge; } + virtual Int64 GetTimeOfDay(void) const /*override*/ { return m_TimeOfDay; } void SetTicksUntilWeatherChange(int a_WeatherInterval) { m_WeatherInterval = a_WeatherInterval; } - virtual void SetTimeOfDay(Int64 a_TimeOfDay) override + virtual void SetTimeOfDay(Int64 a_TimeOfDay) /*override*/ { m_TimeOfDay = a_TimeOfDay; m_TimeOfDaySecs = (double)a_TimeOfDay / 20.0; @@ -235,7 +235,7 @@ public: void BroadcastEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL); void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL); void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); - virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) override; // tolua_export + virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) /*override*/; // tolua_export void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL); // tolua_export void BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude = NULL); void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = NULL); @@ -248,10 +248,10 @@ public: void BroadcastTeleportEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); void BroadcastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL); void BroadcastTimeUpdate (const cClientHandle * a_Exclude = NULL); - virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) override; + virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; void BroadcastWeather (eWeather a_Weather, const cClientHandle * a_Exclude = NULL); - virtual cBroadcastInterface & GetBroadcastManager(void) override + virtual cBroadcastInterface & GetBroadcastManager(void) /*override*/ { return *this; } @@ -299,7 +299,7 @@ public: void RemovePlayer(cPlayer * a_Player, bool a_RemoveFromChunk); /** Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true */ - virtual bool ForEachPlayer(cPlayerListCallback & a_Callback) override; // >> EXPORTED IN MANUALBINDINGS << + virtual bool ForEachPlayer(cPlayerListCallback & a_Callback) /*override*/; // >> EXPORTED IN MANUALBINDINGS << /** Calls the callback for the player of the given name; returns true if the player was found and the callback called, false if player not found. Callback return ignored */ bool DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS << @@ -394,7 +394,7 @@ public: bool IsChunkLighted(int a_ChunkX, int a_ChunkZ); /** Calls the callback for each chunk in the coords specified (all cords are inclusive). Returns true if all chunks have been processed successfully */ - virtual bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) override; + virtual bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) /*override*/; // tolua_begin @@ -453,15 +453,15 @@ public: Prefer cBlockArea::Write() instead, this is the internal implementation; cBlockArea does error checking, too. a_DataTypes is a bitmask of cBlockArea::baXXX constants ORed together. */ - virtual bool WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) override; + virtual bool WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) /*override*/; // tolua_begin /** Spawns item pickups for each item in the list. May compress pickups if too many entities: */ - virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed = 1.0, bool IsPlayerCreated = false) override; + virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed = 1.0, bool IsPlayerCreated = false) /*override*/; /** Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified: */ - virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated = false) override; + virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated = false) /*override*/; /** Spawns an falling block entity at the given position. It returns the UniqueID of the spawned falling block. */ int SpawnFallingBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE BlockType, NIBBLETYPE BlockMeta); @@ -485,14 +485,14 @@ public: // tolua_begin bool DigBlock (int a_X, int a_Y, int a_Z); - virtual void SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) override; + virtual void SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) /*override*/; double GetSpawnX(void) const { return m_SpawnX; } double GetSpawnY(void) const { return m_SpawnY; } double GetSpawnZ(void) const { return m_SpawnZ; } /** Wakes up the simulators for the specified block */ - virtual void WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) override; + virtual void WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) /*override*/; /** Wakes up the simulators for the specified area of blocks */ void WakeUpSimulatorsInArea(int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ); @@ -536,10 +536,10 @@ public: | esWitherBirth | cMonster * | | esPlugin | void * | */ - virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) override; // tolua_export + virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) /*override*/; // tolua_export /** Calls the callback for the block entity at the specified coords; returns false if there's no block entity at those coords, true if found */ - virtual bool DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) override; // Exported in ManualBindings.cpp + virtual bool DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) /*override*/; // Exported in ManualBindings.cpp /** Calls the callback for the beacon at the specified coords; returns false if there's no beacon at those coords, true if found */ bool DoWithBeaconAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBeaconCallback & a_Callback); // Exported in ManualBindings.cpp @@ -768,7 +768,7 @@ public: bool IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export /** Spawns a mob of the specified type. Returns the mob's EntityID if recognized and spawned, <0 otherwise */ - virtual int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) override; // tolua_export + virtual int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) /*override*/; // tolua_export int SpawnMobFinalize(cMonster* a_Monster); /** Creates a projectile of the specified type. Returns the projectile's EntityID if successful, <0 otherwise @@ -806,8 +806,8 @@ private: protected: cWorld & m_World; - // cIsThread overrides: - virtual void Execute(void) override; + // cIsThread /*override*/s: + virtual void Execute(void) /*override*/; } ; @@ -818,14 +818,14 @@ private: { cWorld * m_World; - // cChunkSink overrides: - virtual void OnChunkGenerated (cChunkDesc & a_ChunkDesc) override; - virtual bool IsChunkValid (int a_ChunkX, int a_ChunkZ) override; - virtual bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) override; + // cChunkSink /*override*/s: + virtual void OnChunkGenerated (cChunkDesc & a_ChunkDesc) /*override*/; + virtual bool IsChunkValid (int a_ChunkX, int a_ChunkZ) /*override*/; + virtual bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) /*override*/; - // cPluginInterface overrides: - virtual void CallHookChunkGenerating(cChunkDesc & a_ChunkDesc) override; - virtual void CallHookChunkGenerated (cChunkDesc & a_ChunkDesc) override; + // cPluginInterface /*override*/s: + virtual void CallHookChunkGenerating(cChunkDesc & a_ChunkDesc) /*override*/; + virtual void CallHookChunkGenerated (cChunkDesc & a_ChunkDesc) /*override*/; public: cChunkGeneratorCallbacks(cWorld & a_World); diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp index c6294b99c..dff611970 100644 --- a/src/WorldStorage/FastNBT.cpp +++ b/src/WorldStorage/FastNBT.cpp @@ -11,7 +11,7 @@ // The number of NBT tags that are reserved when an NBT parsing is started. -// You can override this by using a cmdline define +// You can /*override*/ this by using a cmdline define #ifndef NBT_RESERVE_SIZE #define NBT_RESERVE_SIZE 200 #endif // NBT_RESERVE_SIZE diff --git a/src/WorldStorage/NBTChunkSerializer.h b/src/WorldStorage/NBTChunkSerializer.h index 4c229a65c..cd47bb72d 100644 --- a/src/WorldStorage/NBTChunkSerializer.h +++ b/src/WorldStorage/NBTChunkSerializer.h @@ -123,11 +123,11 @@ protected: void AddMinecartChestContents(cMinecartWithChest * a_Minecart); - // cChunkDataSeparateCollector overrides: - virtual void LightIsValid(bool a_IsLightValid) override; - virtual void BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) override; - virtual void Entity(cEntity * a_Entity) override; - virtual void BlockEntity(cBlockEntity * a_Entity) override; + // cChunkDataSeparateCollector /*override*/s: + virtual void LightIsValid(bool a_IsLightValid) /*override*/; + virtual void BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) /*override*/; + virtual void Entity(cEntity * a_Entity) /*override*/; + virtual void BlockEntity(cBlockEntity * a_Entity) /*override*/; } ; // class cNBTChunkSerializer diff --git a/src/WorldStorage/WSSAnvil.h b/src/WorldStorage/WSSAnvil.h index 591ec6757..a1f9b293b 100644 --- a/src/WorldStorage/WSSAnvil.h +++ b/src/WorldStorage/WSSAnvil.h @@ -236,10 +236,10 @@ protected: /// Copies a_Length bytes of data from the specified NBT Tag's Child into the a_Destination buffer void CopyNBTData(const cParsedNBT & a_NBT, int a_Tag, const AString & a_ChildName, char * a_Destination, size_t a_Length); - // cWSSchema overrides: - virtual bool LoadChunk(const cChunkCoords & a_Chunk) override; - virtual bool SaveChunk(const cChunkCoords & a_Chunk) override; - virtual const AString GetName(void) const override {return "anvil"; } + // cWSSchema /*override*/s: + virtual bool LoadChunk(const cChunkCoords & a_Chunk) /*override*/; + virtual bool SaveChunk(const cChunkCoords & a_Chunk) /*override*/; + virtual const AString GetName(void) const /*override*/ {return "anvil"; } } ; diff --git a/src/WorldStorage/WSSCompact.h b/src/WorldStorage/WSSCompact.h index 83e9cb49f..88910fa96 100644 --- a/src/WorldStorage/WSSCompact.h +++ b/src/WorldStorage/WSSCompact.h @@ -40,10 +40,10 @@ protected: Json::Value m_Root; bool m_HasJsonData; - // cChunkDataCollector overrides: - virtual void Entity (cEntity * a_Entity) override; - virtual void BlockEntity (cBlockEntity * a_Entity) override; - virtual void LightIsValid (bool a_IsLightValid) override; + // cChunkDataCollector /*override*/s: + virtual void Entity (cEntity * a_Entity) /*override*/; + virtual void BlockEntity (cBlockEntity * a_Entity) /*override*/; + virtual void LightIsValid (bool a_IsLightValid) /*override*/; } ; @@ -140,10 +140,10 @@ protected: void LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities, cWorld * a_World); - // cWSSchema overrides: - virtual bool LoadChunk(const cChunkCoords & a_Chunk) override; - virtual bool SaveChunk(const cChunkCoords & a_Chunk) override; - virtual const AString GetName(void) const override {return "compact"; } + // cWSSchema /*override*/s: + virtual bool LoadChunk(const cChunkCoords & a_Chunk) /*override*/; + virtual bool SaveChunk(const cChunkCoords & a_Chunk) /*override*/; + virtual const AString GetName(void) const /*override*/ {return "compact"; } } ; diff --git a/src/WorldStorage/WorldStorage.cpp b/src/WorldStorage/WorldStorage.cpp index 667a28470..c35bbbad0 100644 --- a/src/WorldStorage/WorldStorage.cpp +++ b/src/WorldStorage/WorldStorage.cpp @@ -25,10 +25,10 @@ public: cWSSForgetful(cWorld * a_World) : cWSSchema(a_World) {} protected: - // cWSSchema overrides: - virtual bool LoadChunk(const cChunkCoords & a_Chunk) override {return false; } - virtual bool SaveChunk(const cChunkCoords & a_Chunk) override {return true; } - virtual const AString GetName(void) const override {return "forgetful"; } + // cWSSchema /*override*/s: + virtual bool LoadChunk(const cChunkCoords & a_Chunk) /*override*/ {return false; } + virtual bool SaveChunk(const cChunkCoords & a_Chunk) /*override*/ {return true; } + virtual const AString GetName(void) const /*override*/ {return "forgetful"; } } ; diff --git a/src/WorldStorage/WorldStorage.h b/src/WorldStorage/WorldStorage.h index 5f89ead53..21f5ca25d 100644 --- a/src/WorldStorage/WorldStorage.h +++ b/src/WorldStorage/WorldStorage.h @@ -126,7 +126,7 @@ protected: void InitSchemas(int a_StorageCompressionFactor); - virtual void Execute(void) override; + virtual void Execute(void) /*override*/; cEvent m_Event; // Set when there's any addition to the queues diff --git a/src/XMLParser.h b/src/XMLParser.h index e39405529..6e4ce2243 100644 --- a/src/XMLParser.h +++ b/src/XMLParser.h @@ -3,7 +3,7 @@ // Interfaces to the CXMLParser class representing the base class for XML parsing -// To use, derive a class from this base and override its OnStartElement(), OnEndElement() and OnCharacters() functions +// To use, derive a class from this base and /*override*/ its OnStartElement(), OnEndElement() and OnCharacters() functions |