1
0

Merge pull request #3332 from cuberite/FixRounding

Fixed implicit rounding warnings.
This commit is contained in:
Mattes D 2016-08-19 15:53:54 +02:00 committed by GitHub
commit c61746a392
2 changed files with 9 additions and 6 deletions

View File

@ -73,19 +73,22 @@ public:
return false;
}
double x = Callbacks.m_Pos.x;
double y = Callbacks.m_Pos.y;
double z = Callbacks.m_Pos.z;
auto x = Callbacks.m_Pos.x;
auto y = Callbacks.m_Pos.y;
auto z = Callbacks.m_Pos.z;
auto bx = FloorC(x);
auto by = FloorC(y);
auto bz = FloorC(z);
// Verify that block type for spawn point is water
BLOCKTYPE SpawnBlock = a_World->GetBlock(x, y, z);
BLOCKTYPE SpawnBlock = a_World->GetBlock(bx, by, bz);
if (!IsBlockWater(SpawnBlock))
{
return false;
}
// Block above must be air to spawn a boat (prevents spawning a boat underwater)
BLOCKTYPE BlockAbove = a_World->GetBlock(x, y + 1, z);
BLOCKTYPE BlockAbove = a_World->GetBlock(bx, by + 1, bz);
if (BlockAbove != E_BLOCK_AIR)
{
return false;

View File

@ -1213,7 +1213,7 @@ bool cMonster::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
GetWorld()->IsWeatherSunnyAt(POSX_TOINT, POSZ_TOINT) // Not raining
)
{
int MobHeight = static_cast<int>(a_Location.y) + round(GetHeight()) - 1; // The height of the mob head
int MobHeight = FloorC(a_Location.y + GetHeight()) - 1; // The block Y coord of the mob's head
if (MobHeight >= cChunkDef::Height)
{
return true;