summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2018-05-02 09:50:36 +0200
committerGitHub <noreply@github.com>2018-05-02 09:50:36 +0200
commita4dbb5c58270959884c17d720185da06464fa256 (patch)
tree2b4e81410e90e059f51726e6c9a01c03fcbfb98d
parenttolua++ bindings use nullptr. (#4219) (diff)
downloadcuberite-a4dbb5c58270959884c17d720185da06464fa256.tar
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.gz
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.bz2
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.lz
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.xz
cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.zst
cuberite-a4dbb5c58270959884c17d720185da06464fa256.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/BindingsProcessor.lua4
-rw-r--r--src/Bindings/LuaState.cpp6
-rw-r--r--src/Bindings/ManualBindings.cpp52
-rw-r--r--src/Bindings/ManualBindings_Network.cpp4
-rw-r--r--src/Bindings/ManualBindings_World.cpp2
-rw-r--r--src/Bindings/PluginLua.cpp28
-rw-r--r--src/BlockEntities/BeaconEntity.cpp2
-rw-r--r--src/BlockEntities/BedEntity.cpp2
-rw-r--r--src/BlockEntities/BlockEntityWithItems.cpp2
-rw-r--r--src/BlockEntities/BrewingstandEntity.cpp2
-rw-r--r--src/BlockEntities/ChestEntity.cpp2
-rw-r--r--src/BlockEntities/CommandBlockEntity.cpp2
-rw-r--r--src/BlockEntities/DropSpenserEntity.cpp2
-rw-r--r--src/BlockEntities/FlowerPotEntity.cpp2
-rw-r--r--src/BlockEntities/FurnaceEntity.cpp2
-rw-r--r--src/BlockEntities/HopperEntity.cpp2
-rw-r--r--src/BlockEntities/JukeboxEntity.cpp2
-rw-r--r--src/BlockEntities/MobHeadEntity.cpp2
-rw-r--r--src/BlockEntities/MobSpawnerEntity.cpp2
-rw-r--r--src/BlockEntities/NoteEntity.cpp2
-rw-r--r--src/BlockEntities/SignEntity.cpp2
-rw-r--r--src/ByteBuffer.cpp6
-rw-r--r--src/Chunk.cpp6
-rw-r--r--src/ClientHandle.cpp6
-rw-r--r--src/Entities/Entity.cpp26
-rw-r--r--src/Entities/EntityEffect.cpp20
-rw-r--r--src/Entities/Player.cpp8
-rw-r--r--src/Generating/PrefabPiecePool.cpp4
-rw-r--r--src/HTTP/HTTPServer.cpp2
-rw-r--r--src/HTTP/SslHTTPServerConnection.cpp2
-rw-r--r--src/Mobs/Creeper.cpp2
-rw-r--r--src/OSSupport/File.cpp2
-rw-r--r--src/OSSupport/NetworkSingleton.cpp2
-rw-r--r--src/OSSupport/ServerHandleImpl.cpp2
-rw-r--r--src/Protocol/Protocol_1_10.cpp74
-rw-r--r--src/Protocol/Protocol_1_11.cpp76
-rw-r--r--src/Protocol/Protocol_1_12.cpp64
-rw-r--r--src/Protocol/Protocol_1_8.cpp72
-rw-r--r--src/Protocol/Protocol_1_9.cpp78
-rw-r--r--src/StringUtils.cpp2
-rw-r--r--src/UI/SlotArea.cpp6
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp98
-rw-r--r--src/mbedTLS++/BlockingSslClientSocket.cpp2
-rw-r--r--src/mbedTLS++/CryptoKey.cpp4
-rw-r--r--src/mbedTLS++/CtrDrbgContext.cpp2
-rw-r--r--src/mbedTLS++/SslContext.cpp4
-rw-r--r--src/mbedTLS++/SslContext.h4
-rw-r--r--src/mbedTLS++/X509Cert.cpp2
48 files changed, 351 insertions, 351 deletions
diff --git a/src/Bindings/BindingsProcessor.lua b/src/Bindings/BindingsProcessor.lua
index d6c39dec6..db3735338 100644
--- a/src/Bindings/BindingsProcessor.lua
+++ b/src/Bindings/BindingsProcessor.lua
@@ -245,7 +245,7 @@ local function OutputLuaStateHelpers(a_Package)
f:write("\ttolua_Error err;\n")
f:write("\tif (tolua_isusertype(m_LuaState, a_StackPos, \"" .. item.name .. "\", false, &err))\n")
f:write("\t{\n")
- f:write("\t\ta_ReturnedVal = *(reinterpret_cast<" .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
+ f:write("\t\ta_ReturnedVal = *(static_cast<" .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
f:write("\t\treturn true;\n");
f:write("\t}\n")
f:write("\treturn false;\n")
@@ -258,7 +258,7 @@ local function OutputLuaStateHelpers(a_Package)
f:write("\ttolua_Error err;\n")
f:write("\tif (tolua_isusertype(m_LuaState, a_StackPos, \"const " .. item.name .. "\", false, &err))\n")
f:write("\t{\n")
- f:write("\t\ta_ReturnedVal = *(reinterpret_cast<const " .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
+ f:write("\t\ta_ReturnedVal = *(static_cast<const " .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
f:write("\t\treturn true;\n");
f:write("\t}\n")
f:write("\treturn false;\n")
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 6b620a1f1..0a7579ed8 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -305,7 +305,7 @@ void cLuaState::cTrackedRef::Invalidate(void)
if (!m_Ref.IsValid())
{
LOGD("%s: Inconsistent callback at %p, has a CS but an invalid Ref. This should not happen",
- __FUNCTION__, reinterpret_cast<void *>(this)
+ __FUNCTION__, static_cast<void *>(this)
);
return;
}
@@ -2391,7 +2391,7 @@ void cLuaState::TrackRef(cTrackedRef & a_Ref)
auto canonState = QueryCanonLuaState();
if (canonState == nullptr)
{
- LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, reinterpret_cast<void *>(m_LuaState));
+ LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, static_cast<void *>(m_LuaState));
return;
}
@@ -2410,7 +2410,7 @@ void cLuaState::UntrackRef(cTrackedRef & a_Ref)
auto canonState = QueryCanonLuaState();
if (canonState == nullptr)
{
- LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, reinterpret_cast<void *>(m_LuaState));
+ LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, static_cast<void *>(m_LuaState));
return;
}
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index fbb49d127..519023fa6 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -372,7 +372,7 @@ static AString GetLogMessage(lua_State * tolua_S)
tolua_Error err;
if (tolua_isusertype(tolua_S, 1, "cCompositeChat", false, &err))
{
- return reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr))->ExtractText();
+ return static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr))->ExtractText();
}
else
{
@@ -405,7 +405,7 @@ static int tolua_LOG(lua_State * tolua_S)
tolua_Error err;
if (tolua_isusertype(tolua_S, 1, "cCompositeChat", false, &err))
{
- LogLevel = cCompositeChat::MessageTypeToLogLevel(reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr))->GetMessageType());
+ LogLevel = cCompositeChat::MessageTypeToLogLevel(static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr))->GetMessageType());
}
// Log the message:
@@ -525,7 +525,7 @@ cPluginLua * cManualBindings::GetLuaPlugin(lua_State * L)
lua_pop(L, 1);
return nullptr;
}
- cPluginLua * Plugin = reinterpret_cast<cPluginLua *>(const_cast<void*>(lua_topointer(L, -1)));
+ cPluginLua * Plugin = static_cast<cPluginLua *>(const_cast<void*>(lua_topointer(L, -1)));
lua_pop(L, 1);
return Plugin;
@@ -1088,7 +1088,7 @@ static int tolua_cPluginManager_AddHook_DefFn(cPluginManager * a_PluginManager,
// The arg types have already been checked
// Retrieve and check the cPlugin parameter
- cPluginLua * Plugin = reinterpret_cast<cPluginLua *>(tolua_tousertype(S, a_ParamIdx, nullptr));
+ cPluginLua * Plugin = static_cast<cPluginLua *>(tolua_tousertype(S, a_ParamIdx, nullptr));
if (Plugin == nullptr)
{
LOGWARNING("cPluginManager.AddHook(): Invalid Plugin parameter, expected a valid cPlugin object. Hook not added");
@@ -1162,7 +1162,7 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
if (tolua_isusertype(S, 1, "cPluginManager", 0, &err))
{
// Style 2 or 3, retrieve the PlgMgr instance
- PlgMgr = reinterpret_cast<cPluginManager *>(tolua_tousertype(S, 1, nullptr));
+ PlgMgr = static_cast<cPluginManager *>(tolua_tousertype(S, 1, nullptr));
if (PlgMgr == nullptr)
{
LOGWARNING("Malformed plugin, use cPluginManager.AddHook(HOOK_TYPE, CallbackFunction). Fixing the call for you.");
@@ -1582,7 +1582,7 @@ static int tolua_cPlayer_GetPermissions(lua_State * tolua_S)
}
// Get the params:
- cPlayer * self = reinterpret_cast<cPlayer *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cPlayer * self = static_cast<cPlayer *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
@@ -1613,7 +1613,7 @@ static int tolua_cPlayer_GetRestrictions(lua_State * tolua_S)
}
// Get the params:
- cPlayer * self = reinterpret_cast<cPlayer *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cPlayer * self = static_cast<cPlayer *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
@@ -1970,14 +1970,14 @@ static int tolua_get_HTTPRequest_FormData(lua_State* a_LuaState)
return 0;
}
- const auto & FormData = self->FormData;
+ auto & FormData = self->FormData;
lua_newtable(a_LuaState);
int top = lua_gettop(a_LuaState);
- for (auto itr = FormData.cbegin(); itr != FormData.cend(); ++itr)
+ for (auto & Data : FormData)
{
- lua_pushstring(a_LuaState, itr->first.c_str());
- tolua_pushusertype(a_LuaState, const_cast<void *>(reinterpret_cast<const void *>(&(itr->second))), "HTTPFormData");
- // lua_pushlstring(a_LuaState, it->second.Value.c_str(), it->second.Value.size()); // Might contain binary data
+ lua_pushstring(a_LuaState, Data.first.c_str());
+ tolua_pushusertype(a_LuaState, &Data.second, "HTTPFormData");
+ // lua_pushlstring(a_LuaState, Data.second.Value.c_str(), Data.second.Value.size()); // Might contain binary data
lua_settable(a_LuaState, top);
}
@@ -2339,7 +2339,7 @@ static int tolua_cClientHandle_SendPluginMessage(lua_State * L)
{
return 0;
}
- cClientHandle * Client = reinterpret_cast<cClientHandle *>(tolua_tousertype(L, 1, nullptr));
+ cClientHandle * Client = static_cast<cClientHandle *>(tolua_tousertype(L, 1, nullptr));
if (Client == nullptr)
{
LOGWARNING("ClientHandle is nil in cClientHandle:SendPluginMessage()");
@@ -2789,7 +2789,7 @@ static int Lua_ItemGrid_GetSlotCoords(lua_State * L)
}
{
- const cItemGrid * self = reinterpret_cast<const cItemGrid *>(tolua_tousertype(L, 1, nullptr));
+ const cItemGrid * self = static_cast<const cItemGrid *>(tolua_tousertype(L, 1, nullptr));
int SlotNum = static_cast<int>(tolua_tonumber(L, 2, 0));
if (self == nullptr)
{
@@ -3442,7 +3442,7 @@ static int tolua_cScoreboard_GetTeamNames(lua_State * L)
}
// Get the groups:
- cScoreboard * Scoreboard = reinterpret_cast<cScoreboard *>(tolua_tousertype(L, 1, nullptr));
+ cScoreboard * Scoreboard = static_cast<cScoreboard *>(tolua_tousertype(L, 1, nullptr));
AStringVector Teams = Scoreboard->GetTeamNames();
// Push the results:
@@ -3468,7 +3468,7 @@ static int tolua_cHopperEntity_GetOutputBlockPos(lua_State * tolua_S)
{
return 0;
}
- cHopperEntity * self = reinterpret_cast<cHopperEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cHopperEntity * self = static_cast<cHopperEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cHopperEntity::GetOutputBlockPos()'", nullptr);
@@ -3688,7 +3688,7 @@ static int tolua_cCompositeChat_AddRunCommandPart(lua_State * tolua_S)
{
return 0;
}
- cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddRunCommandPart'", nullptr);
@@ -3725,7 +3725,7 @@ static int tolua_cCompositeChat_AddSuggestCommandPart(lua_State * tolua_S)
{
return 0;
}
- cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddSuggestCommandPart'", nullptr);
@@ -3762,7 +3762,7 @@ static int tolua_cCompositeChat_AddTextPart(lua_State * tolua_S)
{
return 0;
}
- cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddTextPart'", nullptr);
@@ -3798,7 +3798,7 @@ static int tolua_cCompositeChat_AddUrlPart(lua_State * tolua_S)
{
return 0;
}
- cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddUrlPart'", nullptr);
@@ -3835,7 +3835,7 @@ static int tolua_cCompositeChat_Clear(lua_State * tolua_S)
{
return 0;
}
- cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:ParseText'", nullptr);
@@ -3868,7 +3868,7 @@ static int tolua_cCompositeChat_ParseText(lua_State * tolua_S)
{
return 0;
}
- cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:ParseText'", nullptr);
@@ -3903,7 +3903,7 @@ static int tolua_cCompositeChat_SetMessageType(lua_State * tolua_S)
{
return 0;
}
- cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:SetMessageType'", nullptr);
@@ -3935,7 +3935,7 @@ static int tolua_cCompositeChat_UnderlineUrls(lua_State * tolua_S)
{
return 0;
}
- cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:UnderlineUrls'", nullptr);
@@ -4009,7 +4009,7 @@ static int tolua_cEntity_GetPosition(lua_State * tolua_S)
cLuaState L(tolua_S);
// Get the params:
- cEntity * self = reinterpret_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cEntity * self = static_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
@@ -4031,7 +4031,7 @@ static int tolua_cEntity_GetSpeed(lua_State * tolua_S)
cLuaState L(tolua_S);
// Get the params:
- cEntity * self = reinterpret_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cEntity * self = static_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
if (self == nullptr)
{
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
diff --git a/src/Bindings/ManualBindings_Network.cpp b/src/Bindings/ManualBindings_Network.cpp
index ff8f173a1..4a7dd2367 100644
--- a/src/Bindings/ManualBindings_Network.cpp
+++ b/src/Bindings/ManualBindings_Network.cpp
@@ -848,7 +848,7 @@ public:
virtual void OnBodyData(const void * a_Data, size_t a_Size) override
{
- m_Callbacks->CallTableFnWithSelf("OnBodyData", AString(reinterpret_cast<const char *>(a_Data), a_Size));
+ m_Callbacks->CallTableFnWithSelf("OnBodyData", AString(static_cast<const char *>(a_Data), a_Size));
}
@@ -907,7 +907,7 @@ public:
virtual void OnBodyData(const void * a_Data, size_t a_Size) override
{
- m_ResponseBody.append(reinterpret_cast<const char *>(a_Data), a_Size);
+ m_ResponseBody.append(static_cast<const char *>(a_Data), a_Size);
}
diff --git a/src/Bindings/ManualBindings_World.cpp b/src/Bindings/ManualBindings_World.cpp
index 3145da9e4..aada2ea47 100644
--- a/src/Bindings/ManualBindings_World.cpp
+++ b/src/Bindings/ManualBindings_World.cpp
@@ -275,7 +275,7 @@ static int tolua_cWorld_ForEachLoadedChunk(lua_State * tolua_S)
}
// Read the params:
- cWorld * World = reinterpret_cast<cWorld *>(tolua_tousertype(tolua_S, 1, nullptr));
+ cWorld * World = static_cast<cWorld *>(tolua_tousertype(tolua_S, 1, nullptr));
if (World == nullptr)
{
LOGWARNING("World:ForEachLoadedChunk(): invalid world parameter");
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 9105f2555..ba09b9752 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -414,15 +414,15 @@ bool cPluginLua::OnExploded(cWorld & a_World, double a_ExplosionSize, bool a_Can
{
switch (a_Source)
{
- case esBed: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<Vector3i *> (a_SourceData), cLuaState::Return, res); break;
- case esEnderCrystal: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cEntity *> (a_SourceData), cLuaState::Return, res); break;
- case esGhastFireball: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cGhastFireballEntity *>(a_SourceData), cLuaState::Return, res); break;
- case esMonster: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cMonster *> (a_SourceData), cLuaState::Return, res); break;
+ case esBed: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<Vector3i *> (a_SourceData), cLuaState::Return, res); break;
+ case esEnderCrystal: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cEntity *> (a_SourceData), cLuaState::Return, res); break;
+ case esGhastFireball: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cGhastFireballEntity *>(a_SourceData), cLuaState::Return, res); break;
+ case esMonster: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cMonster *> (a_SourceData), cLuaState::Return, res); break;
case esOther: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res); break;
case esPlugin: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res); break;
- case esPrimedTNT: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cTNTEntity *> (a_SourceData), cLuaState::Return, res); break;
- case esWitherBirth: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cMonster *> (a_SourceData), cLuaState::Return, res); break;
- case esWitherSkull: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cWitherSkullEntity *> (a_SourceData), cLuaState::Return, res); break;
+ case esPrimedTNT: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cTNTEntity *> (a_SourceData), cLuaState::Return, res); break;
+ case esWitherBirth: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cMonster *> (a_SourceData), cLuaState::Return, res); break;
+ case esWitherSkull: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cWitherSkullEntity *> (a_SourceData), cLuaState::Return, res); break;
case esMax:
{
ASSERT(!"Invalid explosion source");
@@ -454,15 +454,15 @@ bool cPluginLua::OnExploding(cWorld & a_World, double & a_ExplosionSize, bool &
{
switch (a_Source)
{
- case esBed: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<Vector3i *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
- case esEnderCrystal: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
- case esGhastFireball: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cGhastFireballEntity *>(a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
- case esMonster: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cMonster *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
+ case esBed: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<Vector3i *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
+ case esEnderCrystal: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
+ case esGhastFireball: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cGhastFireballEntity *>(a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
+ case esMonster: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cMonster *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
case esOther: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
case esPlugin: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
- case esPrimedTNT: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cTNTEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
- case esWitherBirth: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cMonster *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
- case esWitherSkull: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cWitherSkullEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
+ case esPrimedTNT: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cTNTEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
+ case esWitherBirth: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cMonster *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
+ case esWitherSkull: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cWitherSkullEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
case esMax:
{
ASSERT(!"Invalid explosion source");
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp
index 15f6744da..f1f7341b7 100644
--- a/src/BlockEntities/BeaconEntity.cpp
+++ b/src/BlockEntities/BeaconEntity.cpp
@@ -264,7 +264,7 @@ void cBeaconEntity::GiveEffects(void)
void cBeaconEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cBeaconEntity &>(a_Src);
+ auto & src = static_cast<const cBeaconEntity &>(a_Src);
m_BeaconLevel = src.m_BeaconLevel;
m_Contents.CopyFrom(src.m_Contents);
m_IsActive = src.m_IsActive;
diff --git a/src/BlockEntities/BedEntity.cpp b/src/BlockEntities/BedEntity.cpp
index c74448661..a9cb178b0 100644
--- a/src/BlockEntities/BedEntity.cpp
+++ b/src/BlockEntities/BedEntity.cpp
@@ -23,7 +23,7 @@ cBedEntity::cBedEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_Bloc
void cBedEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cBedEntity &>(a_Src);
+ auto & src = static_cast<const cBedEntity &>(a_Src);
m_Color = src.m_Color;
}
diff --git a/src/BlockEntities/BlockEntityWithItems.cpp b/src/BlockEntities/BlockEntityWithItems.cpp
index de223041d..01d217a16 100644
--- a/src/BlockEntities/BlockEntityWithItems.cpp
+++ b/src/BlockEntities/BlockEntityWithItems.cpp
@@ -48,7 +48,7 @@ void cBlockEntityWithItems::Destroy(void)
void cBlockEntityWithItems::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cBlockEntityWithItems &>(a_Src);
+ auto & src = static_cast<const cBlockEntityWithItems &>(a_Src);
m_Contents.CopyFrom(src.m_Contents);
}
diff --git a/src/BlockEntities/BrewingstandEntity.cpp b/src/BlockEntities/BrewingstandEntity.cpp
index 2c0f28c30..94fcdcbe6 100644
--- a/src/BlockEntities/BrewingstandEntity.cpp
+++ b/src/BlockEntities/BrewingstandEntity.cpp
@@ -59,7 +59,7 @@ void cBrewingstandEntity::Destroy()
void cBrewingstandEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cBrewingstandEntity &>(a_Src);
+ auto & src = static_cast<const cBrewingstandEntity &>(a_Src);
m_IsBrewing = src.m_IsBrewing;
for (size_t i = 0; i < ARRAYCOUNT(m_CurrentBrewingRecipes); ++i)
{
diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp
index 5e8b29a45..beffa84de 100644
--- a/src/BlockEntities/ChestEntity.cpp
+++ b/src/BlockEntities/ChestEntity.cpp
@@ -50,7 +50,7 @@ cChestEntity::~cChestEntity()
void cChestEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cChestEntity &>(a_Src);
+ auto & src = static_cast<const cChestEntity &>(a_Src);
m_Contents.CopyFrom(src.m_Contents);
// Reset the neighbor and player count, there's no sense in copying these:
diff --git a/src/BlockEntities/CommandBlockEntity.cpp b/src/BlockEntities/CommandBlockEntity.cpp
index d8f358028..6b9862a99 100644
--- a/src/BlockEntities/CommandBlockEntity.cpp
+++ b/src/BlockEntities/CommandBlockEntity.cpp
@@ -117,7 +117,7 @@ void cCommandBlockEntity::Activate(void)
void cCommandBlockEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cCommandBlockEntity &>(a_Src);
+ auto & src = static_cast<const cCommandBlockEntity &>(a_Src);
m_Command = src.m_Command;
m_LastOutput = src.m_LastOutput;
m_Result = src.m_Result;
diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp
index df825c995..80fba1864 100644
--- a/src/BlockEntities/DropSpenserEntity.cpp
+++ b/src/BlockEntities/DropSpenserEntity.cpp
@@ -116,7 +116,7 @@ void cDropSpenserEntity::Activate(void)
void cDropSpenserEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cDropSpenserEntity &>(a_Src);
+ auto & src = static_cast<const cDropSpenserEntity &>(a_Src);
m_Contents.CopyFrom(src.m_Contents);
m_ShouldDropSpense = src.m_ShouldDropSpense;
}
diff --git a/src/BlockEntities/FlowerPotEntity.cpp b/src/BlockEntities/FlowerPotEntity.cpp
index 486553c50..cb6c3419c 100644
--- a/src/BlockEntities/FlowerPotEntity.cpp
+++ b/src/BlockEntities/FlowerPotEntity.cpp
@@ -44,7 +44,7 @@ void cFlowerPotEntity::Destroy(void)
void cFlowerPotEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cFlowerPotEntity &>(a_Src);
+ auto & src = static_cast<const cFlowerPotEntity &>(a_Src);
m_Item = src.m_Item;
}
diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp
index 96a17782a..0813927f2 100644
--- a/src/BlockEntities/FurnaceEntity.cpp
+++ b/src/BlockEntities/FurnaceEntity.cpp
@@ -69,7 +69,7 @@ void cFurnaceEntity::Destroy()
void cFurnaceEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cFurnaceEntity &>(a_Src);
+ auto & src = static_cast<const cFurnaceEntity &>(a_Src);
m_Contents.CopyFrom(src.m_Contents);
m_CurrentRecipe = src.m_CurrentRecipe;
m_FuelBurnTime = src.m_FuelBurnTime;
diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp
index e6c2ad546..91340f35b 100644
--- a/src/BlockEntities/HopperEntity.cpp
+++ b/src/BlockEntities/HopperEntity.cpp
@@ -56,7 +56,7 @@ bool cHopperEntity::GetOutputBlockPos(NIBBLETYPE a_BlockMeta, int & a_OutputX, i
void cHopperEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cHopperEntity &>(a_Src);
+ auto & src = static_cast<const cHopperEntity &>(a_Src);
m_LastMoveItemsInTick = src.m_LastMoveItemsInTick;
m_LastMoveItemsOutTick = src.m_LastMoveItemsOutTick;
}
diff --git a/src/BlockEntities/JukeboxEntity.cpp b/src/BlockEntities/JukeboxEntity.cpp
index ef2069d72..9fbb99c0e 100644
--- a/src/BlockEntities/JukeboxEntity.cpp
+++ b/src/BlockEntities/JukeboxEntity.cpp
@@ -32,7 +32,7 @@ cJukeboxEntity::~cJukeboxEntity()
void cJukeboxEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cJukeboxEntity &>(a_Src);
+ auto & src = static_cast<const cJukeboxEntity &>(a_Src);
m_Record = src.m_Record;
}
diff --git a/src/BlockEntities/MobHeadEntity.cpp b/src/BlockEntities/MobHeadEntity.cpp
index 3a2ef9e72..5438bbb26 100644
--- a/src/BlockEntities/MobHeadEntity.cpp
+++ b/src/BlockEntities/MobHeadEntity.cpp
@@ -28,7 +28,7 @@ cMobHeadEntity::cMobHeadEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, in
void cMobHeadEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cMobHeadEntity &>(a_Src);
+ auto & src = static_cast<const cMobHeadEntity &>(a_Src);
m_OwnerName = src.m_OwnerName;
m_OwnerTexture = src.m_OwnerTexture;
m_OwnerTextureSignature = src.m_OwnerTextureSignature;
diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp
index a4e53d5d1..772fa8d79 100644
--- a/src/BlockEntities/MobSpawnerEntity.cpp
+++ b/src/BlockEntities/MobSpawnerEntity.cpp
@@ -29,7 +29,7 @@ cMobSpawnerEntity::cMobSpawnerEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMe
void cMobSpawnerEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cMobSpawnerEntity &>(a_Src);
+ auto & src = static_cast<const cMobSpawnerEntity &>(a_Src);
m_Entity = src.m_Entity;
m_IsActive = src.m_IsActive;
m_SpawnDelay = src.m_SpawnDelay;
diff --git a/src/BlockEntities/NoteEntity.cpp b/src/BlockEntities/NoteEntity.cpp
index ca8c2c03d..6fca0381a 100644
--- a/src/BlockEntities/NoteEntity.cpp
+++ b/src/BlockEntities/NoteEntity.cpp
@@ -23,7 +23,7 @@ cNoteEntity::cNoteEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_Bl
void cNoteEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cNoteEntity &>(a_Src);
+ auto & src = static_cast<const cNoteEntity &>(a_Src);
m_Pitch = src.m_Pitch;
}
diff --git a/src/BlockEntities/SignEntity.cpp b/src/BlockEntities/SignEntity.cpp
index 61f200ed5..f607e7bbd 100644
--- a/src/BlockEntities/SignEntity.cpp
+++ b/src/BlockEntities/SignEntity.cpp
@@ -26,7 +26,7 @@ cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_Bl
void cSignEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
- auto & src = reinterpret_cast<const cSignEntity &>(a_Src);
+ auto & src = static_cast<const cSignEntity &>(a_Src);
for (size_t i = 0; i < ARRAYCOUNT(m_Line); ++i)
{
m_Line[i] = src.m_Line[i];
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index 5b4cdb745..2fecc7817 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -126,7 +126,7 @@ bool cByteBuffer::Write(const void * a_Bytes, size_t a_Count)
}
ASSERT(m_BufferSize >= m_WritePos);
size_t TillEnd = m_BufferSize - m_WritePos;
- const char * Bytes = reinterpret_cast<const char *>(a_Bytes);
+ const char * Bytes = static_cast<const char *>(a_Bytes);
if (TillEnd <= a_Count)
{
// Need to wrap around the ringbuffer end
@@ -739,7 +739,7 @@ bool cByteBuffer::ReadBuf(void * a_Buffer, size_t a_Count)
CHECK_THREAD
CheckValid();
NEEDBYTES(a_Count);
- char * Dst = reinterpret_cast<char *>(a_Buffer); // So that we can do byte math
+ char * Dst = static_cast<char *>(a_Buffer); // So that we can do byte math
ASSERT(m_BufferSize >= m_ReadPos);
size_t BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
if (BytesToEndOfBuffer <= a_Count)
@@ -772,7 +772,7 @@ bool cByteBuffer::WriteBuf(const void * a_Buffer, size_t a_Count)
CHECK_THREAD
CheckValid();
PUTBYTES(a_Count);
- char * Src = reinterpret_cast<char *>(const_cast<void*>(a_Buffer)); // So that we can do byte math
+ const char * Src = static_cast<const char *>(a_Buffer); // So that we can do byte math
ASSERT(m_BufferSize >= m_ReadPos);
size_t BytesToEndOfBuffer = m_BufferSize - m_WritePos;
if (BytesToEndOfBuffer <= a_Count)
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index ff3ff7243..f43b5b4bb 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -539,7 +539,7 @@ void cChunk::CollectMobCensus(cMobCensus & toFill)
// LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
if (entity->IsMob())
{
- auto & Monster = reinterpret_cast<cMonster &>(*entity);
+ auto & Monster = static_cast<cMonster &>(*entity);
currentPosition = Monster.GetPosition();
for (const auto & PlayerPos : PlayerPositions)
{
@@ -1902,11 +1902,11 @@ void cChunk::CollectPickupsByPlayer(cPlayer & a_Player)
MarkDirty();
if (Entity->IsPickup())
{
- reinterpret_cast<cPickup *>(Entity.get())->CollectedBy(a_Player);
+ static_cast<cPickup &>(*Entity).CollectedBy(a_Player);
}
else
{
- reinterpret_cast<cProjectileEntity *>(Entity.get())->CollectedBy(a_Player);
+ static_cast<cProjectileEntity &>(*Entity).CollectedBy(a_Player);
}
}
else if (SqrDist < 5 * 5)
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 87ba9014e..a895dd3b3 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -782,7 +782,7 @@ void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment)
return;
}
- cEnchantingWindow * Window = reinterpret_cast<cEnchantingWindow *>(m_Player->GetWindow());
+ cEnchantingWindow * Window = static_cast<cEnchantingWindow *>(m_Player->GetWindow());
cItem Item = *Window->m_SlotArea->GetSlot(0, *m_Player); // Make a copy of the item
short BaseEnchantmentLevel = Window->GetPropertyValue(a_Enchantment);
@@ -959,7 +959,7 @@ void cClientHandle::HandleBeaconSelection(int a_PrimaryEffect, int a_SecondaryEf
{
return;
}
- cBeaconWindow * BeaconWindow = reinterpret_cast<cBeaconWindow *>(Window);
+ cBeaconWindow * BeaconWindow = static_cast<cBeaconWindow *>(Window);
if (Window->GetSlot(*m_Player, 0)->IsEmpty())
{
@@ -1044,7 +1044,7 @@ void cClientHandle::HandleAnvilItemName(const AString & a_ItemName)
if (a_ItemName.length() <= 30)
{
- reinterpret_cast<cAnvilWindow *>(m_Player->GetWindow())->SetRepairedItemName(a_ItemName, m_Player);
+ static_cast<cAnvilWindow *>(m_Player->GetWindow())->SetRepairedItemName(a_ItemName, m_Player);
}
}
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 73749d7a3..d1fdcfd39 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -410,7 +410,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
if ((a_TDI.Attacker != nullptr) && (a_TDI.Attacker->IsPlayer()))
{
- cPlayer * Player = reinterpret_cast<cPlayer *>(a_TDI.Attacker);
+ cPlayer * Player = static_cast<cPlayer *>(a_TDI.Attacker);
Player->GetEquippedItem().GetHandler()->OnEntityAttack(Player, this);
@@ -441,7 +441,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
{
if (IsMob())
{
- cMonster * Monster = reinterpret_cast<cMonster *>(this);
+ cMonster * Monster = static_cast<cMonster *>(this);
switch (Monster->GetMobType())
{
case mtSkeleton:
@@ -460,7 +460,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
{
if (IsMob())
{
- cMonster * Monster = reinterpret_cast<cMonster *>(this);
+ cMonster * Monster = static_cast<cMonster *>(this);
switch (Monster->GetMobType())
{
case mtSpider:
@@ -496,7 +496,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
}
else if (IsMob() && !IsInWater())
{
- cMonster * Monster = reinterpret_cast<cMonster *>(this);
+ cMonster * Monster = static_cast<cMonster *>(this);
switch (Monster->GetMobType())
{
case mtGhast:
@@ -871,7 +871,7 @@ void cEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
// Handle cactus damage or destruction:
if (
IsMob() || IsPickup() ||
- (IsPlayer() && !((reinterpret_cast<cPlayer *>(this))->IsGameModeCreative() || (reinterpret_cast<cPlayer *>(this))->IsGameModeSpectator()))
+ (IsPlayer() && !((static_cast<cPlayer *>(this))->IsGameModeCreative() || (static_cast<cPlayer *>(this))->IsGameModeSpectator()))
)
{
DetectCacti();
@@ -1362,7 +1362,7 @@ bool cEntity::DetectPortal()
return false;
}
- if (IsPlayer() && !(reinterpret_cast<cPlayer *>(this))->IsGameModeCreative() && (m_PortalCooldownData.m_TicksDelayed != 80))
+ if (IsPlayer() && !(static_cast<cPlayer *>(this))->IsGameModeCreative() && (m_PortalCooldownData.m_TicksDelayed != 80))
{
// Delay teleportation for four seconds if the entity is a non-creative player
m_PortalCooldownData.m_TicksDelayed++;
@@ -1385,7 +1385,7 @@ bool cEntity::DetectPortal()
if (IsPlayer())
{
// Send a respawn packet before world is loaded / generated so the client isn't left in limbo
- (reinterpret_cast<cPlayer *>(this))->GetClientHandle()->SendRespawn(DestionationDim);
+ (static_cast<cPlayer *>(this))->GetClientHandle()->SendRespawn(DestionationDim);
}
Vector3d TargetPos = GetPosition();
@@ -1414,10 +1414,10 @@ bool cEntity::DetectPortal()
{
if (DestionationDim == dimNether)
{
- reinterpret_cast<cPlayer *>(this)->AwardAchievement(achEnterPortal);
+ static_cast<cPlayer *>(this)->AwardAchievement(achEnterPortal);
}
- reinterpret_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(DestionationDim);
+ static_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(DestionationDim);
}
Vector3d TargetPos = GetPosition();
@@ -1454,7 +1454,7 @@ bool cEntity::DetectPortal()
if (IsPlayer())
{
- cPlayer * Player = reinterpret_cast<cPlayer *>(this);
+ cPlayer * Player = static_cast<cPlayer *>(this);
if (Player->GetBedWorld() == DestinationWorld)
{
Player->TeleportToCoords(Player->GetLastBedPos().x, Player->GetLastBedPos().y, Player->GetLastBedPos().z);
@@ -1487,9 +1487,9 @@ bool cEntity::DetectPortal()
{
if (DestionationDim == dimEnd)
{
- reinterpret_cast<cPlayer *>(this)->AwardAchievement(achEnterTheEnd);
+ static_cast<cPlayer *>(this)->AwardAchievement(achEnterTheEnd);
}
- reinterpret_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(DestionationDim);
+ static_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(DestionationDim);
}
cWorld * TargetWorld = cRoot::Get()->GetWorld(GetWorld()->GetLinkedEndWorldName());
@@ -1717,7 +1717,7 @@ void cEntity::HandleAir(void)
if (RespirationLevel > 0)
{
- reinterpret_cast<cPawn *>(this)->AddEntityEffect(cEntityEffect::effNightVision, 200, 5, 0);
+ static_cast<cPawn *>(this)->AddEntityEffect(cEntityEffect::effNightVision, 200, 5, 0);
}
if (m_AirLevel <= 0)
diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp
index 8f0ecc395..45a98c0d2 100644
--- a/src/Entities/EntityEffect.cpp
+++ b/src/Entities/EntityEffect.cpp
@@ -241,12 +241,12 @@ void cEntityEffectSpeed::OnActivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
- cMonster * Mob = reinterpret_cast<cMonster*>(&a_Target);
+ cMonster * Mob = static_cast<cMonster*>(&a_Target);
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() + 0.2 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
- cPlayer * Player = reinterpret_cast<cPlayer*>(&a_Target);
+ cPlayer * Player = static_cast<cPlayer*>(&a_Target);
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() + 0.2 * m_Intensity);
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() + 0.26 * m_Intensity);
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() + 0.2 * m_Intensity);
@@ -261,12 +261,12 @@ void cEntityEffectSpeed::OnDeactivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
- cMonster * Mob = reinterpret_cast<cMonster*>(&a_Target);
+ cMonster * Mob = static_cast<cMonster*>(&a_Target);
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() - 0.2 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
- cPlayer * Player = reinterpret_cast<cPlayer*>(&a_Target);
+ cPlayer * Player = static_cast<cPlayer*>(&a_Target);
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() - 0.2 * m_Intensity);
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() - 0.26 * m_Intensity);
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() - 0.2 * m_Intensity);
@@ -328,7 +328,7 @@ void cEntityEffectInstantHealth::OnActivate(cPawn & a_Target)
// Base amount = 6, doubles for every increase in intensity
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
- if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
+ if (a_Target.IsMob() && static_cast<cMonster &>(a_Target).IsUndead())
{
a_Target.TakeDamage(dtPotionOfHarming, nullptr, amount, 0); // TODO: Store attacker in a pointer-safe way, pass to TakeDamage
return;
@@ -348,7 +348,7 @@ void cEntityEffectInstantDamage::OnActivate(cPawn & a_Target)
// Base amount = 6, doubles for every increase in intensity
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
- if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
+ if (a_Target.IsMob() && static_cast<cMonster &>(a_Target).IsUndead())
{
a_Target.Heal(amount);
return;
@@ -367,7 +367,7 @@ void cEntityEffectRegeneration::OnTick(cPawn & a_Target)
{
super::OnTick(a_Target);
- if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
+ if (a_Target.IsMob() && static_cast<cMonster &>(a_Target).IsUndead())
{
return;
}
@@ -396,7 +396,7 @@ void cEntityEffectHunger::OnTick(cPawn & a_Target)
if (a_Target.IsPlayer())
{
- cPlayer & Target = reinterpret_cast<cPlayer &>(a_Target);
+ cPlayer & Target = static_cast<cPlayer &>(a_Target);
Target.AddFoodExhaustion(0.025 * (static_cast<double>(GetIntensity()) + 1.0)); // 0.5 per second = 0.025 per tick
}
}
@@ -448,7 +448,7 @@ void cEntityEffectPoison::OnTick(cPawn & a_Target)
if (a_Target.IsMob())
{
- cMonster & Target = reinterpret_cast<cMonster &>(a_Target);
+ cMonster & Target = static_cast<cMonster &>(a_Target);
// Doesn't effect undead mobs, spiders
if (
@@ -505,7 +505,7 @@ void cEntityEffectSaturation::OnTick(cPawn & a_Target)
{
if (a_Target.IsPlayer())
{
- cPlayer & Target = reinterpret_cast<cPlayer &>(a_Target);
+ cPlayer & Target = static_cast<cPlayer &>(a_Target);
Target.SetFoodSaturationLevel(Target.GetFoodSaturationLevel() + (1 + m_Intensity)); // Increase saturation 1 per tick, adds 1 for every increase in level
}
}
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index a58d45fb0..c674f4620 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -968,7 +968,7 @@ bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
if ((a_TDI.Attacker != nullptr) && (a_TDI.Attacker->IsPlayer()))
{
- cPlayer * Attacker = reinterpret_cast<cPlayer *>(a_TDI.Attacker);
+ cPlayer * Attacker = static_cast<cPlayer *>(a_TDI.Attacker);
if ((m_Team != nullptr) && (m_Team == Attacker->m_Team))
{
@@ -1098,7 +1098,7 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
}
else if (a_TDI.Attacker->IsPlayer())
{
- cPlayer * Killer = reinterpret_cast<cPlayer *>(a_TDI.Attacker);
+ cPlayer * Killer = static_cast<cPlayer *>(a_TDI.Attacker);
AString DeathMessage = Printf("%s was killed by %s", GetName().c_str(), Killer->GetName().c_str());
PluginManager->CallHookKilled(*this, a_TDI, DeathMessage);
if (DeathMessage != AString(""))
@@ -1139,7 +1139,7 @@ void cPlayer::Killed(cEntity * a_Victim)
}
else if (a_Victim->IsMob())
{
- if (reinterpret_cast<cMonster *>(a_Victim)->GetMobFamily() == cMonster::mfHostile)
+ if (static_cast<cMonster *>(a_Victim)->GetMobFamily() == cMonster::mfHostile)
{
AwardAchievement(achKillMonster);
}
@@ -2529,7 +2529,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos, bool a_PreviousIs
case cEntity::etBoat: m_Stats.AddValue(statDistBoat, Value); break;
case cEntity::etMonster:
{
- cMonster * Monster = reinterpret_cast<cMonster *>(m_AttachedTo);
+ cMonster * Monster = static_cast<cMonster *>(m_AttachedTo);
switch (Monster->GetMobType())
{
case mtPig: m_Stats.AddValue(statDistPig, Value); break;
diff --git a/src/Generating/PrefabPiecePool.cpp b/src/Generating/PrefabPiecePool.cpp
index 551b81376..fb8f252c0 100644
--- a/src/Generating/PrefabPiecePool.cpp
+++ b/src/Generating/PrefabPiecePool.cpp
@@ -771,7 +771,7 @@ cPieces cPrefabPiecePool::GetStartingPieces(void)
int cPrefabPiecePool::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece)
{
- return (reinterpret_cast<const cPrefab &>(a_NewPiece)).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
+ return (static_cast<const cPrefab &>(a_NewPiece)).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
}
@@ -780,7 +780,7 @@ int cPrefabPiecePool::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const c
int cPrefabPiecePool::GetStartingPieceWeight(const cPiece & a_NewPiece)
{
- return (reinterpret_cast<const cPrefab &>(a_NewPiece)).GetDefaultWeight();
+ return (static_cast<const cPrefab &>(a_NewPiece)).GetDefaultWeight();
}
diff --git a/src/HTTP/HTTPServer.cpp b/src/HTTP/HTTPServer.cpp
index aff2331a6..24f10ff16 100644
--- a/src/HTTP/HTTPServer.cpp
+++ b/src/HTTP/HTTPServer.cpp
@@ -216,7 +216,7 @@ void cHTTPServer::NewRequest(cHTTPServerConnection & a_Connection, cHTTPIncoming
void cHTTPServer::RequestBody(cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request, const void * a_Data, size_t a_Size)
{
- m_Callbacks->OnRequestBody(a_Connection, a_Request, reinterpret_cast<const char *>(a_Data), a_Size);
+ m_Callbacks->OnRequestBody(a_Connection, a_Request, static_cast<const char *>(a_Data), a_Size);
}
diff --git a/src/HTTP/SslHTTPServerConnection.cpp b/src/HTTP/SslHTTPServerConnection.cpp
index 20554708a..9c2993fbb 100644
--- a/src/HTTP/SslHTTPServerConnection.cpp
+++ b/src/HTTP/SslHTTPServerConnection.cpp
@@ -83,7 +83,7 @@ void cSslHTTPServerConnection::OnReceivedData(const char * a_Data, size_t a_Size
void cSslHTTPServerConnection::SendData(const void * a_Data, size_t a_Size)
{
- const char * OutgoingData = reinterpret_cast<const char *>(a_Data);
+ const char * OutgoingData = static_cast<const char *>(a_Data);
size_t pos = 0;
for (;;)
{
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp
index 560364b18..160523f3d 100644
--- a/src/Mobs/Creeper.cpp
+++ b/src/Mobs/Creeper.cpp
@@ -79,7 +79,7 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
if (
(a_Killer != nullptr) &&
a_Killer->IsProjectile() &&
- ((reinterpret_cast<cProjectileEntity *>(a_Killer))->GetCreatorUniqueID() != cEntity::INVALID_ID))
+ ((static_cast<cProjectileEntity *>(a_Killer))->GetCreatorUniqueID() != cEntity::INVALID_ID))
{
auto ProjectileCreatorCallback = [](cEntity & a_Entity)
{
diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp
index 8b91cc2a4..bb33dc732 100644
--- a/src/OSSupport/File.cpp
+++ b/src/OSSupport/File.cpp
@@ -285,7 +285,7 @@ int cFile::ReadRestOfFile(AString & a_Contents)
// HACK: This depends on the internal knowledge that AString's data() function returns the internal buffer directly
a_Contents.assign(DataSize, '\0');
- return Read(reinterpret_cast<void *>(const_cast<char *>(a_Contents.data())), DataSize);
+ return Read(static_cast<void *>(const_cast<char *>(a_Contents.data())), DataSize);
}
diff --git a/src/OSSupport/NetworkSingleton.cpp b/src/OSSupport/NetworkSingleton.cpp
index 2f7ed3802..f855acdc1 100644
--- a/src/OSSupport/NetworkSingleton.cpp
+++ b/src/OSSupport/NetworkSingleton.cpp
@@ -173,7 +173,7 @@ void cNetworkSingleton::RunEventLoop(cNetworkSingleton * a_Self)
void cNetworkSingleton::SignalizeStartup(evutil_socket_t a_Socket, short a_Events, void * a_Self)
{
- auto self = reinterpret_cast<cNetworkSingleton *>(a_Self);
+ auto self = static_cast<cNetworkSingleton *>(a_Self);
ASSERT(self != nullptr);
self->m_StartupEvent.Set();
}
diff --git a/src/OSSupport/ServerHandleImpl.cpp b/src/OSSupport/ServerHandleImpl.cpp
index d1443757a..562b2f902 100644
--- a/src/OSSupport/ServerHandleImpl.cpp
+++ b/src/OSSupport/ServerHandleImpl.cpp
@@ -284,7 +284,7 @@ bool cServerHandleImpl::Listen(UInt16 a_Port)
void cServerHandleImpl::Callback(evconnlistener * a_Listener, evutil_socket_t a_Socket, sockaddr * a_Addr, int a_Len, void * a_Self)
{
// Cast to true self:
- cServerHandleImpl * Self = reinterpret_cast<cServerHandleImpl *>(a_Self);
+ cServerHandleImpl * Self = static_cast<cServerHandleImpl *>(a_Self);
ASSERT(Self != nullptr);
ASSERT(Self->m_SelfPtr != nullptr);
diff --git a/src/Protocol/Protocol_1_10.cpp b/src/Protocol/Protocol_1_10.cpp
index a16ad3143..d260feca8 100644
--- a/src/Protocol/Protocol_1_10.cpp
+++ b/src/Protocol/Protocol_1_10.cpp
@@ -398,7 +398,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
{
case cEntity::etPlayer:
{
- auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
+ auto & Player = static_cast<const cPlayer &>(a_Entity);
// TODO Set player custom name to their name.
// Then it's possible to move the custom name of mobs to the entities
@@ -424,7 +424,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
{
a_Pkt.WriteBEUInt8(ITEM_ITEM);
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
+ WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
break;
}
case cEntity::etMinecart:
@@ -433,7 +433,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
// The following expression makes Minecarts shake more with less health or higher damage taken
- auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
+ auto & Minecart = static_cast<const cMinecart &>(a_Entity);
auto maxHealth = a_Entity.GetMaxHealth();
auto curHealth = a_Entity.GetHealth();
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
@@ -448,7 +448,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
if (Minecart.GetPayload() == cMinecart::mpNone)
{
- auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
+ auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
const cItem & MinecartContent = RideableMinecart.GetContent();
if (!MinecartContent.IsEmpty())
{
@@ -471,35 +471,35 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
{
a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
+ a_Pkt.WriteBool(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
}
break;
} // case etMinecart
case cEntity::etProjectile:
{
- auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
+ auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
switch (Projectile.GetProjectileKind())
{
case cProjectileEntity::pkArrow:
{
a_Pkt.WriteBEUInt8(ARROW_CRITICAL);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
- a_Pkt.WriteBEInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
+ a_Pkt.WriteBEInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
break;
}
case cProjectileEntity::pkFirework:
{
a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
+ WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
break;
}
case cProjectileEntity::pkSplashPotion:
{
a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cSplashPotionEntity &>(Projectile).GetItem());
+ WriteItem(a_Pkt, static_cast<const cSplashPotionEntity &>(Projectile).GetItem());
}
default:
{
@@ -511,13 +511,13 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
case cEntity::etMonster:
{
- WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
+ WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
break;
}
case cEntity::etBoat:
{
- auto & Boat = reinterpret_cast<const cBoat &>(a_Entity);
+ auto & Boat = static_cast<const cBoat &>(a_Entity);
a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
@@ -548,7 +548,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
case cEntity::etItemFrame:
{
- auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
+ auto & Frame = static_cast<const cItemFrame &>(a_Entity);
a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM);
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
WriteItem(a_Pkt, Frame.GetItem());
@@ -577,7 +577,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
{
case E_BLOCK_BEACON:
{
- auto & BeaconEntity = reinterpret_cast<const cBeaconEntity &>(a_BlockEntity);
+ auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity);
Writer.AddInt("x", BeaconEntity.GetPosX());
Writer.AddInt("y", BeaconEntity.GetPosY());
Writer.AddInt("z", BeaconEntity.GetPosZ());
@@ -590,7 +590,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
case E_BLOCK_COMMAND_BLOCK:
{
- auto & CommandBlockEntity = reinterpret_cast<const cCommandBlockEntity &>(a_BlockEntity);
+ auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity);
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
Writer.AddInt("x", CommandBlockEntity.GetPosX());
@@ -611,7 +611,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
case E_BLOCK_HEAD:
{
- auto & MobHeadEntity = reinterpret_cast<const cMobHeadEntity &>(a_BlockEntity);
+ auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity);
Writer.AddInt("x", MobHeadEntity.GetPosX());
Writer.AddInt("y", MobHeadEntity.GetPosY());
Writer.AddInt("z", MobHeadEntity.GetPosZ());
@@ -637,7 +637,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
case E_BLOCK_FLOWER_POT:
{
- auto & FlowerPotEntity = reinterpret_cast<const cFlowerPotEntity &>(a_BlockEntity);
+ auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity);
Writer.AddInt("x", FlowerPotEntity.GetPosX());
Writer.AddInt("y", FlowerPotEntity.GetPosY());
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
@@ -649,7 +649,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
case E_BLOCK_MOB_SPAWNER:
{
- auto & MobSpawnerEntity = reinterpret_cast<const cMobSpawnerEntity &>(a_BlockEntity);
+ auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity);
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
@@ -700,7 +700,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
{
case mtBat:
{
- auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
+ auto & Bat = static_cast<const cBat &>(a_Mob);
a_Pkt.WriteBEUInt8(BAT_HANGING);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
@@ -709,7 +709,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtChicken:
{
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+ auto & Chicken = static_cast<const cChicken &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -719,7 +719,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtCow:
{
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+ auto & Cow = static_cast<const cCow &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -729,7 +729,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtCreeper:
{
- auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
+ auto & Creeper = static_cast<const cCreeper &>(a_Mob);
a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing")
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1));
@@ -746,7 +746,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtEnderman:
{
- auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
+ auto & Enderman = static_cast<const cEnderman &>(a_Mob);
a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
UInt32 Carried = 0;
@@ -762,7 +762,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtGhast:
{
- auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
+ auto & Ghast = static_cast<const cGhast &>(a_Mob);
a_Pkt.WriteBEUInt8(GHAST_ATTACKING);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Ghast.IsCharging());
@@ -771,7 +771,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtHorse:
{
- auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
+ auto & Horse = static_cast<const cHorse &>(a_Mob);
Int8 Flags = 0;
if (Horse.IsTame())
{
@@ -824,7 +824,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtMagmaCube:
{
- auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
+ auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
a_Pkt.WriteBEUInt8(SLIME_SIZE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
@@ -833,7 +833,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtOcelot:
{
- auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
+ auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -843,7 +843,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtPig:
{
- auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
+ auto & Pig = static_cast<const cPig &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -858,7 +858,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtRabbit:
{
- auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Rabbit.IsBaby());
@@ -871,7 +871,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtSheep:
{
- auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
+ auto & Sheep = static_cast<const cSheep &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -891,7 +891,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtSkeleton:
{
- auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
+ auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
a_Pkt.WriteBEUInt8(SKELETON_TYPE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
@@ -900,7 +900,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtSlime:
{
- auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
+ auto & Slime = static_cast<const cSlime &>(a_Mob);
a_Pkt.WriteBEUInt8(SLIME_SIZE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
@@ -909,7 +909,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtVillager:
{
- auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
+ auto & Villager = static_cast<const cVillager &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Villager.IsBaby());
@@ -922,7 +922,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtWitch:
{
- auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
+ auto & Witch = static_cast<const cWitch &>(a_Mob);
a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Witch.IsAngry());
@@ -931,7 +931,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtWither:
{
- auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
+ auto & Wither = static_cast<const cWither &>(a_Mob);
a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
@@ -942,7 +942,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtWolf:
{
- auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
+ auto & Wolf = static_cast<const cWolf &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Wolf.IsBaby());
@@ -980,7 +980,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtZombie:
{
- auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
+ auto & Zombie = static_cast<const cZombie &>(a_Mob);
a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Zombie.IsBaby());
@@ -997,7 +997,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtZombiePigman:
{
- auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
+ auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(ZombiePigman.IsBaby());
diff --git a/src/Protocol/Protocol_1_11.cpp b/src/Protocol/Protocol_1_11.cpp
index f5df4e646..ebbcbade2 100644
--- a/src/Protocol/Protocol_1_11.cpp
+++ b/src/Protocol/Protocol_1_11.cpp
@@ -411,7 +411,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
{
case E_BLOCK_BEACON:
{
- auto & BeaconEntity = reinterpret_cast<const cBeaconEntity &>(a_BlockEntity);
+ auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity);
Writer.AddInt("x", BeaconEntity.GetPosX());
Writer.AddInt("y", BeaconEntity.GetPosY());
Writer.AddInt("z", BeaconEntity.GetPosZ());
@@ -424,7 +424,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
case E_BLOCK_BED:
{
- auto & BedEntity = reinterpret_cast<const cBedEntity &>(a_BlockEntity);
+ auto & BedEntity = static_cast<const cBedEntity &>(a_BlockEntity);
Writer.AddInt("x", BedEntity.GetPosX());
Writer.AddInt("y", BedEntity.GetPosY());
Writer.AddInt("z", BedEntity.GetPosZ());
@@ -435,7 +435,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
case E_BLOCK_COMMAND_BLOCK:
{
- auto & CommandBlockEntity = reinterpret_cast<const cCommandBlockEntity &>(a_BlockEntity);
+ auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity);
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
Writer.AddInt("x", CommandBlockEntity.GetPosX());
@@ -456,7 +456,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
case E_BLOCK_HEAD:
{
- auto & MobHeadEntity = reinterpret_cast<const cMobHeadEntity &>(a_BlockEntity);
+ auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity);
Writer.AddInt("x", MobHeadEntity.GetPosX());
Writer.AddInt("y", MobHeadEntity.GetPosY());
Writer.AddInt("z", MobHeadEntity.GetPosZ());
@@ -482,7 +482,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
case E_BLOCK_FLOWER_POT:
{
- auto & FlowerPotEntity = reinterpret_cast<const cFlowerPotEntity &>(a_BlockEntity);
+ auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity);
Writer.AddInt("x", FlowerPotEntity.GetPosX());
Writer.AddInt("y", FlowerPotEntity.GetPosY());
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
@@ -494,7 +494,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
case E_BLOCK_MOB_SPAWNER:
{
- auto & MobSpawnerEntity = reinterpret_cast<const cMobSpawnerEntity &>(a_BlockEntity);
+ auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity);
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
@@ -636,7 +636,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
{
case cEntity::etPlayer:
{
- auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
+ auto & Player = static_cast<const cPlayer &>(a_Entity);
// TODO Set player custom name to their name.
// Then it's possible to move the custom name of mobs to the entities
@@ -662,7 +662,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
{
a_Pkt.WriteBEUInt8(ITEM_ITEM);
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
+ WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
break;
}
case cEntity::etMinecart:
@@ -671,7 +671,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
// The following expression makes Minecarts shake more with less health or higher damage taken
- auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
+ auto & Minecart = static_cast<const cMinecart &>(a_Entity);
auto maxHealth = a_Entity.GetMaxHealth();
auto curHealth = a_Entity.GetHealth();
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
@@ -686,7 +686,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
if (Minecart.GetPayload() == cMinecart::mpNone)
{
- auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
+ auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
const cItem & MinecartContent = RideableMinecart.GetContent();
if (!MinecartContent.IsEmpty())
{
@@ -709,28 +709,28 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
{
a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
+ a_Pkt.WriteBool(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
}
break;
} // case etMinecart
case cEntity::etProjectile:
{
- auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
+ auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
switch (Projectile.GetProjectileKind())
{
case cProjectileEntity::pkArrow:
{
a_Pkt.WriteBEUInt8(ARROW_CRITICAL);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
- a_Pkt.WriteBEInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
+ a_Pkt.WriteBEInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
break;
}
case cProjectileEntity::pkFirework:
{
a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
+ WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
// FIREWORK_BOOSTED_ENTITY_ID, in 1.11.1 only
break;
@@ -739,7 +739,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
{
a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cSplashPotionEntity &>(Projectile).GetItem());
+ WriteItem(a_Pkt, static_cast<const cSplashPotionEntity &>(Projectile).GetItem());
}
default:
{
@@ -751,13 +751,13 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
case cEntity::etMonster:
{
- WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
+ WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
break;
}
case cEntity::etBoat:
{
- auto & Boat = reinterpret_cast<const cBoat &>(a_Entity);
+ auto & Boat = static_cast<const cBoat &>(a_Entity);
a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
@@ -788,7 +788,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
case cEntity::etItemFrame:
{
- auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
+ auto & Frame = static_cast<const cItemFrame &>(a_Entity);
a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM);
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
WriteItem(a_Pkt, Frame.GetItem());
@@ -834,7 +834,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
{
case mtBat:
{
- auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
+ auto & Bat = static_cast<const cBat &>(a_Mob);
a_Pkt.WriteBEUInt8(BAT_HANGING);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
@@ -843,7 +843,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtChicken:
{
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+ auto & Chicken = static_cast<const cChicken &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -853,7 +853,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtCow:
{
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+ auto & Cow = static_cast<const cCow &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -863,7 +863,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtCreeper:
{
- auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
+ auto & Creeper = static_cast<const cCreeper &>(a_Mob);
a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing")
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1));
@@ -880,7 +880,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtEnderman:
{
- auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
+ auto & Enderman = static_cast<const cEnderman &>(a_Mob);
a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
UInt32 Carried = 0;
@@ -896,7 +896,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtGhast:
{
- auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
+ auto & Ghast = static_cast<const cGhast &>(a_Mob);
a_Pkt.WriteBEUInt8(GHAST_ATTACKING);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Ghast.IsCharging());
@@ -908,7 +908,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
// XXX This behaves incorrectly with different varients; horses have different entity IDs now
// Abstract horse
- auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
+ auto & Horse = static_cast<const cHorse &>(a_Mob);
Int8 Flags = 0;
if (Horse.IsTame())
{
@@ -963,7 +963,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtMagmaCube:
{
- auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
+ auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
a_Pkt.WriteBEUInt8(SLIME_SIZE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
@@ -972,7 +972,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtOcelot:
{
- auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
+ auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -1000,7 +1000,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtPig:
{
- auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
+ auto & Pig = static_cast<const cPig &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -1016,7 +1016,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtRabbit:
{
- auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Rabbit.IsBaby());
@@ -1029,7 +1029,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtSheep:
{
- auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
+ auto & Sheep = static_cast<const cSheep &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -1051,7 +1051,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
{
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
- // auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
+ // auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
// a_Pkt.WriteBEUInt8(SKELETON_TYPE);
// a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
// a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
@@ -1060,7 +1060,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtSlime:
{
- auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
+ auto & Slime = static_cast<const cSlime &>(a_Mob);
a_Pkt.WriteBEUInt8(SLIME_SIZE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
@@ -1069,7 +1069,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtVillager:
{
- auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
+ auto & Villager = static_cast<const cVillager &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Villager.IsBaby());
@@ -1082,7 +1082,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtWitch:
{
- auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
+ auto & Witch = static_cast<const cWitch &>(a_Mob);
a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Witch.IsAngry());
@@ -1091,7 +1091,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtWither:
{
- auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
+ auto & Wither = static_cast<const cWither &>(a_Mob);
a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
@@ -1102,7 +1102,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtWolf:
{
- auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
+ auto & Wolf = static_cast<const cWolf &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Wolf.IsBaby());
@@ -1141,7 +1141,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtZombie:
{
// XXX Zombies were also split into new sublcasses; this doesn't handle that.
- auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
+ auto & Zombie = static_cast<const cZombie &>(a_Mob);
a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Zombie.IsBaby());
@@ -1159,7 +1159,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
case mtZombiePigman:
{
- auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
+ auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(ZombiePigman.IsBaby());
diff --git a/src/Protocol/Protocol_1_12.cpp b/src/Protocol/Protocol_1_12.cpp
index a3d1952ed..bb6f7f6ba 100644
--- a/src/Protocol/Protocol_1_12.cpp
+++ b/src/Protocol/Protocol_1_12.cpp
@@ -449,7 +449,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
{
case cEntity::etPlayer:
{
- auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
+ auto & Player = static_cast<const cPlayer &>(a_Entity);
// TODO Set player custom name to their name.
// Then it's possible to move the custom name of mobs to the entities
@@ -475,7 +475,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
{
a_Pkt.WriteBEUInt8(ITEM_ITEM);
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
+ WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
break;
}
case cEntity::etMinecart:
@@ -484,7 +484,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
// The following expression makes Minecarts shake more with less health or higher damage taken
- auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
+ auto & Minecart = static_cast<const cMinecart &>(a_Entity);
auto maxHealth = a_Entity.GetMaxHealth();
auto curHealth = a_Entity.GetHealth();
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
@@ -499,7 +499,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
if (Minecart.GetPayload() == cMinecart::mpNone)
{
- auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
+ auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
const cItem & MinecartContent = RideableMinecart.GetContent();
if (!MinecartContent.IsEmpty())
{
@@ -522,28 +522,28 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
{
a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
+ a_Pkt.WriteBool(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
}
break;
} // case etMinecart
case cEntity::etProjectile:
{
- auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
+ auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
switch (Projectile.GetProjectileKind())
{
case cProjectileEntity::pkArrow:
{
a_Pkt.WriteBEUInt8(ARROW_CRITICAL);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
- a_Pkt.WriteBEInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
+ a_Pkt.WriteBEInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
break;
}
case cProjectileEntity::pkFirework:
{
a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
+ WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
// FIREWORK_BOOSTED_ENTITY_ID, in 1.11.1 only
break;
@@ -552,7 +552,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
{
a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cSplashPotionEntity &>(Projectile).GetItem());
+ WriteItem(a_Pkt, static_cast<const cSplashPotionEntity &>(Projectile).GetItem());
}
default:
{
@@ -564,13 +564,13 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
case cEntity::etMonster:
{
- WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
+ WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
break;
}
case cEntity::etBoat:
{
- auto & Boat = reinterpret_cast<const cBoat &>(a_Entity);
+ auto & Boat = static_cast<const cBoat &>(a_Entity);
a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
@@ -601,7 +601,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
case cEntity::etItemFrame:
{
- auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
+ auto & Frame = static_cast<const cItemFrame &>(a_Entity);
a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM);
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
WriteItem(a_Pkt, Frame.GetItem());
@@ -647,7 +647,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
{
case mtBat:
{
- auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
+ auto & Bat = static_cast<const cBat &>(a_Mob);
a_Pkt.WriteBEUInt8(BAT_HANGING);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
@@ -656,7 +656,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtChicken:
{
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+ auto & Chicken = static_cast<const cChicken &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -666,7 +666,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtCow:
{
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+ auto & Cow = static_cast<const cCow &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -676,7 +676,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtCreeper:
{
- auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
+ auto & Creeper = static_cast<const cCreeper &>(a_Mob);
a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing")
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1));
@@ -693,7 +693,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtEnderman:
{
- auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
+ auto & Enderman = static_cast<const cEnderman &>(a_Mob);
a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
UInt32 Carried = 0;
@@ -709,7 +709,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtGhast:
{
- auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
+ auto & Ghast = static_cast<const cGhast &>(a_Mob);
a_Pkt.WriteBEUInt8(GHAST_ATTACKING);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Ghast.IsCharging());
@@ -721,7 +721,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
// XXX This behaves incorrectly with different varients; horses have different entity IDs now
// Abstract horse
- auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
+ auto & Horse = static_cast<const cHorse &>(a_Mob);
Int8 Flags = 0;
if (Horse.IsTame())
{
@@ -776,7 +776,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtMagmaCube:
{
- auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
+ auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
a_Pkt.WriteBEUInt8(SLIME_SIZE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
@@ -785,7 +785,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtOcelot:
{
- auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
+ auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -813,7 +813,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtPig:
{
- auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
+ auto & Pig = static_cast<const cPig &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -829,7 +829,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtRabbit:
{
- auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Rabbit.IsBaby());
@@ -842,7 +842,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtSheep:
{
- auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
+ auto & Sheep = static_cast<const cSheep &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -864,7 +864,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
{
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
- // auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
+ // auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
// a_Pkt.WriteBEUInt8(SKELETON_TYPE);
// a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
// a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
@@ -873,7 +873,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtSlime:
{
- auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
+ auto & Slime = static_cast<const cSlime &>(a_Mob);
a_Pkt.WriteBEUInt8(SLIME_SIZE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
@@ -882,7 +882,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtVillager:
{
- auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
+ auto & Villager = static_cast<const cVillager &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Villager.IsBaby());
@@ -895,7 +895,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtWitch:
{
- auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
+ auto & Witch = static_cast<const cWitch &>(a_Mob);
a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Witch.IsAngry());
@@ -904,7 +904,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtWither:
{
- auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
+ auto & Wither = static_cast<const cWither &>(a_Mob);
a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER);
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
@@ -915,7 +915,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtWolf:
{
- auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
+ auto & Wolf = static_cast<const cWolf &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Wolf.IsBaby());
@@ -954,7 +954,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtZombie:
{
// XXX Zombies were also split into new sublcasses; this doesn't handle that.
- auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
+ auto & Zombie = static_cast<const cZombie &>(a_Mob);
a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Zombie.IsBaby());
@@ -972,7 +972,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
case mtZombiePigman:
{
- auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
+ auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(ZombiePigman.IsBaby());
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp
index 41e168c95..58f067278 100644
--- a/src/Protocol/Protocol_1_8.cpp
+++ b/src/Protocol/Protocol_1_8.cpp
@@ -2842,7 +2842,7 @@ void cProtocol_1_8_0::SendData(const char * a_Data, size_t a_Size)
while (a_Size > 0)
{
size_t NumBytes = (a_Size > sizeof(Encrypted)) ? sizeof(Encrypted) : a_Size;
- m_Encryptor.ProcessData(Encrypted, reinterpret_cast<Byte *>(const_cast<char*>(a_Data)), NumBytes);
+ m_Encryptor.ProcessData(Encrypted, reinterpret_cast<const Byte *>(a_Data), NumBytes);
m_Client->SendData(reinterpret_cast<const char *>(Encrypted), NumBytes);
a_Size -= NumBytes;
a_Data += NumBytes;
@@ -3161,7 +3161,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
{
case E_BLOCK_BEACON:
{
- auto & BeaconEntity = reinterpret_cast<const cBeaconEntity &>(a_BlockEntity);
+ auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity);
Writer.AddInt("x", BeaconEntity.GetPosX());
Writer.AddInt("y", BeaconEntity.GetPosY());
Writer.AddInt("z", BeaconEntity.GetPosZ());
@@ -3174,7 +3174,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
case E_BLOCK_COMMAND_BLOCK:
{
- auto & CommandBlockEntity = reinterpret_cast<const cCommandBlockEntity &>(a_BlockEntity);
+ auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity);
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
Writer.AddInt("x", CommandBlockEntity.GetPosX());
@@ -3195,7 +3195,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
case E_BLOCK_HEAD:
{
- auto & MobHeadEntity = reinterpret_cast<const cMobHeadEntity &>(a_BlockEntity);
+ auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity);
Writer.AddInt("x", MobHeadEntity.GetPosX());
Writer.AddInt("y", MobHeadEntity.GetPosY());
Writer.AddInt("z", MobHeadEntity.GetPosZ());
@@ -3221,7 +3221,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
case E_BLOCK_FLOWER_POT:
{
- auto & FlowerPotEntity = reinterpret_cast<const cFlowerPotEntity &>(a_BlockEntity);
+ auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity);
Writer.AddInt("x", FlowerPotEntity.GetPosX());
Writer.AddInt("y", FlowerPotEntity.GetPosY());
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
@@ -3233,7 +3233,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
case E_BLOCK_MOB_SPAWNER:
{
- auto & MobSpawnerEntity = reinterpret_cast<const cMobSpawnerEntity &>(a_BlockEntity);
+ auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity);
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
@@ -3288,7 +3288,7 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
{
case cEntity::etPlayer:
{
- auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
+ auto & Player = static_cast<const cPlayer &>(a_Entity);
// Player health (not handled since players aren't monsters)
a_Pkt.WriteBEUInt8(0x66);
@@ -3303,7 +3303,7 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
case cEntity::etPickup:
{
a_Pkt.WriteBEUInt8((5 << 5) | 10); // Slot(5) + index 10
- WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
+ WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
break;
}
case cEntity::etMinecart:
@@ -3317,7 +3317,7 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
Health: 3 | 3 - (3 - 3) = 3
Health: 1 | 3 - (1 - 3) = 5
*/
- auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
+ auto & Minecart = static_cast<const cMinecart &>(a_Entity);
a_Pkt.WriteBEInt32(static_cast<Int32>((((a_Entity.GetMaxHealth() / 2) - (a_Entity.GetHealth() - (a_Entity.GetMaxHealth() / 2))) * Minecart.LastDamage()) * 4));
a_Pkt.WriteBEUInt8(0x52);
a_Pkt.WriteBEInt32(1); // Shaking direction, doesn't seem to affect anything
@@ -3326,7 +3326,7 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
if (Minecart.GetPayload() == cMinecart::mpNone)
{
- auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
+ auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
const cItem & MinecartContent = RideableMinecart.GetContent();
if (!MinecartContent.IsEmpty())
{
@@ -3343,26 +3343,26 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
else if (Minecart.GetPayload() == cMinecart::mpFurnace)
{
a_Pkt.WriteBEUInt8(0x10);
- a_Pkt.WriteBEUInt8(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled() ? 1 : 0);
+ a_Pkt.WriteBEUInt8(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled() ? 1 : 0);
}
break;
} // case etMinecart
case cEntity::etProjectile:
{
- auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
+ auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
switch (Projectile.GetProjectileKind())
{
case cProjectileEntity::pkArrow:
{
a_Pkt.WriteBEUInt8(0x10);
- a_Pkt.WriteBEUInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
+ a_Pkt.WriteBEUInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
break;
}
case cProjectileEntity::pkFirework:
{
a_Pkt.WriteBEUInt8(0xa8);
- WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
+ WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
break;
}
default:
@@ -3375,13 +3375,13 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
case cEntity::etMonster:
{
- WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
+ WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
break;
}
case cEntity::etItemFrame:
{
- auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
+ auto & Frame = static_cast<const cItemFrame &>(a_Entity);
a_Pkt.WriteBEUInt8(0xa8);
WriteItem(a_Pkt, Frame.GetItem());
a_Pkt.WriteBEUInt8(0x09);
@@ -3419,7 +3419,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
{
case mtBat:
{
- auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
+ auto & Bat = static_cast<const cBat &>(a_Mob);
a_Pkt.WriteBEUInt8(0x10);
a_Pkt.WriteBEUInt8(Bat.IsHanging() ? 1 : 0);
break;
@@ -3427,7 +3427,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtChicken:
{
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+ auto & Chicken = static_cast<const cChicken &>(a_Mob);
a_Pkt.WriteBEUInt8(0x0c);
a_Pkt.WriteBEInt8(Chicken.IsBaby() ? -1 : (Chicken.IsInLoveCooldown() ? 1 : 0));
break;
@@ -3435,7 +3435,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtCow:
{
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+ auto & Cow = static_cast<const cCow &>(a_Mob);
a_Pkt.WriteBEUInt8(0x0c);
a_Pkt.WriteBEInt8(Cow.IsBaby() ? -1 : (Cow.IsInLoveCooldown() ? 1 : 0));
break;
@@ -3443,7 +3443,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtCreeper:
{
- auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
+ auto & Creeper = static_cast<const cCreeper &>(a_Mob);
a_Pkt.WriteBEUInt8(0x10);
a_Pkt.WriteBEUInt8(Creeper.IsBlowing() ? 1 : 255);
a_Pkt.WriteBEUInt8(0x11);
@@ -3453,7 +3453,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtEnderman:
{
- auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
+ auto & Enderman = static_cast<const cEnderman &>(a_Mob);
a_Pkt.WriteBEUInt8(0x30);
a_Pkt.WriteBEInt16(static_cast<Byte>(Enderman.GetCarriedBlock()));
a_Pkt.WriteBEUInt8(0x11);
@@ -3465,7 +3465,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtGhast:
{
- auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
+ auto & Ghast = static_cast<const cGhast &>(a_Mob);
a_Pkt.WriteBEUInt8(0x10);
a_Pkt.WriteBEUInt8(Ghast.IsCharging());
break;
@@ -3473,7 +3473,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtHorse:
{
- auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
+ auto & Horse = static_cast<const cHorse &>(a_Mob);
int Flags = 0;
if (Horse.IsTame())
{
@@ -3517,7 +3517,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtMagmaCube:
{
- auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
+ auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
a_Pkt.WriteBEUInt8(0x10);
a_Pkt.WriteBEUInt8(static_cast<UInt8>(MagmaCube.GetSize()));
break;
@@ -3525,7 +3525,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtOcelot:
{
- auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
+ auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
a_Pkt.WriteBEUInt8(0x0c);
a_Pkt.WriteBEInt8(Ocelot.IsBaby() ? -1 : (Ocelot.IsInLoveCooldown() ? 1 : 0));
break;
@@ -3533,7 +3533,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtPig:
{
- auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
+ auto & Pig = static_cast<const cPig &>(a_Mob);
a_Pkt.WriteBEUInt8(0x0c);
a_Pkt.WriteBEInt8(Pig.IsBaby() ? -1 : (Pig.IsInLoveCooldown() ? 1 : 0));
a_Pkt.WriteBEUInt8(0x10);
@@ -3543,7 +3543,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtSheep:
{
- auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
+ auto & Sheep = static_cast<const cSheep &>(a_Mob);
a_Pkt.WriteBEUInt8(0x0c);
a_Pkt.WriteBEInt8(Sheep.IsBaby() ? -1 : (Sheep.IsInLoveCooldown() ? 1 : 0));
@@ -3560,7 +3560,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtRabbit:
{
- auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
a_Pkt.WriteBEUInt8(0x12);
a_Pkt.WriteBEUInt8(static_cast<UInt8>(Rabbit.GetRabbitType()));
a_Pkt.WriteBEUInt8(0x0c);
@@ -3570,7 +3570,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtSkeleton:
{
- auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
+ auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
a_Pkt.WriteBEUInt8(0x0d);
a_Pkt.WriteBEUInt8(Skeleton.IsWither() ? 1 : 0);
break;
@@ -3578,7 +3578,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtSlime:
{
- auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
+ auto & Slime = static_cast<const cSlime &>(a_Mob);
a_Pkt.WriteBEUInt8(0x10);
a_Pkt.WriteBEUInt8(static_cast<UInt8>(Slime.GetSize()));
break;
@@ -3586,7 +3586,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtVillager:
{
- auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
+ auto & Villager = static_cast<const cVillager &>(a_Mob);
a_Pkt.WriteBEUInt8(0x50);
a_Pkt.WriteBEInt32(Villager.GetVilType());
a_Pkt.WriteBEUInt8(0x0c);
@@ -3596,7 +3596,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtWitch:
{
- auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
+ auto & Witch = static_cast<const cWitch &>(a_Mob);
a_Pkt.WriteBEUInt8(0x15);
a_Pkt.WriteBEUInt8(Witch.IsAngry() ? 1 : 0);
break;
@@ -3604,7 +3604,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtWither:
{
- auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
+ auto & Wither = static_cast<const cWither &>(a_Mob);
a_Pkt.WriteBEUInt8(0x54); // Int at index 20
a_Pkt.WriteBEInt32(static_cast<Int32>(Wither.GetWitherInvulnerableTicks()));
a_Pkt.WriteBEUInt8(0x66); // Float at index 6
@@ -3614,7 +3614,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtWolf:
{
- auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
+ auto & Wolf = static_cast<const cWolf &>(a_Mob);
Byte WolfStatus = 0;
if (Wolf.IsSitting())
{
@@ -3644,7 +3644,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtZombie:
{
- auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
+ auto & Zombie = static_cast<const cZombie &>(a_Mob);
a_Pkt.WriteBEUInt8(0x0c);
a_Pkt.WriteBEInt8(Zombie.IsBaby() ? 1 : -1);
a_Pkt.WriteBEUInt8(0x0d);
@@ -3656,7 +3656,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtZombiePigman:
{
- auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
+ auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
a_Pkt.WriteBEUInt8(0x0c);
a_Pkt.WriteBEInt8(ZombiePigman.IsBaby() ? 1 : -1);
break;
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 3e600cefd..64721ed04 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -2405,7 +2405,7 @@ void cProtocol_1_9_0::HandlePacketBoatSteer(cByteBuffer & a_ByteBuffer)
{
if (Vehicle->GetEntityType() == cEntity::etBoat)
{
- auto * Boat = reinterpret_cast<cBoat *>(Vehicle);
+ auto * Boat = static_cast<cBoat *>(Vehicle);
Boat->UpdatePaddles(RightPaddle, LeftPaddle);
}
}
@@ -2970,7 +2970,7 @@ void cProtocol_1_9_0::SendData(const char * a_Data, size_t a_Size)
while (a_Size > 0)
{
size_t NumBytes = (a_Size > sizeof(Encrypted)) ? sizeof(Encrypted) : a_Size;
- m_Encryptor.ProcessData(Encrypted, reinterpret_cast<Byte *>(const_cast<char*>(a_Data)), NumBytes);
+ m_Encryptor.ProcessData(Encrypted, reinterpret_cast<const Byte *>(a_Data), NumBytes);
m_Client->SendData(reinterpret_cast<const char *>(Encrypted), NumBytes);
a_Size -= NumBytes;
a_Data += NumBytes;
@@ -3527,7 +3527,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
{
case E_BLOCK_BEACON:
{
- auto & BeaconEntity = reinterpret_cast<const cBeaconEntity &>(a_BlockEntity);
+ auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity);
Writer.AddInt("x", BeaconEntity.GetPosX());
Writer.AddInt("y", BeaconEntity.GetPosY());
Writer.AddInt("z", BeaconEntity.GetPosZ());
@@ -3540,7 +3540,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
case E_BLOCK_COMMAND_BLOCK:
{
- auto & CommandBlockEntity = reinterpret_cast<const cCommandBlockEntity &>(a_BlockEntity);
+ auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity);
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
Writer.AddInt("x", CommandBlockEntity.GetPosX());
@@ -3561,7 +3561,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
case E_BLOCK_HEAD:
{
- auto & MobHeadEntity = reinterpret_cast<const cMobHeadEntity &>(a_BlockEntity);
+ auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity);
Writer.AddInt("x", MobHeadEntity.GetPosX());
Writer.AddInt("y", MobHeadEntity.GetPosY());
Writer.AddInt("z", MobHeadEntity.GetPosZ());
@@ -3587,7 +3587,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
case E_BLOCK_FLOWER_POT:
{
- auto & FlowerPotEntity = reinterpret_cast<const cFlowerPotEntity &>(a_BlockEntity);
+ auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity);
Writer.AddInt("x", FlowerPotEntity.GetPosX());
Writer.AddInt("y", FlowerPotEntity.GetPosY());
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
@@ -3599,7 +3599,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
case E_BLOCK_MOB_SPAWNER:
{
- auto & MobSpawnerEntity = reinterpret_cast<const cMobSpawnerEntity &>(a_BlockEntity);
+ auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity);
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
@@ -3657,7 +3657,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
{
case cEntity::etPlayer:
{
- auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
+ auto & Player = static_cast<const cPlayer &>(a_Entity);
// TODO Set player custom name to their name.
// Then it's possible to move the custom name of mobs to the entities
@@ -3683,7 +3683,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
{
a_Pkt.WriteBEUInt8(5); // Index 5: Item
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
+ WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
break;
}
case cEntity::etMinecart:
@@ -3692,7 +3692,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
// The following expression makes Minecarts shake more with less health or higher damage taken
- auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
+ auto & Minecart = static_cast<const cMinecart &>(a_Entity);
auto maxHealth = a_Entity.GetMaxHealth();
auto curHealth = a_Entity.GetHealth();
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
@@ -3707,7 +3707,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
if (Minecart.GetPayload() == cMinecart::mpNone)
{
- auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
+ auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
const cItem & MinecartContent = RideableMinecart.GetContent();
if (!MinecartContent.IsEmpty())
{
@@ -3730,35 +3730,35 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
{
a_Pkt.WriteBEUInt8(11); // Index 11: Is powered
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
- a_Pkt.WriteBool(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
+ a_Pkt.WriteBool(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
}
break;
} // case etMinecart
case cEntity::etProjectile:
{
- auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
+ auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
switch (Projectile.GetProjectileKind())
{
case cProjectileEntity::pkArrow:
{
a_Pkt.WriteBEUInt8(5); // Index 5: Is critical
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
- a_Pkt.WriteBEInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
+ a_Pkt.WriteBEInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
break;
}
case cProjectileEntity::pkFirework:
{
a_Pkt.WriteBEUInt8(5); // Index 5: Firework item used for this firework
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
+ WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
break;
}
case cProjectileEntity::pkSplashPotion:
{
a_Pkt.WriteBEUInt8(5); // Index 5: Potion item which was thrown
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
- WriteItem(a_Pkt, reinterpret_cast<const cSplashPotionEntity &>(Projectile).GetItem());
+ WriteItem(a_Pkt, static_cast<const cSplashPotionEntity &>(Projectile).GetItem());
}
default:
{
@@ -3770,13 +3770,13 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
case cEntity::etMonster:
{
- WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
+ WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
break;
}
case cEntity::etBoat:
{
- auto & Boat = reinterpret_cast<const cBoat &>(a_Entity);
+ auto & Boat = static_cast<const cBoat &>(a_Entity);
a_Pkt.WriteBEInt8(5); // Index 6: Time since last hit
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
@@ -3807,7 +3807,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
case cEntity::etItemFrame:
{
- auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
+ auto & Frame = static_cast<const cItemFrame &>(a_Entity);
a_Pkt.WriteBEUInt8(5); // Index 5: Item
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
WriteItem(a_Pkt, Frame.GetItem());
@@ -3851,7 +3851,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
{
case mtBat:
{
- auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
+ auto & Bat = static_cast<const cBat &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Bat flags - currently only hanging
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
@@ -3860,7 +3860,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtChicken:
{
- auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
+ auto & Chicken = static_cast<const cChicken &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -3870,7 +3870,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtCow:
{
- auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
+ auto & Cow = static_cast<const cCow &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -3880,7 +3880,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtCreeper:
{
- auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
+ auto & Creeper = static_cast<const cCreeper &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: State (idle or "blowing")
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : 0xffffffff);
@@ -3897,7 +3897,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtEnderman:
{
- auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
+ auto & Enderman = static_cast<const cEnderman &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Carried block
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
UInt32 Carried = 0;
@@ -3913,7 +3913,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtGhast:
{
- auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
+ auto & Ghast = static_cast<const cGhast &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Is attacking
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Ghast.IsCharging());
@@ -3922,7 +3922,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtHorse:
{
- auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
+ auto & Horse = static_cast<const cHorse &>(a_Mob);
Int8 Flags = 0;
if (Horse.IsTame())
{
@@ -3975,7 +3975,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtMagmaCube:
{
- auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
+ auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Size
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
@@ -3984,7 +3984,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtOcelot:
{
- auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
+ auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -3994,7 +3994,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtPig:
{
- auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
+ auto & Pig = static_cast<const cPig &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -4009,7 +4009,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtRabbit:
{
- auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
+ auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Rabbit.IsBaby());
@@ -4022,7 +4022,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtSheep:
{
- auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
+ auto & Sheep = static_cast<const cSheep &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
@@ -4042,7 +4042,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtSkeleton:
{
- auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
+ auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Type
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
@@ -4051,7 +4051,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtSlime:
{
- auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
+ auto & Slime = static_cast<const cSlime &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Size
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
@@ -4060,7 +4060,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtVillager:
{
- auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
+ auto & Villager = static_cast<const cVillager &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Villager.IsBaby());
@@ -4073,7 +4073,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtWitch:
{
- auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
+ auto & Witch = static_cast<const cWitch &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is angry
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Witch.IsAngry());
@@ -4082,7 +4082,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtWither:
{
- auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
+ auto & Wither = static_cast<const cWither &>(a_Mob);
a_Pkt.WriteBEUInt8(14); // Index 14: Invulnerable ticks
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
@@ -4093,7 +4093,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtWolf:
{
- auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
+ auto & Wolf = static_cast<const cWolf &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Wolf.IsBaby());
@@ -4131,7 +4131,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtZombie:
{
- auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
+ auto & Zombie = static_cast<const cZombie &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(Zombie.IsBaby());
@@ -4148,7 +4148,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
case mtZombiePigman:
{
- auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
+ auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
a_Pkt.WriteBool(ZombiePigman.IsBaby());
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index ae0aec1ad..08dd4774a 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -638,7 +638,7 @@ AString & CreateHexDump(AString & a_Out, const void * a_Data, size_t a_Size, siz
size_t k = std::min(a_Size - i, a_BytesPerLine);
for (size_t j = 0; j < k; j++)
{
- Byte c = (reinterpret_cast<const Byte *>(a_Data))[i + j];
+ Byte c = (static_cast<const Byte *>(a_Data))[i + j];
Hex << HEX(c >> 4) << HEX(c & 0xf) << ' ';
Chars << ((c >= ' ') ? static_cast<char>(c) : '.');
} // for j
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index ab1edf595..b43da1162 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -993,10 +993,10 @@ void cSlotAreaAnvil::OnTakeResult(cPlayer & a_Player)
m_ParentWindow.SetProperty(0, static_cast<short>(m_MaximumCost), a_Player);
m_MaximumCost = 0;
- reinterpret_cast<cAnvilWindow &>(m_ParentWindow).SetRepairedItemName("", nullptr);
+ static_cast<cAnvilWindow &>(m_ParentWindow).SetRepairedItemName("", nullptr);
int PosX, PosY, PosZ;
- reinterpret_cast<cAnvilWindow &>(m_ParentWindow).GetBlockPos(PosX, PosY, PosZ);
+ static_cast<cAnvilWindow &>(m_ParentWindow).GetBlockPos(PosX, PosY, PosZ);
BLOCKTYPE Block;
NIBBLETYPE BlockMeta;
@@ -1142,7 +1142,7 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)
}
int NameChangeExp = 0;
- const AString & RepairedItemName = reinterpret_cast<cAnvilWindow*>(&m_ParentWindow)->GetRepairedItemName();
+ const AString & RepairedItemName = static_cast<cAnvilWindow*>(&m_ParentWindow)->GetRepairedItemName();
if (RepairedItemName.empty())
{
// Remove custom name
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 78573572d..eb04e54e2 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -487,7 +487,7 @@ void cNBTChunkSerializer::AddMinecartEntity(cMinecart * a_Minecart)
{
AddBasicEntity(a_Minecart, "MinecartChest");
// Add chest contents into the Items tag:
- AddMinecartChestContents(reinterpret_cast<cMinecartWithChest *>(a_Minecart));
+ AddMinecartChestContents(static_cast<cMinecartWithChest *>(a_Minecart));
break;
}
case cMinecart::mpFurnace:
@@ -607,26 +607,26 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
{
case mtBat:
{
- m_Writer.AddByte("BatFlags", reinterpret_cast<const cBat *>(a_Monster)->IsHanging());
+ m_Writer.AddByte("BatFlags", static_cast<const cBat *>(a_Monster)->IsHanging());
break;
}
case mtCreeper:
{
- const cCreeper *Creeper = reinterpret_cast<const cCreeper *>(a_Monster);
+ const cCreeper *Creeper = static_cast<const cCreeper *>(a_Monster);
m_Writer.AddByte("powered", Creeper->IsCharged());
m_Writer.AddByte("ignited", Creeper->IsBlowing());
break;
}
case mtEnderman:
{
- const cEnderman *Enderman = reinterpret_cast<const cEnderman *>(a_Monster);
+ const cEnderman *Enderman = static_cast<const cEnderman *>(a_Monster);
m_Writer.AddShort("carried", static_cast<Int16>(Enderman->GetCarriedBlock()));
m_Writer.AddShort("carriedData", static_cast<Int16>(Enderman->GetCarriedMeta()));
break;
}
case mtHorse:
{
- const cHorse *Horse = reinterpret_cast<const cHorse *>(a_Monster);
+ const cHorse *Horse = static_cast<const cHorse *>(a_Monster);
m_Writer.AddByte("ChestedHorse", Horse->IsChested()? 1 : 0);
m_Writer.AddByte("EatingHaystack", Horse->IsEating()? 1 : 0);
m_Writer.AddByte("Tame", Horse->IsTame()? 1: 0);
@@ -640,12 +640,12 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
}
case mtMagmaCube:
{
- m_Writer.AddInt("Size", reinterpret_cast<const cMagmaCube *>(a_Monster)->GetSize());
+ m_Writer.AddInt("Size", static_cast<const cMagmaCube *>(a_Monster)->GetSize());
break;
}
case mtOcelot:
{
- const auto *Ocelot = reinterpret_cast<const cOcelot *>(a_Monster);
+ const auto *Ocelot = static_cast<const cOcelot *>(a_Monster);
if (!Ocelot->GetOwnerName().empty())
{
m_Writer.AddString("Owner", Ocelot->GetOwnerName());
@@ -661,12 +661,12 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
}
case mtPig:
{
- m_Writer.AddInt("Age", reinterpret_cast<const cPig *>(a_Monster)->GetAge());
+ m_Writer.AddInt("Age", static_cast<const cPig *>(a_Monster)->GetAge());
break;
}
case mtRabbit:
{
- const cRabbit * Rabbit = reinterpret_cast<const cRabbit *>(a_Monster);
+ const cRabbit * Rabbit = static_cast<const cRabbit *>(a_Monster);
m_Writer.AddInt("RabbitType", static_cast<Int32>(Rabbit->GetRabbitType()));
m_Writer.AddInt("MoreCarrotTicks", Rabbit->GetMoreCarrotTicks());
m_Writer.AddInt("Age", Rabbit->GetAge());
@@ -674,7 +674,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
}
case mtSheep:
{
- const cSheep *Sheep = reinterpret_cast<const cSheep *>(a_Monster);
+ const cSheep *Sheep = static_cast<const cSheep *>(a_Monster);
m_Writer.AddByte("Sheared", Sheep->IsSheared()? 1 : 0);
m_Writer.AddByte("Color", static_cast<Byte>(Sheep->GetFurColor()));
m_Writer.AddInt ("Age", Sheep->GetAge());
@@ -682,29 +682,29 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
}
case mtSlime:
{
- m_Writer.AddInt("Size", reinterpret_cast<const cSlime *>(a_Monster)->GetSize());
+ m_Writer.AddInt("Size", static_cast<const cSlime *>(a_Monster)->GetSize());
break;
}
case mtSkeleton:
{
- m_Writer.AddByte("SkeletonType", (reinterpret_cast<const cSkeleton *>(a_Monster)->IsWither() ? 1 : 0));
+ m_Writer.AddByte("SkeletonType", (static_cast<const cSkeleton *>(a_Monster)->IsWither() ? 1 : 0));
break;
}
case mtVillager:
{
- const cVillager *Villager = reinterpret_cast<const cVillager *>(a_Monster);
+ const cVillager *Villager = static_cast<const cVillager *>(a_Monster);
m_Writer.AddInt("Profession", Villager->GetVilType());
m_Writer.AddInt("Age", Villager->GetAge());
break;
}
case mtWither:
{
- m_Writer.AddInt("Invul", static_cast<Int32>(reinterpret_cast<const cWither *>(a_Monster)->GetWitherInvulnerableTicks()));
+ m_Writer.AddInt("Invul", static_cast<Int32>(static_cast<const cWither *>(a_Monster)->GetWitherInvulnerableTicks()));
break;
}
case mtWolf:
{
- const cWolf *Wolf = reinterpret_cast<const cWolf *>(a_Monster);
+ const cWolf *Wolf = static_cast<const cWolf *>(a_Monster);
if (!Wolf->GetOwnerName().empty())
{
m_Writer.AddString("Owner", Wolf->GetOwnerName());
@@ -721,7 +721,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
}
case mtZombie:
{
- const cZombie *Zombie = reinterpret_cast<const cZombie *>(a_Monster);
+ const cZombie *Zombie = static_cast<const cZombie *>(a_Monster);
m_Writer.AddByte("IsVillager", Zombie->IsVillagerZombie() ? 1 : 0);
m_Writer.AddByte("IsConverting", Zombie->IsConverting() ? 1 : 0);
m_Writer.AddInt ("Age", Zombie->GetAge());
@@ -729,7 +729,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
}
case mtZombiePigman:
{
- m_Writer.AddInt("Age", reinterpret_cast<const cZombiePigman *>(a_Monster)->GetAge());
+ m_Writer.AddInt("Age", static_cast<const cZombiePigman *>(a_Monster)->GetAge());
break;
}
case mtBlaze:
@@ -787,7 +787,7 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile)
{
case cProjectileEntity::pkArrow:
{
- cArrowEntity * Arrow = reinterpret_cast<cArrowEntity *>(a_Projectile);
+ cArrowEntity * Arrow = static_cast<cArrowEntity *>(a_Projectile);
m_Writer.AddShort("xTile", static_cast<Int16>(Arrow->GetBlockHit().x));
m_Writer.AddShort("yTile", static_cast<Int16>(Arrow->GetBlockHit().y));
@@ -798,7 +798,7 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile)
}
case cProjectileEntity::pkSplashPotion:
{
- cSplashPotionEntity * Potion = reinterpret_cast<cSplashPotionEntity *>(a_Projectile);
+ cSplashPotionEntity * Potion = static_cast<cSplashPotionEntity *>(a_Projectile);
m_Writer.AddInt("EffectType", static_cast<Int16>(Potion->GetEntityEffectType()));
m_Writer.AddInt("EffectDuration", static_cast<Int16>(Potion->GetEntityEffect().GetDuration()));
@@ -993,18 +993,18 @@ void cNBTChunkSerializer::Entity(cEntity * a_Entity)
switch (a_Entity->GetEntityType())
{
- case cEntity::etBoat: AddBoatEntity (reinterpret_cast<cBoat *> (a_Entity)); break;
- case cEntity::etEnderCrystal: AddEnderCrystalEntity(reinterpret_cast<cEnderCrystal *> (a_Entity)); break;
- case cEntity::etFallingBlock: AddFallingBlockEntity(reinterpret_cast<cFallingBlock *> (a_Entity)); break;
- case cEntity::etMinecart: AddMinecartEntity (reinterpret_cast<cMinecart *> (a_Entity)); break;
- case cEntity::etMonster: AddMonsterEntity (reinterpret_cast<cMonster *> (a_Entity)); break;
- case cEntity::etPickup: AddPickupEntity (reinterpret_cast<cPickup *> (a_Entity)); break;
- case cEntity::etProjectile: AddProjectileEntity (reinterpret_cast<cProjectileEntity *>(a_Entity)); break;
- case cEntity::etTNT: AddTNTEntity (reinterpret_cast<cTNTEntity *> (a_Entity)); break;
- case cEntity::etExpOrb: AddExpOrbEntity (reinterpret_cast<cExpOrb *> (a_Entity)); break;
- case cEntity::etItemFrame: AddItemFrameEntity (reinterpret_cast<cItemFrame *> (a_Entity)); break;
- case cEntity::etLeashKnot: AddLeashKnotEntity (reinterpret_cast<cLeashKnot *> (a_Entity)); break;
- case cEntity::etPainting: AddPaintingEntity (reinterpret_cast<cPainting *> (a_Entity)); break;
+ case cEntity::etBoat: AddBoatEntity (static_cast<cBoat *> (a_Entity)); break;
+ case cEntity::etEnderCrystal: AddEnderCrystalEntity(static_cast<cEnderCrystal *> (a_Entity)); break;
+ case cEntity::etFallingBlock: AddFallingBlockEntity(static_cast<cFallingBlock *> (a_Entity)); break;
+ case cEntity::etMinecart: AddMinecartEntity (static_cast<cMinecart *> (a_Entity)); break;
+ case cEntity::etMonster: AddMonsterEntity (static_cast<cMonster *> (a_Entity)); break;
+ case cEntity::etPickup: AddPickupEntity (static_cast<cPickup *> (a_Entity)); break;
+ case cEntity::etProjectile: AddProjectileEntity (static_cast<cProjectileEntity *>(a_Entity)); break;
+ case cEntity::etTNT: AddTNTEntity (static_cast<cTNTEntity *> (a_Entity)); break;
+ case cEntity::etExpOrb: AddExpOrbEntity (static_cast<cExpOrb *> (a_Entity)); break;
+ case cEntity::etItemFrame: AddItemFrameEntity (static_cast<cItemFrame *> (a_Entity)); break;
+ case cEntity::etLeashKnot: AddLeashKnotEntity (static_cast<cLeashKnot *> (a_Entity)); break;
+ case cEntity::etPainting: AddPaintingEntity (static_cast<cPainting *> (a_Entity)); break;
case cEntity::etPlayer: return; // Players aren't saved into the world
case cEntity::etFloater: return; // Floaters aren't saved either
default:
@@ -1038,25 +1038,25 @@ void cNBTChunkSerializer::BlockEntity(cBlockEntity * a_Entity)
// Add tile-entity into NBT:
switch (a_Entity->GetBlockType())
{
- case E_BLOCK_BEACON: AddBeaconEntity (reinterpret_cast<cBeaconEntity *> (a_Entity)); break;
- case E_BLOCK_BED: AddBedEntity (reinterpret_cast<cBedEntity *> (a_Entity)); break;
- case E_BLOCK_BREWING_STAND: AddBrewingstandEntity(reinterpret_cast<cBrewingstandEntity *>(a_Entity)); break;
- case E_BLOCK_CHEST: AddChestEntity (reinterpret_cast<cChestEntity *> (a_Entity), a_Entity->GetBlockType()); break;
- case E_BLOCK_COMMAND_BLOCK: AddCommandBlockEntity(reinterpret_cast<cCommandBlockEntity *>(a_Entity)); break;
- case E_BLOCK_DISPENSER: AddDispenserEntity (reinterpret_cast<cDispenserEntity *> (a_Entity)); break;
- case E_BLOCK_DROPPER: AddDropperEntity (reinterpret_cast<cDropperEntity *> (a_Entity)); break;
+ case E_BLOCK_BEACON: AddBeaconEntity (static_cast<cBeaconEntity *> (a_Entity)); break;
+ case E_BLOCK_BED: AddBedEntity (static_cast<cBedEntity *> (a_Entity)); break;
+ case E_BLOCK_BREWING_STAND: AddBrewingstandEntity(static_cast<cBrewingstandEntity *>(a_Entity)); break;
+ case E_BLOCK_CHEST: AddChestEntity (static_cast<cChestEntity *> (a_Entity), a_Entity->GetBlockType()); break;
+ case E_BLOCK_COMMAND_BLOCK: AddCommandBlockEntity(static_cast<cCommandBlockEntity *>(a_Entity)); break;
+ case E_BLOCK_DISPENSER: AddDispenserEntity (static_cast<cDispenserEntity *> (a_Entity)); break;
+ case E_BLOCK_DROPPER: AddDropperEntity (static_cast<cDropperEntity *> (a_Entity)); break;
case E_BLOCK_ENDER_CHEST: /* No data to be saved */ break;
- case E_BLOCK_FLOWER_POT: AddFlowerPotEntity (reinterpret_cast<cFlowerPotEntity *> (a_Entity)); break;
- case E_BLOCK_FURNACE: AddFurnaceEntity (reinterpret_cast<cFurnaceEntity *> (a_Entity)); break;
- case E_BLOCK_HEAD: AddMobHeadEntity (reinterpret_cast<cMobHeadEntity *> (a_Entity)); break;
- case E_BLOCK_HOPPER: AddHopperEntity (reinterpret_cast<cHopperEntity *> (a_Entity)); break;
- case E_BLOCK_JUKEBOX: AddJukeboxEntity (reinterpret_cast<cJukeboxEntity *> (a_Entity)); break;
- case E_BLOCK_LIT_FURNACE: AddFurnaceEntity (reinterpret_cast<cFurnaceEntity *> (a_Entity)); break;
- case E_BLOCK_MOB_SPAWNER: AddMobSpawnerEntity (reinterpret_cast<cMobSpawnerEntity *> (a_Entity)); break;
- case E_BLOCK_NOTE_BLOCK: AddNoteEntity (reinterpret_cast<cNoteEntity *> (a_Entity)); break;
- case E_BLOCK_SIGN_POST: AddSignEntity (reinterpret_cast<cSignEntity *> (a_Entity)); break;
- case E_BLOCK_TRAPPED_CHEST: AddChestEntity (reinterpret_cast<cChestEntity *> (a_Entity), a_Entity->GetBlockType()); break;
- case E_BLOCK_WALLSIGN: AddSignEntity (reinterpret_cast<cSignEntity *> (a_Entity)); break;
+ case E_BLOCK_FLOWER_POT: AddFlowerPotEntity (static_cast<cFlowerPotEntity *> (a_Entity)); break;
+ case E_BLOCK_FURNACE: AddFurnaceEntity (static_cast<cFurnaceEntity *> (a_Entity)); break;
+ case E_BLOCK_HEAD: AddMobHeadEntity (static_cast<cMobHeadEntity *> (a_Entity)); break;
+ case E_BLOCK_HOPPER: AddHopperEntity (static_cast<cHopperEntity *> (a_Entity)); break;
+ case E_BLOCK_JUKEBOX: AddJukeboxEntity (static_cast<cJukeboxEntity *> (a_Entity)); break;
+ case E_BLOCK_LIT_FURNACE: AddFurnaceEntity (static_cast<cFurnaceEntity *> (a_Entity)); break;
+ case E_BLOCK_MOB_SPAWNER: AddMobSpawnerEntity (static_cast<cMobSpawnerEntity *> (a_Entity)); break;
+ case E_BLOCK_NOTE_BLOCK: AddNoteEntity (static_cast<cNoteEntity *> (a_Entity)); break;
+ case E_BLOCK_SIGN_POST: AddSignEntity (static_cast<cSignEntity *> (a_Entity)); break;
+ case E_BLOCK_TRAPPED_CHEST: AddChestEntity (static_cast<cChestEntity *> (a_Entity), a_Entity->GetBlockType()); break;
+ case E_BLOCK_WALLSIGN: AddSignEntity (static_cast<cSignEntity *> (a_Entity)); break;
default:
{
diff --git a/src/mbedTLS++/BlockingSslClientSocket.cpp b/src/mbedTLS++/BlockingSslClientSocket.cpp
index 9267975cb..e8f616258 100644
--- a/src/mbedTLS++/BlockingSslClientSocket.cpp
+++ b/src/mbedTLS++/BlockingSslClientSocket.cpp
@@ -208,7 +208,7 @@ bool cBlockingSslClientSocket::Send(const void * a_Data, size_t a_NumBytes)
}
// Keep sending the data until all of it is sent:
- const char * Data = reinterpret_cast<const char *>(a_Data);
+ const char * Data = static_cast<const char *>(a_Data);
size_t NumBytes = a_NumBytes;
for (;;)
{
diff --git a/src/mbedTLS++/CryptoKey.cpp b/src/mbedTLS++/CryptoKey.cpp
index 6615991d6..b0c0da167 100644
--- a/src/mbedTLS++/CryptoKey.cpp
+++ b/src/mbedTLS++/CryptoKey.cpp
@@ -109,7 +109,7 @@ int cCryptoKey::ParsePublic(const void * a_Data, size_t a_NumBytes)
{
ASSERT(!IsValid()); // Cannot parse a second key
- return mbedtls_pk_parse_public_key(&m_Pk, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes);
+ return mbedtls_pk_parse_public_key(&m_Pk, static_cast<const unsigned char *>(a_Data), a_NumBytes);
}
@@ -122,7 +122,7 @@ int cCryptoKey::ParsePrivate(const void * a_Data, size_t a_NumBytes, const AStri
ASSERT(!IsValid()); // Cannot parse a second key
// mbedTLS requires that PEM-encoded data is passed including the terminating NUL byte,
// and DER-encoded data is decoded properly even with an extra trailing NUL byte, so we simply add one to everything:
- AString keyData(reinterpret_cast<const char *>(a_Data), a_NumBytes);
+ AString keyData(static_cast<const char *>(a_Data), a_NumBytes);
if (a_Password.empty())
{
diff --git a/src/mbedTLS++/CtrDrbgContext.cpp b/src/mbedTLS++/CtrDrbgContext.cpp
index a2b9ee2dc..07f57001d 100644
--- a/src/mbedTLS++/CtrDrbgContext.cpp
+++ b/src/mbedTLS++/CtrDrbgContext.cpp
@@ -41,7 +41,7 @@ int cCtrDrbgContext::Initialize(const void * a_Custom, size_t a_CustomSize)
return 0;
}
- int res = mbedtls_ctr_drbg_seed(&m_CtrDrbg, mbedtls_entropy_func, &(m_EntropyContext->m_Entropy), reinterpret_cast<const unsigned char *>(a_Custom), a_CustomSize);
+ int res = mbedtls_ctr_drbg_seed(&m_CtrDrbg, mbedtls_entropy_func, &(m_EntropyContext->m_Entropy), static_cast<const unsigned char *>(a_Custom), a_CustomSize);
m_IsValid = (res == 0);
return res;
}
diff --git a/src/mbedTLS++/SslContext.cpp b/src/mbedTLS++/SslContext.cpp
index 679362c7a..d5b8525a6 100644
--- a/src/mbedTLS++/SslContext.cpp
+++ b/src/mbedTLS++/SslContext.cpp
@@ -104,7 +104,7 @@ int cSslContext::WritePlain(const void * a_Data, size_t a_NumBytes)
}
}
- return mbedtls_ssl_write(&m_Ssl, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes);
+ return mbedtls_ssl_write(&m_Ssl, static_cast<const unsigned char *>(a_Data), a_NumBytes);
}
@@ -123,7 +123,7 @@ int cSslContext::ReadPlain(void * a_Data, size_t a_MaxBytes)
}
}
- return mbedtls_ssl_read(&m_Ssl, reinterpret_cast<unsigned char *>(a_Data), a_MaxBytes);
+ return mbedtls_ssl_read(&m_Ssl, static_cast<unsigned char *>(a_Data), a_MaxBytes);
}
diff --git a/src/mbedTLS++/SslContext.h b/src/mbedTLS++/SslContext.h
index d015b6587..033749bf3 100644
--- a/src/mbedTLS++/SslContext.h
+++ b/src/mbedTLS++/SslContext.h
@@ -103,13 +103,13 @@ protected:
/** The callback used by mbedTLS when it wants to read encrypted data. */
static int ReceiveEncrypted(void * a_This, unsigned char * a_Buffer, size_t a_NumBytes)
{
- return (reinterpret_cast<cSslContext *>(a_This))->ReceiveEncrypted(a_Buffer, a_NumBytes);
+ return (static_cast<cSslContext *>(a_This))->ReceiveEncrypted(a_Buffer, a_NumBytes);
}
/** The callback used by mbedTLS when it wants to write encrypted data. */
static int SendEncrypted(void * a_This, const unsigned char * a_Buffer, size_t a_NumBytes)
{
- return (reinterpret_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes);
+ return (static_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes);
}
/** Called when mbedTLS wants to read encrypted data. */
diff --git a/src/mbedTLS++/X509Cert.cpp b/src/mbedTLS++/X509Cert.cpp
index 7bcfec415..e7484af3b 100644
--- a/src/mbedTLS++/X509Cert.cpp
+++ b/src/mbedTLS++/X509Cert.cpp
@@ -32,7 +32,7 @@ int cX509Cert::Parse(const void * a_CertContents, size_t a_Size)
{
// mbedTLS requires that PEM-encoded data is passed including the terminating NUL byte,
// and DER-encoded data is decoded properly even with an extra trailing NUL byte, so we simply add one to everything:
- AString certContents(reinterpret_cast<const char *>(a_CertContents), a_Size);
+ AString certContents(static_cast<const char *>(a_CertContents), a_Size);
return mbedtls_x509_crt_parse(&m_Cert, reinterpret_cast<const unsigned char *>(certContents.data()), a_Size + 1);
}