Merge branch 'master' into ChunkLoader
Conflicts: src/World.h
This commit is contained in:
commit
6f99615ceb
@ -295,7 +295,7 @@ public:
|
|||||||
NIBBLETYPE * GetBlockMetas (void) const { return m_BlockMetas; } // NOTE: one byte per block!
|
NIBBLETYPE * GetBlockMetas (void) const { return m_BlockMetas; } // NOTE: one byte per block!
|
||||||
NIBBLETYPE * GetBlockLight (void) const { return m_BlockLight; } // NOTE: one byte per block!
|
NIBBLETYPE * GetBlockLight (void) const { return m_BlockLight; } // NOTE: one byte per block!
|
||||||
NIBBLETYPE * GetBlockSkyLight(void) const { return m_BlockSkyLight; } // NOTE: one byte per block!
|
NIBBLETYPE * GetBlockSkyLight(void) const { return m_BlockSkyLight; } // NOTE: one byte per block!
|
||||||
size_t GetBlockCount(void) const { return (size_t)(m_Size.x * m_Size.y * m_Size.z); }
|
size_t GetBlockCount(void) const { return static_cast<size_t>(m_Size.x * m_Size.y * m_Size.z); }
|
||||||
int MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const;
|
int MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -367,7 +367,3 @@ protected:
|
|||||||
// tolua_begin
|
// tolua_begin
|
||||||
} ;
|
} ;
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||||
|
|
||||||
#include "BeaconEntity.h"
|
#include "BeaconEntity.h"
|
||||||
|
#include <algorithm>
|
||||||
#include "../BlockArea.h"
|
#include "../BlockArea.h"
|
||||||
#include "../Entities/Player.h"
|
#include "../Entities/Player.h"
|
||||||
|
|
||||||
@ -227,10 +228,7 @@ void cBeaconEntity::GiveEffects(void)
|
|||||||
virtual bool Item(cPlayer * a_Player)
|
virtual bool Item(cPlayer * a_Player)
|
||||||
{
|
{
|
||||||
Vector3d PlayerPosition = Vector3d(a_Player->GetPosition());
|
Vector3d PlayerPosition = Vector3d(a_Player->GetPosition());
|
||||||
if (PlayerPosition.y > (double)m_PosY)
|
PlayerPosition.y = std::min(static_cast<double>(m_PosY), PlayerPosition.y);
|
||||||
{
|
|
||||||
PlayerPosition.y = (double)m_PosY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Vanilla minecraft uses an AABB check instead of a radius one
|
// TODO: Vanilla minecraft uses an AABB check instead of a radius one
|
||||||
Vector3d BeaconPosition = Vector3d(m_PosX, m_PosY, m_PosZ);
|
Vector3d BeaconPosition = Vector3d(m_PosX, m_PosY, m_PosZ);
|
||||||
@ -255,7 +253,7 @@ void cBeaconEntity::GiveEffects(void)
|
|||||||
, m_PrimaryEffect(a_PrimaryEffect)
|
, m_PrimaryEffect(a_PrimaryEffect)
|
||||||
, m_SecondaryEffect(a_SecondaryEffect)
|
, m_SecondaryEffect(a_SecondaryEffect)
|
||||||
, m_EffectLevel(a_EffectLevel)
|
, m_EffectLevel(a_EffectLevel)
|
||||||
{};
|
{}
|
||||||
|
|
||||||
} PlayerCallback(Radius, m_PosX, m_PosY, m_PosZ, m_PrimaryEffect, SecondaryEffect, EffectLevel);
|
} PlayerCallback(Radius, m_PosX, m_PosY, m_PosZ, m_PrimaryEffect, SecondaryEffect, EffectLevel);
|
||||||
GetWorld()->ForEachPlayer(PlayerCallback);
|
GetWorld()->ForEachPlayer(PlayerCallback);
|
||||||
@ -307,7 +305,3 @@ void cBeaconEntity::SendTo(cClientHandle & a_Client)
|
|||||||
{
|
{
|
||||||
a_Client.SendUpdateBlockEntity(*this);
|
a_Client.SendUpdateBlockEntity(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
|
|||||||
{
|
{
|
||||||
double MobX = 0.5 + (DispX + DispChunk->GetPosX() * cChunkDef::Width);
|
double MobX = 0.5 + (DispX + DispChunk->GetPosX() * cChunkDef::Width);
|
||||||
double MobZ = 0.5 + (DispZ + DispChunk->GetPosZ() * cChunkDef::Width);
|
double MobZ = 0.5 + (DispZ + DispChunk->GetPosZ() * cChunkDef::Width);
|
||||||
if (m_World->SpawnMob(MobX, DispY, MobZ, (eMonsterType)m_Contents.GetSlot(a_SlotNum).m_ItemDamage) >= 0)
|
if (m_World->SpawnMob(MobX, DispY, MobZ, static_cast<eMonsterType>(m_Contents.GetSlot(a_SlotNum).m_ItemDamage)) >= 0)
|
||||||
{
|
{
|
||||||
m_Contents.ChangeSlotCount(a_SlotNum, -1);
|
m_Contents.ChangeSlotCount(a_SlotNum, -1);
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
|
|||||||
|
|
||||||
void cDispenserEntity::SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY, int a_BlockZ, cProjectileEntity::eKind a_Kind, const Vector3d & a_ShootVector)
|
void cDispenserEntity::SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY, int a_BlockZ, cProjectileEntity::eKind a_Kind, const Vector3d & a_ShootVector)
|
||||||
{
|
{
|
||||||
m_World->CreateProjectile((double)a_BlockX + 0.5, (double)a_BlockY + 0.5, (double)a_BlockZ + 0.5, a_Kind, NULL, NULL, &a_ShootVector);
|
m_World->CreateProjectile(static_cast<double>(a_BlockX + 0.5), static_cast<double>(a_BlockY + 0.5), static_cast<double>(a_BlockZ + 0.5), a_Kind, NULL, NULL, &a_ShootVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,6 +275,3 @@ bool cDispenserEntity::EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum
|
|||||||
m_Contents.AddItem(EmptyBucket);
|
m_Contents.AddItem(EmptyBucket);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,7 +205,3 @@ void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum)
|
|||||||
|
|
||||||
m_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ, PickupSpeedX, PickupSpeedY, PickupSpeedZ);
|
m_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ, PickupSpeedX, PickupSpeedY, PickupSpeedZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ bool cFlowerPotEntity::IsFlower(short m_ItemType, short m_ItemData)
|
|||||||
}
|
}
|
||||||
case E_BLOCK_TALL_GRASS:
|
case E_BLOCK_TALL_GRASS:
|
||||||
{
|
{
|
||||||
return (m_ItemData == (short) 2);
|
return (m_ItemData == static_cast<short>(2));
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -96,7 +96,3 @@ bool cFlowerPotEntity::IsFlower(short m_ItemType, short m_ItemData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,7 +373,3 @@ void cFurnaceEntity::SetIsCooking(bool a_IsCooking)
|
|||||||
m_World->FastSetBlock(m_PosX, m_PosY, m_PosZ, E_BLOCK_LIT_FURNACE, m_BlockMeta);
|
m_World->FastSetBlock(m_PosX, m_PosY, m_PosZ, E_BLOCK_LIT_FURNACE, m_BlockMeta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ bool cHopperEntity::MoveItemsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
|
|||||||
case E_BLOCK_DROPPER:
|
case E_BLOCK_DROPPER:
|
||||||
case E_BLOCK_HOPPER:
|
case E_BLOCK_HOPPER:
|
||||||
{
|
{
|
||||||
res = MoveItemsFromGrid(*(cBlockEntityWithItems *)a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ));
|
res = MoveItemsFromGrid(*static_cast<cBlockEntityWithItems *>(a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,12 +205,12 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector3f EntityPos = a_Entity->GetPosition();
|
Vector3f EntityPos = a_Entity->GetPosition();
|
||||||
Vector3f BlockPos(m_Pos.x + 0.5f, (float)m_Pos.y + 1, m_Pos.z + 0.5f); // One block above hopper, and search from center outwards
|
Vector3f BlockPos(m_Pos.x + 0.5f, static_cast<float>(m_Pos.y) + 1, m_Pos.z + 0.5f); // One block above hopper, and search from center outwards
|
||||||
double Distance = (EntityPos - BlockPos).Length();
|
double Distance = (EntityPos - BlockPos).Length();
|
||||||
|
|
||||||
if (Distance < 0.5)
|
if (Distance < 0.5)
|
||||||
{
|
{
|
||||||
if (TrySuckPickupIn((cPickup *)a_Entity))
|
if (TrySuckPickupIn(static_cast<cPickup *>(a_Entity)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -327,7 +327,7 @@ bool cHopperEntity::MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick)
|
|||||||
case E_BLOCK_DROPPER:
|
case E_BLOCK_DROPPER:
|
||||||
case E_BLOCK_HOPPER:
|
case E_BLOCK_HOPPER:
|
||||||
{
|
{
|
||||||
cBlockEntityWithItems * BlockEntity = (cBlockEntityWithItems *)DestChunk->GetBlockEntity(OutX, OutY, OutZ);
|
cBlockEntityWithItems * BlockEntity = static_cast<cBlockEntityWithItems *>(DestChunk->GetBlockEntity(OutX, OutY, OutZ));
|
||||||
if (BlockEntity == NULL)
|
if (BlockEntity == NULL)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: A block entity was not found where expected at {%d, %d, %d}", __FUNCTION__, OutX, OutY, OutZ);
|
LOGWARNING("%s: A block entity was not found where expected at {%d, %d, %d}", __FUNCTION__, OutX, OutY, OutZ);
|
||||||
@ -354,7 +354,7 @@ bool cHopperEntity::MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick)
|
|||||||
/// Moves items from a chest (dblchest) above the hopper into this hopper. Returns true if contents have changed.
|
/// Moves items from a chest (dblchest) above the hopper into this hopper. Returns true if contents have changed.
|
||||||
bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
|
bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
|
||||||
{
|
{
|
||||||
cChestEntity * MainChest = (cChestEntity *)a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ);
|
cChestEntity * MainChest = static_cast<cChestEntity *>(a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ));
|
||||||
if (MainChest == NULL)
|
if (MainChest == NULL)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX, m_PosY + 1, m_PosZ);
|
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX, m_PosY + 1, m_PosZ);
|
||||||
@ -395,7 +395,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cChestEntity * SideChest = (cChestEntity *)Neighbor->GetBlockEntity(m_PosX + Coords[i].x, m_PosY + 1, m_PosZ + Coords[i].z);
|
cChestEntity * SideChest = static_cast<cChestEntity *>(Neighbor->GetBlockEntity(m_PosX + Coords[i].x, m_PosY + 1, m_PosZ + Coords[i].z));
|
||||||
if (SideChest == NULL)
|
if (SideChest == NULL)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX + Coords[i].x, m_PosY + 1, m_PosZ + Coords[i].z);
|
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX + Coords[i].x, m_PosY + 1, m_PosZ + Coords[i].z);
|
||||||
@ -421,7 +421,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
|
|||||||
/// Moves items from a furnace above the hopper into this hopper. Returns true if contents have changed.
|
/// Moves items from a furnace above the hopper into this hopper. Returns true if contents have changed.
|
||||||
bool cHopperEntity::MoveItemsFromFurnace(cChunk & a_Chunk)
|
bool cHopperEntity::MoveItemsFromFurnace(cChunk & a_Chunk)
|
||||||
{
|
{
|
||||||
cFurnaceEntity * Furnace = (cFurnaceEntity *)a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ);
|
cFurnaceEntity * Furnace = static_cast<cFurnaceEntity *>(a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ));
|
||||||
if (Furnace == NULL)
|
if (Furnace == NULL)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: A furnace entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX, m_PosY + 1, m_PosZ);
|
LOGWARNING("%s: A furnace entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX, m_PosY + 1, m_PosZ);
|
||||||
@ -535,7 +535,7 @@ bool cHopperEntity::MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_Sl
|
|||||||
bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ)
|
bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
// Try the chest directly connected to the hopper:
|
// Try the chest directly connected to the hopper:
|
||||||
cChestEntity * ConnectedChest = (cChestEntity *)a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ);
|
cChestEntity * ConnectedChest = static_cast<cChestEntity *>(a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ));
|
||||||
if (ConnectedChest == NULL)
|
if (ConnectedChest == NULL)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, a_BlockX, a_BlockY, a_BlockZ);
|
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
@ -578,7 +578,7 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cChestEntity * Chest = (cChestEntity *)Neighbor->GetBlockEntity(a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z);
|
cChestEntity * Chest = static_cast<cChestEntity *>(Neighbor->GetBlockEntity(a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z));
|
||||||
if (Chest == NULL)
|
if (Chest == NULL)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d} (%d, %d)", __FUNCTION__, a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z, x, z);
|
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d} (%d, %d)", __FUNCTION__, a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z, x, z);
|
||||||
@ -602,7 +602,7 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block
|
|||||||
/// Moves items to the furnace at the specified coords. Returns true if contents have changed
|
/// Moves items to the furnace at the specified coords. Returns true if contents have changed
|
||||||
bool cHopperEntity::MoveItemsToFurnace(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_HopperMeta)
|
bool cHopperEntity::MoveItemsToFurnace(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_HopperMeta)
|
||||||
{
|
{
|
||||||
cFurnaceEntity * Furnace = (cFurnaceEntity *)a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ);
|
cFurnaceEntity * Furnace = static_cast<cFurnaceEntity *>(a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ));
|
||||||
if (a_HopperMeta == E_META_HOPPER_FACING_YM)
|
if (a_HopperMeta == E_META_HOPPER_FACING_YM)
|
||||||
{
|
{
|
||||||
// Feed the input slot of the furnace
|
// Feed the input slot of the furnace
|
||||||
@ -684,7 +684,3 @@ bool cHopperEntity::MoveItemsToSlot(cBlockEntityWithItems & a_Entity, int a_DstS
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ bool cJukeboxEntity::EjectRecord(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cItems Drops;
|
cItems Drops;
|
||||||
Drops.push_back(cItem(m_Record, 1, 0));
|
Drops.push_back(cItem(static_cast<short>(m_Record), 1, 0));
|
||||||
m_Record = 0;
|
m_Record = 0;
|
||||||
m_World->SpawnItemPickups(Drops, m_PosX + 0.5, m_PosY + 1, m_PosZ + 0.5, 8);
|
m_World->SpawnItemPickups(Drops, m_PosX + 0.5, m_PosY + 1, m_PosZ + 0.5, 8);
|
||||||
m_World->BroadcastSoundParticleEffect(1005, m_PosX, m_PosY, m_PosZ, 0);
|
m_World->BroadcastSoundParticleEffect(1005, m_PosX, m_PosY, m_PosZ, 0);
|
||||||
@ -113,7 +113,3 @@ void cJukeboxEntity::SetRecord(int a_Record)
|
|||||||
{
|
{
|
||||||
m_Record = a_Record;
|
m_Record = a_Record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void cSignEntity::SetLines(const AString & a_Line1, const AString & a_Line2, con
|
|||||||
|
|
||||||
void cSignEntity::SetLine(int a_Index, const AString & a_Line)
|
void cSignEntity::SetLine(int a_Index, const AString & a_Line)
|
||||||
{
|
{
|
||||||
if ((a_Index < 0) || (a_Index >= (int)ARRAYCOUNT(m_Line)))
|
if ((a_Index < 0) || (a_Index >= static_cast<int>(ARRAYCOUNT(m_Line))))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: setting a non-existent line %d (value \"%s\"", __FUNCTION__, a_Index, a_Line.c_str());
|
LOGWARNING("%s: setting a non-existent line %d (value \"%s\"", __FUNCTION__, a_Index, a_Line.c_str());
|
||||||
return;
|
return;
|
||||||
@ -59,7 +59,7 @@ void cSignEntity::SetLine(int a_Index, const AString & a_Line)
|
|||||||
|
|
||||||
AString cSignEntity::GetLine(int a_Index) const
|
AString cSignEntity::GetLine(int a_Index) const
|
||||||
{
|
{
|
||||||
if ((a_Index < 0) || (a_Index >= (int)ARRAYCOUNT(m_Line)))
|
if ((a_Index < 0) || (a_Index >= static_cast<int>(ARRAYCOUNT(m_Line))))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: requesting a non-existent line %d", __FUNCTION__, a_Index);
|
LOGWARNING("%s: requesting a non-existent line %d", __FUNCTION__, a_Index);
|
||||||
return "";
|
return "";
|
||||||
@ -75,7 +75,3 @@ void cSignEntity::SendTo(cClientHandle & a_Client)
|
|||||||
{
|
{
|
||||||
a_Client.SendUpdateSign(m_PosX, m_PosY, m_PosZ, m_Line[0], m_Line[1], m_Line[2], m_Line[3]);
|
a_Client.SendUpdateSign(m_PosX, m_PosY, m_PosZ, m_Line[0], m_Line[1], m_Line[2], m_Line[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,11 +226,11 @@ public:
|
|||||||
{
|
{
|
||||||
if ((a_BlockIdx > -1) && (a_BlockIdx < NumBlocks))
|
if ((a_BlockIdx > -1) && (a_BlockIdx < NumBlocks))
|
||||||
{
|
{
|
||||||
if ((size_t)(a_BlockIdx / 2) >= a_Buffer.size())
|
if (static_cast<size_t>(a_BlockIdx / 2) >= a_Buffer.size())
|
||||||
{
|
{
|
||||||
return (a_IsSkyLightNibble ? 0xff : 0);
|
return (a_IsSkyLightNibble ? 0xff : 0);
|
||||||
}
|
}
|
||||||
return (a_Buffer[(size_t)(a_BlockIdx / 2)] >> ((a_BlockIdx & 1) * 4)) & 0x0f;
|
return (a_Buffer[static_cast<size_t>(a_BlockIdx / 2)] >> ((a_BlockIdx & 1) * 4)) & 0x0f;
|
||||||
}
|
}
|
||||||
ASSERT(!"cChunkDef::GetNibble(): index out of chunk range!");
|
ASSERT(!"cChunkDef::GetNibble(): index out of chunk range!");
|
||||||
return 0;
|
return 0;
|
||||||
@ -241,7 +241,7 @@ public:
|
|||||||
{
|
{
|
||||||
if ((x < Width) && (x > -1) && (y < Height) && (y > -1) && (z < Width) && (z > -1))
|
if ((x < Width) && (x > -1) && (y < Height) && (y > -1) && (z < Width) && (z > -1))
|
||||||
{
|
{
|
||||||
size_t Index = (size_t)MakeIndexNoCheck(x, y, z);
|
size_t Index = static_cast<size_t>(MakeIndexNoCheck(x, y, z));
|
||||||
if ((Index / 2) >= a_Buffer.size())
|
if ((Index / 2) >= a_Buffer.size())
|
||||||
{
|
{
|
||||||
return (a_IsSkyLightNibble ? 0xff : 0);
|
return (a_IsSkyLightNibble ? 0xff : 0);
|
||||||
@ -258,7 +258,7 @@ public:
|
|||||||
if ((x < Width) && (x > -1) && (y < Height) && (y > -1) && (z < Width) && (z > -1))
|
if ((x < Width) && (x > -1) && (y < Height) && (y > -1) && (z < Width) && (z > -1))
|
||||||
{
|
{
|
||||||
int Index = MakeIndexNoCheck(x, y, z);
|
int Index = MakeIndexNoCheck(x, y, z);
|
||||||
return (a_Buffer[(size_t)(Index / 2)] >> ((Index & 1) * 4)) & 0x0f;
|
return (a_Buffer[static_cast<size_t>(Index / 2)] >> ((Index & 1) * 4)) & 0x0f;
|
||||||
}
|
}
|
||||||
ASSERT(!"cChunkDef::GetNibble(): coords out of chunk range!");
|
ASSERT(!"cChunkDef::GetNibble(): coords out of chunk range!");
|
||||||
return 0;
|
return 0;
|
||||||
@ -272,11 +272,11 @@ public:
|
|||||||
ASSERT(!"cChunkDef::SetNibble(): index out of range!");
|
ASSERT(!"cChunkDef::SetNibble(): index out of range!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((size_t)(a_BlockIdx / 2) >= a_Buffer.size())
|
if (static_cast<size_t>(a_BlockIdx / 2) >= a_Buffer.size())
|
||||||
{
|
{
|
||||||
a_Buffer.resize((size_t)((a_BlockIdx / 2) + 1));
|
a_Buffer.resize(static_cast<size_t>((a_BlockIdx / 2) + 1));
|
||||||
}
|
}
|
||||||
a_Buffer[(size_t)(a_BlockIdx / 2)] = PackNibble(a_Buffer, (size_t)a_BlockIdx, a_Nibble);
|
a_Buffer[static_cast<size_t>(a_BlockIdx / 2)] = PackNibble(a_Buffer, static_cast<size_t>(a_BlockIdx), a_Nibble);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Index = (size_t)MakeIndexNoCheck(x, y, z);
|
size_t Index = static_cast<size_t>(MakeIndexNoCheck(x, y, z));
|
||||||
if ((Index / 2) >= a_Buffer.size())
|
if ((Index / 2) >= a_Buffer.size())
|
||||||
{
|
{
|
||||||
a_Buffer.resize(((Index / 2) + 1));
|
a_Buffer.resize(((Index / 2) + 1));
|
||||||
@ -478,7 +478,3 @@ public:
|
|||||||
typedef cCoordWithDoubleData <BLOCKTYPE, bool> cCoordWithBlockAndBool;
|
typedef cCoordWithDoubleData <BLOCKTYPE, bool> cCoordWithBlockAndBool;
|
||||||
|
|
||||||
typedef std::vector<cCoordWithBlockAndBool> cCoordWithBlockAndBoolVector;
|
typedef std::vector<cCoordWithBlockAndBool> cCoordWithBlockAndBoolVector;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B
|
|||||||
{
|
{
|
||||||
int Y = a_BlockY;
|
int Y = a_BlockY;
|
||||||
AddFaceDirection(a_BlockX, Y, a_BlockZ, a_BlockFace, a_bInverse);
|
AddFaceDirection(a_BlockX, Y, a_BlockZ, a_BlockFace, a_bInverse);
|
||||||
a_BlockY = Clamp<unsigned char>((unsigned char)Y, 0, 255);
|
a_BlockY = Clamp<unsigned char>(static_cast<unsigned char>(Y), 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -715,7 +715,3 @@ namespace ItemCategory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,8 +201,8 @@ public:
|
|||||||
double GetSpeedZ (void) const { return m_Speed.z; }
|
double GetSpeedZ (void) const { return m_Speed.z; }
|
||||||
double GetWidth (void) const { return m_Width; }
|
double GetWidth (void) const { return m_Width; }
|
||||||
|
|
||||||
int GetChunkX(void) const {return (int)floor(m_Pos.x / cChunkDef::Width); }
|
int GetChunkX(void) const {return static_cast<int>(floor(m_Pos.x / cChunkDef::Width)); }
|
||||||
int GetChunkZ(void) const {return (int)floor(m_Pos.z / cChunkDef::Width); }
|
int GetChunkZ(void) const {return static_cast<int>(floor(m_Pos.z / cChunkDef::Width)); }
|
||||||
|
|
||||||
void SetHeadYaw (double a_HeadYaw);
|
void SetHeadYaw (double a_HeadYaw);
|
||||||
void SetHeight (double a_Height);
|
void SetHeight (double a_Height);
|
||||||
@ -600,7 +600,3 @@ private:
|
|||||||
} ; // tolua_export
|
} ; // tolua_export
|
||||||
|
|
||||||
typedef std::list<cEntity *> cEntityList;
|
typedef std::list<cEntity *> cEntityList;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ public:
|
|||||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||||
|
|
||||||
/** Returns the number of ticks that this entity has existed */
|
/** Returns the number of ticks that this entity has existed */
|
||||||
int GetAge(void) const { return (int)(m_Timer / 50); } // tolua_export
|
int GetAge(void) const { return static_cast<int>(m_Timer / 50); } // tolua_export
|
||||||
|
|
||||||
/** Set the number of ticks that this entity has existed */
|
/** Set the number of ticks that this entity has existed */
|
||||||
void SetAge(int a_Age) { m_Timer = (float)(a_Age * 50); } // tolua_export
|
void SetAge(int a_Age) { m_Timer = static_cast<float>(a_Age * 50); } // tolua_export
|
||||||
|
|
||||||
/** Returns true if the pickup has already been collected */
|
/** Returns true if the pickup has already been collected */
|
||||||
bool IsCollected(void) const { return m_bCollected; } // tolua_export
|
bool IsCollected(void) const { return m_bCollected; } // tolua_export
|
||||||
@ -59,7 +59,3 @@ private:
|
|||||||
|
|
||||||
bool m_bIsPlayerCreated;
|
bool m_bIsPlayerCreated;
|
||||||
}; // tolua_export
|
}; // tolua_export
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength )
|
|||||||
initialize(19650218UL);
|
initialize(19650218UL);
|
||||||
uint32 i = 1;
|
uint32 i = 1;
|
||||||
uint32 j = 0;
|
uint32 j = 0;
|
||||||
uint32 k = ( (uint32)N > seedLength ? (uint32)N : seedLength );
|
uint32 k = ( static_cast<uint32>(N) > seedLength ? static_cast<uint32>(N) : seedLength );
|
||||||
for( ; k; --k )
|
for( ; k; --k )
|
||||||
{
|
{
|
||||||
state[i] =
|
state[i] =
|
||||||
|
@ -84,7 +84,7 @@ public:
|
|||||||
virtual void InStateChasing (float a_Dt);
|
virtual void InStateChasing (float a_Dt);
|
||||||
virtual void InStateEscaping(float a_Dt);
|
virtual void InStateEscaping(float a_Dt);
|
||||||
|
|
||||||
int GetAttackRate() { return (int)m_AttackRate; }
|
int GetAttackRate() { return static_cast<int>(m_AttackRate); }
|
||||||
void SetAttackRate(float a_AttackRate) { m_AttackRate = a_AttackRate; }
|
void SetAttackRate(float a_AttackRate) { m_AttackRate = a_AttackRate; }
|
||||||
void SetAttackRange(int a_AttackRange) { m_AttackRange = a_AttackRange; }
|
void SetAttackRange(int a_AttackRange) { m_AttackRange = a_AttackRange; }
|
||||||
void SetAttackDamage(int a_AttackDamage) { m_AttackDamage = a_AttackDamage; }
|
void SetAttackDamage(int a_AttackDamage) { m_AttackDamage = a_AttackDamage; }
|
||||||
@ -257,7 +257,3 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
} ; // tolua_export
|
} ; // tolua_export
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ protected:
|
|||||||
|
|
||||||
static void * thrExecute(void * a_Param)
|
static void * thrExecute(void * a_Param)
|
||||||
{
|
{
|
||||||
((cIsThread *)a_Param)->Execute();
|
(static_cast<cIsThread *>(a_Param))->Execute();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,3 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
#endif // CISTHREAD_H_INCLUDED
|
#endif // CISTHREAD_H_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ public:
|
|||||||
virtual void SetTimeOfDay(int a_TimeOfDay) override
|
virtual void SetTimeOfDay(int a_TimeOfDay) override
|
||||||
{
|
{
|
||||||
m_TimeOfDay = a_TimeOfDay;
|
m_TimeOfDay = a_TimeOfDay;
|
||||||
m_TimeOfDaySecs = (double)a_TimeOfDay / 20.0;
|
m_TimeOfDaySecs = static_cast<double>(a_TimeOfDay) / 20.0;
|
||||||
UpdateSkyDarkness();
|
UpdateSkyDarkness();
|
||||||
BroadcastTimeUpdate();
|
BroadcastTimeUpdate();
|
||||||
}
|
}
|
||||||
@ -784,7 +784,7 @@ public:
|
|||||||
int CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem * a_Item, const Vector3d * a_Speed = NULL); // tolua_export
|
int CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem * a_Item, const Vector3d * a_Speed = NULL); // tolua_export
|
||||||
|
|
||||||
/** Returns a random number from the m_TickRand in range [0 .. a_Range]. To be used only in the tick thread! */
|
/** Returns a random number from the m_TickRand in range [0 .. a_Range]. To be used only in the tick thread! */
|
||||||
int GetTickRandomNumber(unsigned a_Range) { return (int)(m_TickRand.randInt(a_Range)); }
|
int GetTickRandomNumber(unsigned a_Range) { return static_cast<int>(m_TickRand.randInt(a_Range)); }
|
||||||
|
|
||||||
/** Appends all usernames starting with a_Text (case-insensitive) into Results */
|
/** Appends all usernames starting with a_Text (case-insensitive) into Results */
|
||||||
void TabCompleteUserName(const AString & a_Text, AStringVector & a_Results);
|
void TabCompleteUserName(const AString & a_Text, AStringVector & a_Results);
|
||||||
@ -1077,7 +1077,3 @@ private:
|
|||||||
void SetChunkData(cSetChunkData & a_SetChunkData);
|
void SetChunkData(cSetChunkData & a_SetChunkData);
|
||||||
|
|
||||||
}; // tolua_export
|
}; // tolua_export
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user