summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2015-07-29 17:04:03 +0200
committerSamuel Barney <samjbarney@gmail.com>2015-07-29 17:49:30 +0200
commit804805d35a87c2acc9425d1762ad26b1ba2ec9ac (patch)
tree13b603c8bbf8177da92ce87f5413fb646d204f3f /src/Entities
parentMerge pull request #2376 from mjhanninen/fix-freebsd-build (diff)
downloadcuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.gz
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.bz2
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.lz
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.xz
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.zst
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/ArrowEntity.cpp10
-rw-r--r--src/Entities/CMakeLists.txt10
-rw-r--r--src/Entities/Entity.cpp98
-rw-r--r--src/Entities/EntityEffect.cpp42
-rw-r--r--src/Entities/Floater.cpp19
-rw-r--r--src/Entities/Floater.h10
-rw-r--r--src/Entities/Minecart.h2
-rw-r--r--src/Entities/Player.cpp44
-rw-r--r--src/Entities/Player.h6
9 files changed, 120 insertions, 121 deletions
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index 492cf2a56..76b4c9758 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -86,7 +86,7 @@ void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFa
m_HitBlockPos = Vector3i(X, Y, Z);
// Broadcast arrow hit sound
- m_World->BroadcastSoundEffect("random.bowhit", (double)X, (double)Y, (double)Z, 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
+ m_World->BroadcastSoundEffect("random.bowhit", static_cast<double>(X), static_cast<double>(Y), static_cast<double>(Z), 0.5f, static_cast<float>(0.75 + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
if ((m_World->GetBlock(Hit) == E_BLOCK_TNT) && IsOnFire())
{
@@ -102,7 +102,7 @@ void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFa
void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{
- int Damage = (int)(GetSpeed().Length() / 20 * m_DamageCoeff + 0.5);
+ int Damage = static_cast<int>(GetSpeed().Length() / 20 * m_DamageCoeff + 0.5);
if (m_IsCritical)
{
Damage += m_World->GetTickRandomNumber(Damage / 2 + 2);
@@ -111,7 +111,7 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
unsigned int PowerLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPower);
if (PowerLevel > 0)
{
- int ExtraDamage = (int)ceil(0.25 * (PowerLevel + 1));
+ int ExtraDamage = static_cast<int>(ceil(0.25 * (PowerLevel + 1)));
Damage += ExtraDamage;
}
@@ -139,7 +139,7 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
}
// Broadcast successful hit sound
- GetWorld()->BroadcastSoundEffect("random.successful_hit", GetPosX(), GetPosY(), GetPosZ(), 0.5, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
+ GetWorld()->BroadcastSoundEffect("random.successful_hit", GetPosX(), GetPosY(), GetPosZ(), 0.5, static_cast<float>(0.75 + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
Destroy();
}
@@ -164,7 +164,7 @@ void cArrowEntity::CollectedBy(cPlayer & a_Dest)
}
GetWorld()->BroadcastCollectEntity(*this, a_Dest);
- GetWorld()->BroadcastSoundEffect("random.pop", GetPosX(), GetPosY(), GetPosZ(), 0.5, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
+ GetWorld()->BroadcastSoundEffect("random.pop", GetPosX(), GetPosY(), GetPosZ(), 0.5, static_cast<float>(0.75 + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
m_bIsCollected = true;
}
}
diff --git a/src/Entities/CMakeLists.txt b/src/Entities/CMakeLists.txt
index 7261e85c0..54cca9c90 100644
--- a/src/Entities/CMakeLists.txt
+++ b/src/Entities/CMakeLists.txt
@@ -61,15 +61,13 @@ SET (HDRS
WitherSkullEntity.h)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set_source_files_properties(ArrowEntity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
- set_source_files_properties(Entity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=global-constructors -Wno-error=switch-enum -Wno-error=old-style-cast")
- set_source_files_properties(EntityEffect.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
- set_source_files_properties(Floater.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=old-style-cast")
- set_source_files_properties(Player.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=switch-enum -Wno-error=conversion -Wno-error=old-style-cast")
+ set_source_files_properties(Entity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=global-constructors -Wno-error=switch-enum ")
+ set_source_files_properties(EntityEffect.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum ")
+ set_source_files_properties(Floater.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion ")
+ set_source_files_properties(Player.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=switch-enum -Wno-error=conversion ")
endif()
if(NOT MSVC)
add_library(Entities ${SRCS} ${HDRS})
-
target_link_libraries(Entities WorldStorage)
endif()
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index bb9d3c44b..23cc487f6 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -313,7 +313,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
if ((a_TDI.Attacker != nullptr) && (a_TDI.Attacker->IsPlayer()))
{
- cPlayer * Player = (cPlayer *)a_TDI.Attacker;
+ cPlayer * Player = reinterpret_cast<cPlayer *>(a_TDI.Attacker);
Player->GetEquippedItem().GetHandler()->OnEntityAttack(Player, this);
@@ -321,19 +321,19 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
// TODO: Better damage increase, and check for enchantments (and use magic critical instead of plain)
const cEnchantments & Enchantments = Player->GetEquippedItem().m_Enchantments;
- int SharpnessLevel = Enchantments.GetLevel(cEnchantments::enchSharpness);
- int SmiteLevel = Enchantments.GetLevel(cEnchantments::enchSmite);
- int BaneOfArthropodsLevel = Enchantments.GetLevel(cEnchantments::enchBaneOfArthropods);
+ int SharpnessLevel = static_cast<int>(Enchantments.GetLevel(cEnchantments::enchSharpness));
+ int SmiteLevel = static_cast<int>(Enchantments.GetLevel(cEnchantments::enchSmite));
+ int BaneOfArthropodsLevel = static_cast<int>(Enchantments.GetLevel(cEnchantments::enchBaneOfArthropods));
if (SharpnessLevel > 0)
{
- a_TDI.FinalDamage += (int)ceil(1.25 * SharpnessLevel);
+ a_TDI.FinalDamage += static_cast<int>(ceil(1.25 * SharpnessLevel));
}
else if (SmiteLevel > 0)
{
if (IsMob())
{
- cMonster * Monster = (cMonster *)this;
+ cMonster * Monster = reinterpret_cast<cMonster *>(this);
switch (Monster->GetMobType())
{
case mtSkeleton:
@@ -341,7 +341,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
case mtWither:
case mtZombiePigman:
{
- a_TDI.FinalDamage += (int)ceil(2.5 * SmiteLevel);
+ a_TDI.FinalDamage += static_cast<int>(ceil(2.5 * SmiteLevel));
break;
}
default: break;
@@ -352,14 +352,14 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
{
if (IsMob())
{
- cMonster * Monster = (cMonster *)this;
+ cMonster * Monster = reinterpret_cast<cMonster *>(this);
switch (Monster->GetMobType())
{
case mtSpider:
case mtCaveSpider:
case mtSilverfish:
{
- a_TDI.RawDamage += (int)ceil(2.5 * BaneOfArthropodsLevel);
+ a_TDI.RawDamage += static_cast<int>(ceil(2.5 * BaneOfArthropodsLevel));
// TODO: Add slowness effect
break;
@@ -369,7 +369,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
}
}
- int FireAspectLevel = Enchantments.GetLevel(cEnchantments::enchFireAspect);
+ int FireAspectLevel = static_cast<int>(Enchantments.GetLevel(cEnchantments::enchFireAspect));
if (FireAspectLevel > 0)
{
int BurnTicks = 3;
@@ -384,7 +384,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
}
else if (IsMob() && !IsSubmerged() && !IsSwimming())
{
- cMonster * Monster = (cMonster *)this;
+ cMonster * Monster = reinterpret_cast<cMonster *>(this);
switch (Monster->GetMobType())
{
case mtGhast:
@@ -408,7 +408,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
if (ThornsLevel > 0)
{
- int Chance = ThornsLevel * 15;
+ int Chance = static_cast<int>(ThornsLevel * 15);
cFastRandom Random;
int RandomValue = Random.GenerateRandomInteger(0, 100);
@@ -428,7 +428,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
}
}
- Player->GetStatManager().AddValue(statDamageDealt, (StatValue)floor(a_TDI.FinalDamage * 10 + 0.5));
+ Player->GetStatManager().AddValue(statDamageDealt, static_cast<StatValue>(floor(a_TDI.FinalDamage * 10 + 0.5)));
}
if (IsPlayer())
@@ -444,31 +444,31 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
for (size_t i = 0; i < ARRAYCOUNT(ArmorItems); i++)
{
const cItem & Item = ArmorItems[i];
- int Level = Item.m_Enchantments.GetLevel(cEnchantments::enchProtection);
+ int Level = static_cast<int>(Item.m_Enchantments.GetLevel(cEnchantments::enchProtection));
if (Level > 0)
{
EPFProtection += (6 + Level * Level) * 0.75 / 3;
}
- Level = Item.m_Enchantments.GetLevel(cEnchantments::enchFireProtection);
+ Level = static_cast<int>(Item.m_Enchantments.GetLevel(cEnchantments::enchFireProtection));
if (Level > 0)
{
EPFFireProtection += (6 + Level * Level) * 1.25 / 3;
}
- Level = Item.m_Enchantments.GetLevel(cEnchantments::enchFeatherFalling);
+ Level = static_cast<int>(Item.m_Enchantments.GetLevel(cEnchantments::enchFeatherFalling));
if (Level > 0)
{
EPFFeatherFalling += (6 + Level * Level) * 2.5 / 3;
}
- Level = Item.m_Enchantments.GetLevel(cEnchantments::enchBlastProtection);
+ Level = static_cast<int>(Item.m_Enchantments.GetLevel(cEnchantments::enchBlastProtection));
if (Level > 0)
{
EPFBlastProtection += (6 + Level * Level) * 1.5 / 3;
}
- Level = Item.m_Enchantments.GetLevel(cEnchantments::enchProjectileProtection);
+ Level = static_cast<int>(Item.m_Enchantments.GetLevel(cEnchantments::enchProjectileProtection));
if (Level > 0)
{
EPFProjectileProtection += (6 + Level * Level) * 1.5 / 3;
@@ -509,27 +509,27 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
if ((a_TDI.DamageType != dtInVoid) && (a_TDI.DamageType != dtAdmin))
{
- RemovedDamage += (int)ceil(EPFProtection * 0.04 * a_TDI.FinalDamage);
+ RemovedDamage += CeilC(EPFProtection * 0.04 * a_TDI.FinalDamage);
}
if ((a_TDI.DamageType == dtFalling) || (a_TDI.DamageType == dtFall) || (a_TDI.DamageType == dtEnderPearl))
{
- RemovedDamage += (int)ceil(EPFFeatherFalling * 0.04 * a_TDI.FinalDamage);
+ RemovedDamage += CeilC(EPFFeatherFalling * 0.04 * a_TDI.FinalDamage);
}
if (a_TDI.DamageType == dtBurning)
{
- RemovedDamage += (int)ceil(EPFFireProtection * 0.04 * a_TDI.FinalDamage);
+ RemovedDamage += CeilC(EPFFireProtection * 0.04 * a_TDI.FinalDamage);
}
if (a_TDI.DamageType == dtExplosion)
{
- RemovedDamage += (int)ceil(EPFBlastProtection * 0.04 * a_TDI.FinalDamage);
+ RemovedDamage += CeilC(EPFBlastProtection * 0.04 * a_TDI.FinalDamage);
}
if (a_TDI.DamageType == dtProjectile)
{
- RemovedDamage += (int)ceil(EPFBlastProtection * 0.04 * a_TDI.FinalDamage);
+ RemovedDamage += CeilC(EPFBlastProtection * 0.04 * a_TDI.FinalDamage);
}
if (a_TDI.FinalDamage < RemovedDamage)
@@ -540,7 +540,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
a_TDI.FinalDamage -= RemovedDamage;
}
- m_Health -= (short)a_TDI.FinalDamage;
+ m_Health -= static_cast<short>(a_TDI.FinalDamage);
// TODO: Apply damage to armor
@@ -549,11 +549,11 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
// Add knockback:
if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != nullptr))
{
- int KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback); // More common enchantment
+ int KnockbackLevel = static_cast<int>(a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback)); // More common enchantment
if (KnockbackLevel < 1)
{
// We support punch on swords and vice versa! :)
- KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPunch);
+ KnockbackLevel = static_cast<int>(a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPunch));
}
Vector3d AdditionalSpeed(0, 0, 0);
@@ -800,7 +800,7 @@ void cEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
if (IsPlayer())
{
- cPlayer * Player = (cPlayer *)this;
+ cPlayer * Player = reinterpret_cast<cPlayer *>(this);
Player->UpdateMovementStats(DeltaPos);
}
}
@@ -1013,7 +1013,7 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
cTracer Tracer(GetWorld());
// Distance traced is an integer, so we round up from the distance we should go (Speed * Delta), else we will encounter collision detection failurse
- int DistanceToTrace = (int)(ceil((NextSpeed * DtSec.count()).SqrLength()) * 2);
+ int DistanceToTrace = CeilC((NextSpeed * DtSec.count()).SqrLength()) * 2;
bool HasHit = Tracer.Trace(NextPos, NextSpeed, DistanceToTrace);
if (HasHit)
@@ -1123,12 +1123,12 @@ void cEntity::TickBurning(cChunk & a_Chunk)
}
// Update the burning times, based on surroundings:
- int MinRelX = (int)floor(GetPosX() - m_Width / 2) - a_Chunk.GetPosX() * cChunkDef::Width;
- int MaxRelX = (int)floor(GetPosX() + m_Width / 2) - a_Chunk.GetPosX() * cChunkDef::Width;
- int MinRelZ = (int)floor(GetPosZ() - m_Width / 2) - a_Chunk.GetPosZ() * cChunkDef::Width;
- int MaxRelZ = (int)floor(GetPosZ() + m_Width / 2) - a_Chunk.GetPosZ() * cChunkDef::Width;
- int MinY = std::max(0, std::min(cChunkDef::Height - 1, POSY_TOINT));
- int MaxY = std::max(0, std::min(cChunkDef::Height - 1, (int)ceil (GetPosY() + m_Height)));
+ int MinRelX = FloorC(GetPosX() - m_Width / 2) - a_Chunk.GetPosX() * cChunkDef::Width;
+ int MaxRelX = FloorC(GetPosX() + m_Width / 2) - a_Chunk.GetPosX() * cChunkDef::Width;
+ int MinRelZ = FloorC(GetPosZ() - m_Width / 2) - a_Chunk.GetPosZ() * cChunkDef::Width;
+ int MaxRelZ = FloorC(GetPosZ() + m_Width / 2) - a_Chunk.GetPosZ() * cChunkDef::Width;
+ int MinY = Clamp(POSY_TOINT, 0, cChunkDef::Height - 1);
+ int MaxY = Clamp(CeilC(GetPosY() + m_Height), 0, cChunkDef::Height - 1);
bool HasWater = false;
bool HasLava = false;
bool HasFire = false;
@@ -1325,7 +1325,7 @@ bool cEntity::DetectPortal()
return false;
}
- if (IsPlayer() && !((cPlayer *)this)->IsGameModeCreative() && (m_PortalCooldownData.m_TicksDelayed != 80))
+ if (IsPlayer() && !(reinterpret_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++;
@@ -1345,7 +1345,7 @@ bool cEntity::DetectPortal()
if (IsPlayer())
{
// Send a respawn packet before world is loaded / generated so the client isn't left in limbo
- ((cPlayer *)this)->GetClientHandle()->SendRespawn(dimOverworld);
+ (reinterpret_cast<cPlayer *>(this))->GetClientHandle()->SendRespawn(dimOverworld);
}
Vector3d TargetPos = GetPosition();
@@ -1368,8 +1368,8 @@ bool cEntity::DetectPortal()
if (IsPlayer())
{
- ((cPlayer *)this)->AwardAchievement(achEnterPortal);
- ((cPlayer *)this)->GetClientHandle()->SendRespawn(dimNether);
+ reinterpret_cast<cPlayer *>(this)->AwardAchievement(achEnterPortal);
+ reinterpret_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(dimNether);
}
Vector3d TargetPos = GetPosition();
@@ -1401,7 +1401,7 @@ bool cEntity::DetectPortal()
if (IsPlayer())
{
- cPlayer * Player = (cPlayer *)this;
+ cPlayer * Player = reinterpret_cast<cPlayer *>(this);
Player->TeleportToCoords(Player->GetLastBedPos().x, Player->GetLastBedPos().y, Player->GetLastBedPos().z);
Player->GetClientHandle()->SendRespawn(dimOverworld);
}
@@ -1419,8 +1419,8 @@ bool cEntity::DetectPortal()
if (IsPlayer())
{
- ((cPlayer *)this)->AwardAchievement(achEnterTheEnd);
- ((cPlayer *)this)->GetClientHandle()->SendRespawn(dimEnd);
+ reinterpret_cast<cPlayer *>(this)->AwardAchievement(achEnterTheEnd);
+ reinterpret_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(dimEnd);
}
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedEndWorldName(), dimEnd, GetWorld()->GetName()), false);
@@ -1498,7 +1498,7 @@ bool cEntity::MoveToWorld(const AString & a_WorldName, bool a_ShouldSendRespawn)
void cEntity::SetSwimState(cChunk & a_Chunk)
{
- int RelY = (int)floor(GetPosY() + 0.1);
+ int RelY = FloorC(GetPosY() + 0.1);
if ((RelY < 0) || (RelY >= cChunkDef::Height - 1))
{
m_IsSwimming = false;
@@ -1550,7 +1550,7 @@ void cEntity::HandleAir(void)
// See if the entity is /submerged/ water (block above is water)
// Get the type of block the entity is standing in:
- int RespirationLevel = GetEquippedHelmet().m_Enchantments.GetLevel(cEnchantments::enchRespiration);
+ int RespirationLevel = static_cast<int>(GetEquippedHelmet().m_Enchantments.GetLevel(cEnchantments::enchRespiration));
if (IsSubmerged())
{
@@ -1561,7 +1561,7 @@ void cEntity::HandleAir(void)
if (RespirationLevel > 0)
{
- ((cPawn *)this)->AddEntityEffect(cEntityEffect::effNightVision, 200, 5, 0);
+ reinterpret_cast<cPawn *>(this)->AddEntityEffect(cEntityEffect::effNightVision, 200, 5, 0);
}
if (m_AirLevel <= 0)
@@ -1733,9 +1733,9 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude)
}
// TODO: Pickups move disgracefully if relative move packets are sent as opposed to just velocity. Have a system to send relmove only when SetPosXXX() is called with a large difference in position
- int DiffX = (int)(floor(GetPosX() * 32.0) - floor(m_LastPos.x * 32.0));
- int DiffY = (int)(floor(GetPosY() * 32.0) - floor(m_LastPos.y * 32.0));
- int DiffZ = (int)(floor(GetPosZ() * 32.0) - floor(m_LastPos.z * 32.0));
+ int DiffX = FloorC(GetPosX() * 32.0) - FloorC(m_LastPos.x * 32.0);
+ int DiffY = FloorC(GetPosY() * 32.0) - FloorC(m_LastPos.y * 32.0);
+ int DiffZ = FloorC(GetPosZ() * 32.0) - FloorC(m_LastPos.z * 32.0);
if ((DiffX != 0) || (DiffY != 0) || (DiffZ != 0)) // Have we moved?
{
@@ -1744,12 +1744,12 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude)
// Difference within Byte limitations, use a relative move packet
if (m_bDirtyOrientation)
{
- m_World->BroadcastEntityRelMoveLook(*this, (char)DiffX, (char)DiffY, (char)DiffZ, a_Exclude);
+ m_World->BroadcastEntityRelMoveLook(*this, static_cast<char>(DiffX), static_cast<char>(DiffY), static_cast<char>(DiffZ), a_Exclude);
m_bDirtyOrientation = false;
}
else
{
- m_World->BroadcastEntityRelMove(*this, (char)DiffX, (char)DiffY, (char)DiffZ, a_Exclude);
+ m_World->BroadcastEntityRelMove(*this, static_cast<char>(DiffX), static_cast<char>(DiffY), static_cast<char>(DiffZ), a_Exclude);
}
// Clients seem to store two positions, one for the velocity packet and one for the teleport / relmove packet
// The latter is only changed with a relmove / teleport, and m_LastPos stores this position
diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp
index c8be414d4..214cbcc2b 100644
--- a/src/Entities/EntityEffect.cpp
+++ b/src/Entities/EntityEffect.cpp
@@ -114,7 +114,7 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage)
// http://minecraft.gamepedia.com/Data_values#.22Extended_duration.22_bit
// http://minecraft.gamepedia.com/Data_values#.22Splash_potion.22_bit
- return (int)(base * TierCoeff * ExtCoeff * SplashCoeff);
+ return static_cast<int>(base * TierCoeff * ExtCoeff * SplashCoeff);
}
@@ -240,12 +240,12 @@ void cEntityEffectSpeed::OnActivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
- cMonster * Mob = (cMonster*) &a_Target;
+ cMonster * Mob = reinterpret_cast<cMonster*>(&a_Target);
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() + 0.2 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
- cPlayer * Player = (cPlayer*) &a_Target;
+ cPlayer * Player = reinterpret_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);
@@ -260,12 +260,12 @@ void cEntityEffectSpeed::OnDeactivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
- cMonster * Mob = (cMonster*) &a_Target;
+ cMonster * Mob = reinterpret_cast<cMonster*>(&a_Target);
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() - 0.2 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
- cPlayer * Player = (cPlayer*) &a_Target;
+ cPlayer * Player = reinterpret_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);
@@ -283,12 +283,12 @@ void cEntityEffectSlowness::OnActivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
- cMonster * Mob = (cMonster*) &a_Target;
+ cMonster * Mob = static_cast<cMonster*>(&a_Target);
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() - 0.15 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
- cPlayer * Player = (cPlayer*) &a_Target;
+ cPlayer * Player = static_cast<cPlayer*>(&a_Target);
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() - 0.15 * m_Intensity);
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() - 0.195 * m_Intensity);
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() - 0.15 * m_Intensity);
@@ -303,12 +303,12 @@ void cEntityEffectSlowness::OnDeactivate(cPawn & a_Target)
{
if (a_Target.IsMob())
{
- cMonster * Mob = (cMonster*) &a_Target;
+ cMonster * Mob = static_cast<cMonster*>(&a_Target);
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() + 0.15 * m_Intensity);
}
else if (a_Target.IsPlayer())
{
- cPlayer * Player = (cPlayer*) &a_Target;
+ cPlayer * Player = static_cast<cPlayer*>(&a_Target);
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() + 0.15 * m_Intensity);
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() + 0.195 * m_Intensity);
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() + 0.15 * m_Intensity);
@@ -325,9 +325,9 @@ void cEntityEffectSlowness::OnDeactivate(cPawn & a_Target)
void cEntityEffectInstantHealth::OnActivate(cPawn & a_Target)
{
// Base amount = 6, doubles for every increase in intensity
- int amount = (int)(6 * (1 << m_Intensity) * m_DistanceModifier);
+ int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
- if (a_Target.IsMob() && ((cMonster &) a_Target).IsUndead())
+ if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
{
a_Target.TakeDamage(dtPotionOfHarming, nullptr, amount, 0); // TODO: Store attacker in a pointer-safe way, pass to TakeDamage
return;
@@ -345,9 +345,9 @@ void cEntityEffectInstantHealth::OnActivate(cPawn & a_Target)
void cEntityEffectInstantDamage::OnActivate(cPawn & a_Target)
{
// Base amount = 6, doubles for every increase in intensity
- int amount = (int)(6 * (1 << m_Intensity) * m_DistanceModifier);
+ int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
- if (a_Target.IsMob() && ((cMonster &) a_Target).IsUndead())
+ if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
{
a_Target.Heal(amount);
return;
@@ -366,13 +366,13 @@ void cEntityEffectRegeneration::OnTick(cPawn & a_Target)
{
super::OnTick(a_Target);
- if (a_Target.IsMob() && ((cMonster &) a_Target).IsUndead())
+ if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
{
return;
}
// Regen frequency = 50 ticks, divided by potion level (Regen II = 25 ticks)
- int frequency = (int) std::floor(50.0 / (double)(m_Intensity + 1));
+ int frequency = FloorC(50.0 / static_cast<double>(m_Intensity + 1));
if ((m_Ticks % frequency) != 0)
{
@@ -395,8 +395,8 @@ void cEntityEffectHunger::OnTick(cPawn & a_Target)
if (a_Target.IsPlayer())
{
- cPlayer & Target = (cPlayer &) a_Target;
- Target.AddFoodExhaustion(0.025 * ((double)GetIntensity() + 1.0)); // 0.5 per second = 0.025 per tick
+ cPlayer & Target = reinterpret_cast<cPlayer &>(a_Target);
+ Target.AddFoodExhaustion(0.025 * (static_cast<double>(GetIntensity()) + 1.0)); // 0.5 per second = 0.025 per tick
}
}
@@ -431,7 +431,7 @@ void cEntityEffectPoison::OnTick(cPawn & a_Target)
if (a_Target.IsMob())
{
- cMonster & Target = (cMonster &) a_Target;
+ cMonster & Target = reinterpret_cast<cMonster &>(a_Target);
// Doesn't effect undead mobs, spiders
if (
@@ -445,7 +445,7 @@ void cEntityEffectPoison::OnTick(cPawn & a_Target)
}
// Poison frequency = 25 ticks, divided by potion level (Poison II = 12 ticks)
- int frequency = (int) std::floor(25.0 / (double)(m_Intensity + 1));
+ int frequency = FloorC(25.0 / static_cast<double>(m_Intensity + 1));
if ((m_Ticks % frequency) == 0)
{
@@ -469,7 +469,7 @@ void cEntityEffectWither::OnTick(cPawn & a_Target)
super::OnTick(a_Target);
// Damage frequency = 40 ticks, divided by effect level (Wither II = 20 ticks)
- int frequency = (int) std::floor(25.0 / (double)(m_Intensity + 1));
+ int frequency = FloorC(25.0 / static_cast<double>(m_Intensity + 1));
if ((m_Ticks % frequency) == 0)
{
@@ -488,7 +488,7 @@ void cEntityEffectSaturation::OnTick(cPawn & a_Target)
{
if (a_Target.IsPlayer())
{
- cPlayer & Target = (cPlayer &) a_Target;
+ cPlayer & Target = reinterpret_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/Floater.cpp b/src/Entities/Floater.cpp
index 0c868270d..c9e8167ee 100644
--- a/src/Entities/Floater.cpp
+++ b/src/Entities/Floater.cpp
@@ -101,13 +101,13 @@ protected:
-cFloater::cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, int a_PlayerID, int a_CountDownTime) :
+cFloater::cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime) :
cEntity(etFloater, a_X, a_Y, a_Z, 0.2, 0.2),
m_CanPickupItem(false),
m_PickupCountDown(0),
m_CountDownTime(a_CountDownTime),
m_PlayerID(a_PlayerID),
- m_AttachedMobID(-1)
+ m_AttachedMobID(cEntity::INVALID_ID)
{
SetSpeed(a_Speed);
}
@@ -118,7 +118,7 @@ cFloater::cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, int a_P
void cFloater::SpawnOn(cClientHandle & a_Client)
{
- a_Client.SendSpawnObject(*this, 90, m_PlayerID, 0, 0);
+ a_Client.SendSpawnObject(*this, 90, static_cast<int>(m_PlayerID), 0, 0);
}
@@ -128,9 +128,10 @@ void cFloater::SpawnOn(cClientHandle & a_Client)
void cFloater::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
HandlePhysics(a_Dt, a_Chunk);
- if (IsBlockWater(m_World->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ())) && m_World->GetBlockMeta((int) GetPosX(), (int) GetPosY(), (int) GetPosZ()) == 0)
+ if (IsBlockWater(m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT))
+ && (m_World->GetBlockMeta(POSX_TOINT, POSY_TOINT, POSX_TOINT) == 0))
{
- if ((!m_CanPickupItem) && (m_AttachedMobID == -1)) // Check if you can't already pickup a fish and if the floater isn't attached to a mob.
+ if ((!m_CanPickupItem) && (m_AttachedMobID == cEntity::INVALID_ID)) // Check if you can't already pickup a fish and if the floater isn't attached to a mob.
{
if (m_CountDownTime <= 0)
{
@@ -154,7 +155,7 @@ void cFloater::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
m_CountDownTime--;
- if (m_World->GetHeight((int) GetPosX(), (int) GetPosZ()) == (int) GetPosY())
+ if (m_World->GetHeight(POSX_TOINT, POSY_TOINT) == POSZ_TOINT)
{
if (m_World->IsWeatherWet() && m_World->GetTickRandomNumber(3) == 0) // 25% chance of an extra countdown when being rained on.
{
@@ -182,7 +183,7 @@ void cFloater::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
}
- if ((GetSpeed().Length() > 4) && (m_AttachedMobID == -1))
+ if ((GetSpeed().Length() > 4) && (m_AttachedMobID == cEntity::INVALID_ID))
{
cFloaterEntityCollisionCallback Callback(this, GetPosition(), GetPosition() + GetSpeed() / 20);
@@ -202,12 +203,12 @@ void cFloater::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
Destroy(true);
}
- if (m_AttachedMobID != -1)
+ if (m_AttachedMobID != cEntity::INVALID_ID)
{
m_World->DoWithEntityByID(m_AttachedMobID, EntityCallback); // The mob the floater was attached to doesn't exist anymore.
if (!EntityCallback.DoesExist())
{
- m_AttachedMobID = -1;
+ m_AttachedMobID = cEntity::INVALID_ID;
}
}
diff --git a/src/Entities/Floater.h b/src/Entities/Floater.h
index d5715f89e..e7818c915 100644
--- a/src/Entities/Floater.h
+++ b/src/Entities/Floater.h
@@ -18,15 +18,15 @@ public:
CLASS_PROTODEF(cFloater)
- cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, int a_PlayerID, int a_CountDownTime);
+ cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime);
virtual void SpawnOn(cClientHandle & a_Client) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
// tolua_begin
bool CanPickup(void) const { return m_CanPickupItem; }
- int GetOwnerID(void) const { return m_PlayerID; }
- int GetAttachedMobID(void) const { return m_AttachedMobID; }
+ UInt32 GetOwnerID(void) const { return m_PlayerID; }
+ UInt32 GetAttachedMobID(void) const { return m_AttachedMobID; }
// tolua_end
protected:
@@ -41,6 +41,6 @@ protected:
int m_CountDownTime;
// Entity IDs
- int m_PlayerID;
- int m_AttachedMobID;
+ UInt32 m_PlayerID;
+ UInt32 m_AttachedMobID;
} ; // tolua_export
diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h
index 05eaf16e9..1ae4e1359 100644
--- a/src/Entities/Minecart.h
+++ b/src/Entities/Minecart.h
@@ -127,7 +127,7 @@ public:
};
const cItem & GetSlot(int a_Idx) const { return m_Contents.GetSlot(a_Idx); }
- void SetSlot(size_t a_Idx, const cItem & a_Item) { m_Contents.SetSlot(static_cast<int>(a_Idx), a_Item); }
+ void SetSlot(int a_Idx, const cItem & a_Item) { m_Contents.SetSlot(a_Idx, a_Item); }
protected:
cItemGrid m_Contents;
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 3a9360d1e..40754f6d9 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -82,7 +82,7 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) :
m_bDirtyExperience(false),
m_IsChargingBow(false),
m_BowCharge(0),
- m_FloaterID(-1),
+ m_FloaterID(cEntity::INVALID_ID),
m_Team(nullptr),
m_TicksUntilNextSave(PLAYER_INVENTORY_SAVE_INTERVAL),
m_bIsTeleporting(false),
@@ -508,7 +508,7 @@ void cPlayer::SetTouchGround(bool a_bTouchGround)
if (Dist >= 2.0) // At least two blocks - TODO: Use m_LastJumpHeight instead of m_LastGroundHeight above
{
// Increment statistic
- m_Stats.AddValue(statDistFallen, (StatValue)floor(Dist * 100 + 0.5));
+ m_Stats.AddValue(statDistFallen, FloorC<StatValue>(Dist * 100 + 0.5));
}
int Damage = static_cast<int>(Dist - 3.f);
@@ -878,7 +878,7 @@ bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
if ((a_TDI.Attacker != nullptr) && (a_TDI.Attacker->IsPlayer()))
{
- cPlayer * Attacker = (cPlayer *)a_TDI.Attacker;
+ cPlayer * Attacker = reinterpret_cast<cPlayer *>(a_TDI.Attacker);
if ((m_Team != nullptr) && (m_Team == Attacker->m_Team))
{
@@ -896,7 +896,7 @@ bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
AddFoodExhaustion(0.3f);
SendHealth();
- m_Stats.AddValue(statDamageTaken, (StatValue)floor(a_TDI.FinalDamage * 10 + 0.5));
+ m_Stats.AddValue(statDamageTaken, FloorC<StatValue>(a_TDI.FinalDamage * 10 + 0.5));
return true;
}
return false;
@@ -926,7 +926,7 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
{
Pickups.Add(cItem(E_ITEM_RED_APPLE));
}
- m_Stats.AddValue(statItemsDropped, (StatValue)Pickups.Size());
+ m_Stats.AddValue(statItemsDropped, static_cast<StatValue>(Pickups.Size()));
m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10);
SaveToDisk(); // Save it, yeah the world is a tough place !
@@ -969,7 +969,7 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
}
else if (a_TDI.Attacker->IsPlayer())
{
- cPlayer * Killer = (cPlayer *)a_TDI.Attacker;
+ cPlayer * Killer = reinterpret_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(""))
@@ -1010,7 +1010,7 @@ void cPlayer::Killed(cEntity * a_Victim)
}
else if (a_Victim->IsMob())
{
- if (((cMonster *)a_Victim)->GetMobFamily() == cMonster::mfHostile)
+ if (reinterpret_cast<cMonster *>(a_Victim)->GetMobFamily() == cMonster::mfHostile)
{
AwardAchievement(achKillMonster);
}
@@ -1293,7 +1293,7 @@ unsigned int cPlayer::AwardAchievement(const eStatistic a_Ach)
if (Old > 0)
{
- return m_Stats.AddValue(a_Ach);
+ return static_cast<unsigned int>(m_Stats.AddValue(a_Ach));
}
else
{
@@ -1311,7 +1311,7 @@ unsigned int cPlayer::AwardAchievement(const eStatistic a_Ach)
// Achievement Get!
m_ClientHandle->SendStatistics(m_Stats);
- return New;
+ return static_cast<unsigned int>(New);
}
}
@@ -1630,7 +1630,7 @@ void cPlayer::TossItems(const cItems & a_Items)
return;
}
- m_Stats.AddValue(statItemsDropped, (StatValue)a_Items.Size());
+ m_Stats.AddValue(statItemsDropped, static_cast<StatValue>(a_Items.Size()));
double vX = 0, vY = 0, vZ = 0;
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
@@ -1781,18 +1781,18 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World)
Json::Value & JSON_PlayerPosition = root["position"];
if (JSON_PlayerPosition.size() == 3)
{
- SetPosX(JSON_PlayerPosition[(unsigned)0].asDouble());
- SetPosY(JSON_PlayerPosition[(unsigned)1].asDouble());
- SetPosZ(JSON_PlayerPosition[(unsigned)2].asDouble());
+ SetPosX(JSON_PlayerPosition[0].asDouble());
+ SetPosY(JSON_PlayerPosition[1].asDouble());
+ SetPosZ(JSON_PlayerPosition[2].asDouble());
m_LastPos = GetPosition();
}
Json::Value & JSON_PlayerRotation = root["rotation"];
if (JSON_PlayerRotation.size() == 3)
{
- SetYaw (static_cast<float>(JSON_PlayerRotation[(unsigned)0].asDouble()));
- SetPitch (static_cast<float>(JSON_PlayerRotation[(unsigned)1].asDouble()));
- SetRoll (static_cast<float>(JSON_PlayerRotation[(unsigned)2].asDouble()));
+ SetYaw (static_cast<float>(JSON_PlayerRotation[0].asDouble()));
+ SetPitch (static_cast<float>(JSON_PlayerRotation[1].asDouble()));
+ SetRoll (static_cast<float>(JSON_PlayerRotation[2].asDouble()));
}
m_Health = root.get("health", 0).asInt();
@@ -1805,7 +1805,7 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World)
m_CurrentXp = root.get("xpCurrent", 0).asInt();
m_IsFlying = root.get("isflying", 0).asBool();
- m_GameMode = (eGameMode) root.get("gamemode", eGameMode_NotSet).asInt();
+ m_GameMode = static_cast<eGameMode>(root.get("gamemode", eGameMode_NotSet).asInt());
if (m_GameMode == eGameMode_Creative)
{
@@ -1948,7 +1948,7 @@ void cPlayer::UseEquippedItem(int a_Amount)
// If the item has an unbreaking enchantment, give it a random chance of not breaking:
cItem Item = GetEquippedItem();
- int UnbreakingLevel = Item.m_Enchantments.GetLevel(cEnchantments::enchUnbreaking);
+ int UnbreakingLevel = static_cast<int>(Item.m_Enchantments.GetLevel(cEnchantments::enchUnbreaking));
if (UnbreakingLevel > 0)
{
int chance;
@@ -1968,7 +1968,7 @@ void cPlayer::UseEquippedItem(int a_Amount)
}
}
- if (GetInventory().DamageEquippedItem(a_Amount))
+ if (GetInventory().DamageEquippedItem(static_cast<Int16>(a_Amount)))
{
m_World->BroadcastSoundEffect("random.break", GetPosX(), GetPosY(), GetPosZ(), 0.5f, static_cast<float>(0.75 + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64));
}
@@ -2104,7 +2104,7 @@ bool cPlayer::IsClimbing(void) const
void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos)
{
- StatValue Value = (StatValue)floor(a_DeltaPos.Length() * 100 + 0.5);
+ StatValue Value = FloorC<StatValue>(a_DeltaPos.Length() * 100 + 0.5);
if (m_AttachedTo == nullptr)
{
@@ -2112,7 +2112,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos)
{
if (a_DeltaPos.y > 0.0) // Going up
{
- m_Stats.AddValue(statDistClimbed, (StatValue)floor(a_DeltaPos.y * 100 + 0.5));
+ m_Stats.AddValue(statDistClimbed, FloorC<StatValue>(a_DeltaPos.y * 100 + 0.5));
}
}
else if (IsSubmerged())
@@ -2146,7 +2146,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos)
case cEntity::etBoat: m_Stats.AddValue(statDistBoat, Value); break;
case cEntity::etMonster:
{
- cMonster * Monster = (cMonster *)m_AttachedTo;
+ cMonster * Monster = reinterpret_cast<cMonster *>(m_AttachedTo);
switch (Monster->GetMobType())
{
case mtPig: m_Stats.AddValue(statDistPig, Value); break;
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index dffb61677..0fee6ef8a 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -319,9 +319,9 @@ public:
/** returns true if the player has thrown out a floater. */
bool IsFishing(void) const { return m_IsFishing; }
- void SetIsFishing(bool a_IsFishing, int a_FloaterID = -1) { m_IsFishing = a_IsFishing; m_FloaterID = a_FloaterID; }
+ void SetIsFishing(bool a_IsFishing, UInt32 a_FloaterID = cEntity::INVALID_ID) { m_IsFishing = a_IsFishing; m_FloaterID = a_FloaterID; }
- int GetFloaterID(void) const { return m_FloaterID; }
+ UInt32 GetFloaterID(void) const { return m_FloaterID; }
// tolua_end
@@ -619,7 +619,7 @@ protected:
bool m_IsChargingBow;
int m_BowCharge;
- int m_FloaterID;
+ UInt32 m_FloaterID;
cTeam * m_Team;