Fix comments
This commit is contained in:
parent
e19693e529
commit
b2fa71a32a
1
.gitignore
vendored
1
.gitignore
vendored
@ -75,7 +75,6 @@ src/MCServer
|
||||
lib/tolua++/tolua
|
||||
src/Bindings/Bindings.*
|
||||
src/Bindings/BindingDependencies.txt
|
||||
src/Bindings/LuaState_Call.inc
|
||||
MCServer.dir/
|
||||
src/AllFiles.lst
|
||||
|
||||
|
@ -146,12 +146,12 @@ set_source_files_properties(${BINDING_OUTPUTS} PROPERTIES GENERATED TRUE)
|
||||
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES COMPILE_FLAGS -Wno-error)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(DeprecatedBindings.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(LuaState.cpp COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(DeprecatedBindings.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(LuaState.cpp COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(LuaWindow.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
set_source_files_properties(ManualBindings.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(ManualBindings_World.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(PluginLua.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(ManualBindings.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(ManualBindings_World.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(PluginLua.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
|
@ -177,7 +177,8 @@ void cMobSpawnerEntity::SpawnEntity(void)
|
||||
static_cast<int>(PosX * 8.0),
|
||||
static_cast<int>(RelY * 8.0),
|
||||
static_cast<int>(PosZ * 8.0),
|
||||
0);
|
||||
0
|
||||
);
|
||||
m_NearbyEntitiesNum++;
|
||||
}
|
||||
}
|
||||
|
@ -92,11 +92,13 @@ void cNoteEntity::MakeSound(void)
|
||||
// TODO: instead of calculating the power function over and over, make a precalculated table - there's only 24 pitches after all
|
||||
float calcPitch = pow(2.0f, static_cast<float>(m_Pitch - 12.0f) / 12.0f);
|
||||
m_World->BroadcastSoundEffect(
|
||||
sampleName,
|
||||
static_cast<double>(m_PosX),
|
||||
static_cast<double>(m_PosY),
|
||||
static_cast<double>(m_PosZ),
|
||||
3.0f, calcPitch);
|
||||
sampleName,
|
||||
static_cast<double>(m_PosX),
|
||||
static_cast<double>(m_PosY),
|
||||
static_cast<double>(m_PosZ),
|
||||
3.0f,
|
||||
calcPitch
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,11 +117,12 @@ void cSplashPotionEntity::Splash(const Vector3d & a_HitPos)
|
||||
m_World->ForEachEntity(Callback);
|
||||
|
||||
m_World->BroadcastSoundParticleEffect(
|
||||
2002,
|
||||
static_cast<int>(floor(a_HitPos.x)),
|
||||
static_cast<int>(floor(a_HitPos.y)),
|
||||
static_cast<int>(floor(a_HitPos.z)),
|
||||
m_PotionColor);
|
||||
2002,
|
||||
FloorC(a_HitPos.x),
|
||||
FloorC(a_HitPos.y),
|
||||
FloorC(a_HitPos.z),
|
||||
m_PotionColor
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,7 +158,7 @@ void cChunkDesc::SetHeightFromShape(const Shape & a_Shape)
|
||||
{
|
||||
for (int x = 0; x < cChunkDef::Width; x++)
|
||||
{
|
||||
for (unsigned char y = cChunkDef::Height - 1; y > 0; y--)
|
||||
for (HEIGHTTYPE y = cChunkDef::Height - 1; y > 0; y--)
|
||||
{
|
||||
if (a_Shape[y + x * 256 + z * 16 * 256] != 0)
|
||||
{
|
||||
|
@ -96,17 +96,17 @@ bool cLineBlockTracer::Trace(double a_StartX, double a_StartY, double a_StartZ,
|
||||
m_Callbacks->OnIntoWorld(m_StartX, m_StartY, m_StartZ);
|
||||
}
|
||||
|
||||
m_CurrentX = static_cast<int>(floor(m_StartX));
|
||||
m_CurrentY = static_cast<int>(floor(m_StartY));
|
||||
m_CurrentZ = static_cast<int>(floor(m_StartZ));
|
||||
m_CurrentX = FloorC(m_StartX);
|
||||
m_CurrentY = FloorC(m_StartY);
|
||||
m_CurrentZ = FloorC(m_StartZ);
|
||||
|
||||
m_DiffX = m_EndX - m_StartX;
|
||||
m_DiffY = m_EndY - m_StartY;
|
||||
m_DiffZ = m_EndZ - m_StartZ;
|
||||
|
||||
// The actual trace is handled with ChunkMapCS locked by calling our Item() for the specified chunk
|
||||
int BlockX = static_cast<int>(floor(m_StartX));
|
||||
int BlockZ = static_cast<int>(floor(m_StartZ));
|
||||
int BlockX = FloorC(m_StartX);
|
||||
int BlockZ = FloorC(m_StartZ);
|
||||
int ChunkX, ChunkZ;
|
||||
cChunkDef::BlockToChunk(BlockX, BlockZ, ChunkX, ChunkZ);
|
||||
return m_World->DoWithChunk(ChunkX, ChunkZ, *this);
|
||||
|
@ -283,8 +283,12 @@ cFileListener::cFileListener(void)
|
||||
cFile::CreateFolder(FILE_IO_PREFIX + AString("logs"));
|
||||
AString FileName;
|
||||
auto time = std::chrono::system_clock::now();
|
||||
FileName = Printf("%s%sLOG_%d.txt", FILE_IO_PREFIX, "logs/",
|
||||
std::chrono::duration_cast<std::chrono::duration<int, std::milli>>(time.time_since_epoch()).count());
|
||||
FileName = Printf(
|
||||
"%s%sLOG_%d.txt",
|
||||
FILE_IO_PREFIX,
|
||||
"logs/",
|
||||
std::chrono::duration_cast<std::chrono::duration<int, std::milli>>(time.time_since_epoch()).count()
|
||||
);
|
||||
m_File.Open(FileName, cFile::fmAppend);
|
||||
}
|
||||
|
||||
|
@ -43,13 +43,13 @@ void cGuardian::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
Vector3d Pos = GetPosition();
|
||||
|
||||
// TODO: Not a real behavior, but cool :D
|
||||
int RelY = static_cast<int>(floor(Pos.y));
|
||||
int RelY = FloorC(Pos.y);
|
||||
if ((RelY < 0) || (RelY >= cChunkDef::Height))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int RelX = static_cast<int>(floor(Pos.x)) - a_Chunk.GetPosX() * cChunkDef::Width;
|
||||
int RelZ = static_cast<int>(floor(Pos.z)) - a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
int RelX = FloorC(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width;
|
||||
int RelZ = FloorC(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
BLOCKTYPE BlockType;
|
||||
if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire())
|
||||
{
|
||||
|
@ -55,10 +55,10 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
if (m_World->GetTickRandomNumber(50) == 25)
|
||||
{
|
||||
m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 0);
|
||||
m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 2);
|
||||
m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 6);
|
||||
m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 8);
|
||||
m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 0);
|
||||
m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 2);
|
||||
m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 6);
|
||||
m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 8);
|
||||
|
||||
m_Attachee->Detach();
|
||||
m_bIsRearing = true;
|
||||
|
@ -46,18 +46,18 @@ cPath::cPath(
|
||||
|
||||
a_BoundingBoxWidth = 1; // Until we improve physics, if ever.
|
||||
|
||||
m_BoundingBoxWidth = static_cast<int>(ceil(a_BoundingBoxWidth));
|
||||
m_BoundingBoxHeight = static_cast<int>(ceil(a_BoundingBoxHeight));
|
||||
m_BoundingBoxWidth = CeilC(a_BoundingBoxWidth);
|
||||
m_BoundingBoxHeight = CeilC(a_BoundingBoxHeight);
|
||||
m_HalfWidth = a_BoundingBoxWidth / 2;
|
||||
|
||||
int HalfWidthInt = static_cast<int>(a_BoundingBoxWidth / 2);
|
||||
m_Source.x = static_cast<int>(floor(a_StartingPoint.x - HalfWidthInt));
|
||||
m_Source.y = static_cast<int>(floor(a_StartingPoint.y));
|
||||
m_Source.z = static_cast<int>(floor(a_StartingPoint.z - HalfWidthInt));
|
||||
int HalfWidthInt = FloorC(a_BoundingBoxWidth / 2);
|
||||
m_Source.x = FloorC(a_StartingPoint.x - HalfWidthInt);
|
||||
m_Source.y = FloorC(a_StartingPoint.y);
|
||||
m_Source.z = FloorC(a_StartingPoint.z - HalfWidthInt);
|
||||
|
||||
m_Destination.x = static_cast<int>(floor(a_EndingPoint.x - HalfWidthInt));
|
||||
m_Destination.y = static_cast<int>(floor(a_EndingPoint.y));
|
||||
m_Destination.z = static_cast<int>(floor(a_EndingPoint.z - HalfWidthInt));
|
||||
m_Destination.x = FloorC(a_EndingPoint.x - HalfWidthInt);
|
||||
m_Destination.y = FloorC(a_EndingPoint.y);
|
||||
m_Destination.z = FloorC(a_EndingPoint.z - HalfWidthInt);
|
||||
|
||||
if (GetCell(m_Source)->m_IsSolid || GetCell(m_Destination)->m_IsSolid)
|
||||
{
|
||||
|
@ -41,13 +41,13 @@ void cSquid::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
Vector3d Pos = GetPosition();
|
||||
|
||||
// TODO: Not a real behavior, but cool :D
|
||||
int RelY = static_cast<int>(floor(Pos.y));
|
||||
int RelY = FloorC(Pos.y);
|
||||
if ((RelY < 0) || (RelY >= cChunkDef::Height))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int RelX = static_cast<int>(floor(Pos.x)) - a_Chunk.GetPosX() * cChunkDef::Width;
|
||||
int RelZ = static_cast<int>(floor(Pos.z)) - a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
int RelX = FloorC(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width;
|
||||
int RelZ = FloorC(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
BLOCKTYPE BlockType;
|
||||
if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire())
|
||||
{
|
||||
|
@ -210,7 +210,8 @@ NOISE_DATATYPE cNoise::IntNoise3D(int a_X, int a_Y, int a_Z) const
|
||||
int n = a_X + a_Y * 57 + a_Z * 57 * 57 + m_Seed * 57 * 57 * 57;
|
||||
n = (n << 13) ^ n;
|
||||
return (static_cast<NOISE_DATATYPE>(1) -
|
||||
static_cast<NOISE_DATATYPE>((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f);
|
||||
static_cast<NOISE_DATATYPE>((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f
|
||||
);
|
||||
// returns a float number in the range of [-1, 1]
|
||||
}
|
||||
|
||||
|
@ -127,13 +127,13 @@ protected:
|
||||
/** The callback used by PolarSSL when it wants to read encrypted data. */
|
||||
static int ReceiveEncrypted(void * a_This, unsigned char * a_Buffer, size_t a_NumBytes)
|
||||
{
|
||||
return (static_cast<cSslContext *>(a_This))->ReceiveEncrypted(a_Buffer, a_NumBytes);
|
||||
return (reinterpret_cast<cSslContext *>(a_This))->ReceiveEncrypted(a_Buffer, a_NumBytes);
|
||||
}
|
||||
|
||||
/** The callback used by PolarSSL when it wants to write encrypted data. */
|
||||
static int SendEncrypted(void * a_This, const unsigned char * a_Buffer, size_t a_NumBytes)
|
||||
{
|
||||
return (static_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes);
|
||||
return (reinterpret_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
@ -99,7 +99,7 @@ void cDelayedFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ,
|
||||
return;
|
||||
}
|
||||
|
||||
void * ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
|
||||
auto ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
|
||||
cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw);
|
||||
cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_AddSlotNum];
|
||||
|
||||
@ -132,7 +132,7 @@ void cDelayedFluidSimulator::Simulate(float a_Dt)
|
||||
|
||||
void cDelayedFluidSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk)
|
||||
{
|
||||
void * ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
|
||||
auto ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
|
||||
cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw);
|
||||
cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_SimSlotNum];
|
||||
|
||||
|
@ -260,7 +260,9 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i
|
||||
static_cast<double>(BlockX),
|
||||
static_cast<double>(a_RelY),
|
||||
static_cast<double>(BlockZ),
|
||||
0.5f, 1.5f);
|
||||
0.5f,
|
||||
1.5f
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -280,7 +282,9 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i
|
||||
static_cast<double>(BlockX),
|
||||
static_cast<double>(a_RelY),
|
||||
static_cast<double>(BlockZ),
|
||||
0.5f, 1.5f);
|
||||
0.5f,
|
||||
1.5f
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -267,10 +267,11 @@ void cSandSimulator::FinishFalling(
|
||||
cItems Pickups;
|
||||
Pickups.Add(static_cast<ENUM_ITEM_ID>(a_FallingBlockType), 1, a_FallingBlockMeta);
|
||||
a_World->SpawnItemPickups(
|
||||
Pickups,
|
||||
static_cast<double>(a_BlockX) + 0.5,
|
||||
static_cast<double>(a_BlockY) + 0.5,
|
||||
static_cast<double>(a_BlockZ) + 0.5);
|
||||
Pickups,
|
||||
static_cast<double>(a_BlockX) + 0.5,
|
||||
static_cast<double>(a_BlockY) + 0.5,
|
||||
static_cast<double>(a_BlockZ) + 0.5
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,9 @@ void cVaporizeFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ,
|
||||
static_cast<double>(a_BlockX),
|
||||
static_cast<double>(a_BlockY),
|
||||
static_cast<double>(a_BlockZ),
|
||||
1.0f, 0.6f);
|
||||
1.0f,
|
||||
0.6f
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,9 @@ cEnderChestWindow::cEnderChestWindow(cEnderChestEntity * a_EnderChest) :
|
||||
static_cast<double>(m_BlockX),
|
||||
static_cast<double>(m_BlockY),
|
||||
static_cast<double>(m_BlockZ),
|
||||
1, 1);
|
||||
1,
|
||||
1
|
||||
);
|
||||
|
||||
// Send out the chest-open packet:
|
||||
m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 1, E_BLOCK_ENDER_CHEST);
|
||||
@ -46,11 +48,12 @@ cEnderChestWindow::~cEnderChestWindow()
|
||||
|
||||
// Play the closing sound
|
||||
m_World->BroadcastSoundEffect(
|
||||
"random.chestclosed",
|
||||
static_cast<double>(m_BlockX),
|
||||
static_cast<double>(m_BlockY),
|
||||
static_cast<double>(m_BlockZ),
|
||||
1, 1);
|
||||
"random.chestclosed",
|
||||
static_cast<double>(m_BlockX),
|
||||
static_cast<double>(m_BlockY),
|
||||
static_cast<double>(m_BlockZ),
|
||||
1, 1
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -648,7 +648,7 @@ void cWebAdmin::OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_
|
||||
void cWebAdmin::OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, size_t a_Size)
|
||||
{
|
||||
UNUSED(a_Connection);
|
||||
cRequestData * Data = static_cast<cRequestData *>(a_Request.GetUserData());
|
||||
cRequestData * Data = reinterpret_cast<cRequestData *>(a_Request.GetUserData());
|
||||
if (Data == nullptr)
|
||||
{
|
||||
return;
|
||||
@ -681,7 +681,7 @@ void cWebAdmin::OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest &
|
||||
}
|
||||
|
||||
// Delete any request data assigned to the request:
|
||||
cRequestData * Data = static_cast<cRequestData *>(a_Request.GetUserData());
|
||||
cRequestData * Data = reinterpret_cast<cRequestData *>(a_Request.GetUserData());
|
||||
delete Data;
|
||||
Data = nullptr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user