Merge branch 'master' into cmake-fixes
This commit is contained in:
commit
173ed0e653
@ -19,5 +19,6 @@ SamJBarney
|
||||
worktycho
|
||||
Sxw1212
|
||||
tonibm19
|
||||
Diusrex
|
||||
|
||||
Please add yourself to this list if you contribute to MCServer.
|
||||
|
@ -28,6 +28,8 @@ template<typename Combinator> void InternalMergeBlocks(
|
||||
Combinator a_Combinator
|
||||
)
|
||||
{
|
||||
UNUSED(a_SrcSizeY);
|
||||
UNUSED(a_DstSizeY);
|
||||
for (int y = 0; y < a_SizeY; y++)
|
||||
{
|
||||
int SrcBaseY = (y + a_SrcOffY) * a_SrcSizeX * a_SrcSizeZ;
|
||||
|
@ -36,7 +36,14 @@ public:
|
||||
/** Called on each block encountered along the path, including the first block (path start), if chunk data is not loaded
|
||||
When this callback returns true, the tracing is aborted.
|
||||
*/
|
||||
virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace) { return false; }
|
||||
virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace)
|
||||
{
|
||||
UNUSED(a_BlockX);
|
||||
UNUSED(a_BlockY);
|
||||
UNUSED(a_BlockZ);
|
||||
UNUSED(a_EntryFace);
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Called when the path goes out of world, either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
|
||||
The coords specify the exact point at which the path exited the world.
|
||||
@ -44,7 +51,13 @@ public:
|
||||
Note that some paths can go out of the world and come back again (parabola),
|
||||
in such a case this callback is followed by OnIntoWorld() and further OnNextBlock() calls
|
||||
*/
|
||||
virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) { return false; }
|
||||
virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
|
||||
{
|
||||
UNUSED(a_BlockX);
|
||||
UNUSED(a_BlockY);
|
||||
UNUSED(a_BlockZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Called when the path goes into the world, from either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
|
||||
The coords specify the exact point at which the path entered the world.
|
||||
@ -52,7 +65,13 @@ public:
|
||||
Note that some paths can go out of the world and come back again (parabola),
|
||||
in such a case this callback is followed by further OnNextBlock() calls
|
||||
*/
|
||||
virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) { return false; }
|
||||
virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
|
||||
{
|
||||
UNUSED(a_BlockX);
|
||||
UNUSED(a_BlockY);
|
||||
UNUSED(a_BlockZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Called when the path is sure not to hit any more blocks.
|
||||
Note that for some shapes this might never happen (line with constant Y)
|
||||
|
@ -773,7 +773,7 @@ void cByteBuffer::ReadAll(AString & a_Data)
|
||||
|
||||
|
||||
|
||||
bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes)
|
||||
bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes)
|
||||
{
|
||||
if (!a_Dst.CanWriteBytes(a_NumBytes) || !CanReadBytes(a_NumBytes))
|
||||
{
|
||||
@ -781,9 +781,10 @@ bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes)
|
||||
return false;
|
||||
}
|
||||
char buf[1024];
|
||||
while (a_NumBytes > 0)
|
||||
// > 0 without generating warnings about unsigned comparisons where size_t is unsigned
|
||||
while (a_NumBytes != 0)
|
||||
{
|
||||
int num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes;
|
||||
size_t num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes;
|
||||
VERIFY(ReadBuf(buf, num));
|
||||
VERIFY(a_Dst.Write(buf, num));
|
||||
a_NumBytes -= num;
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
void ReadAll(AString & a_Data);
|
||||
|
||||
/// Reads the specified number of bytes and writes it into the destinatio bytebuffer. Returns true on success.
|
||||
bool ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes);
|
||||
bool ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes);
|
||||
|
||||
/// Removes the bytes that have been read from the ringbuffer
|
||||
void CommitRead(void);
|
||||
|
@ -1409,6 +1409,7 @@ void cClientHandle::SendData(const char * a_Data, int a_Size)
|
||||
|
||||
void cClientHandle::MoveToWorld(cWorld & a_World, bool a_SendRespawnPacket)
|
||||
{
|
||||
UNUSED(a_World);
|
||||
ASSERT(m_Player != NULL);
|
||||
|
||||
if (a_SendRespawnPacket)
|
||||
|
@ -908,8 +908,8 @@ bool cPlayer::IsGameModeSurvival(void) const
|
||||
|
||||
bool cPlayer::IsGameModeAdventure(void) const
|
||||
{
|
||||
return (m_GameMode == gmCreative) || // Either the player is explicitly in Adventure
|
||||
((m_GameMode == gmNotSet) && m_World->IsGameModeCreative()); // or they inherit from the world and the world is Adventure
|
||||
return (m_GameMode == gmAdventure) || // Either the player is explicitly in Adventure
|
||||
((m_GameMode == gmNotSet) && m_World->IsGameModeAdventure()); // or they inherit from the world and the world is Adventure
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,6 +57,8 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, bool a_ConsiderEmptySlo
|
||||
|
||||
int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int a_EndSlotNum, bool a_ConsiderEmptySlots)
|
||||
{
|
||||
|
||||
UNUSED(a_ConsiderEmptySlots);
|
||||
if ((a_BeginSlotNum < 0) || (a_BeginSlotNum >= invNumSlots))
|
||||
{
|
||||
LOGWARNING("%s: Bad BeginSlotNum, got %d, there are %d slots; correcting to 0.", __FUNCTION__, a_BeginSlotNum, invNumSlots - 1);
|
||||
@ -96,8 +98,6 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst)
|
||||
{
|
||||
cItem ToAdd(a_Item);
|
||||
|
@ -189,7 +189,7 @@ void cLightingThread::ChunkReady(int a_ChunkX, int a_ChunkZ)
|
||||
{
|
||||
if (
|
||||
(itr->x - a_ChunkX >= -1) && (itr->x - a_ChunkX <= 1) &&
|
||||
(itr->x - a_ChunkX >= -1) && (itr->x - a_ChunkX <= 1)
|
||||
(itr->z - a_ChunkZ >= -1) && (itr->z - a_ChunkZ <= 1)
|
||||
)
|
||||
{
|
||||
// It is a neighbor
|
||||
@ -495,6 +495,7 @@ void cLightingThread::CalcLightStep(
|
||||
int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut
|
||||
)
|
||||
{
|
||||
UNUSED(a_IsSeedIn);
|
||||
int NumSeedsOut = 0;
|
||||
for (int i = 0; i < a_NumSeedsIn; i++)
|
||||
{
|
||||
|
@ -196,7 +196,6 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk)
|
||||
ASSERT((m_CurrentY >= 0) && (m_CurrentY < cChunkDef::Height)); // This should be provided by FixStartAboveWorld() / FixStartBelowWorld()
|
||||
|
||||
// This is the actual line tracing loop.
|
||||
bool Finished = false;
|
||||
while (true)
|
||||
{
|
||||
// Report the current block through the callbacks:
|
||||
|
@ -173,6 +173,7 @@ void cServer::ClientMovedToWorld(const cClientHandle * a_Client)
|
||||
|
||||
void cServer::PlayerCreated(const cPlayer * a_Player)
|
||||
{
|
||||
UNUSED(a_Player);
|
||||
// To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread
|
||||
cCSLock Lock(m_CSPlayerCountDiff);
|
||||
m_PlayerCountDiff += 1;
|
||||
@ -184,6 +185,7 @@ void cServer::PlayerCreated(const cPlayer * a_Player)
|
||||
|
||||
void cServer::PlayerDestroying(const cPlayer * a_Player)
|
||||
{
|
||||
UNUSED(a_Player);
|
||||
// To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread
|
||||
cCSLock Lock(m_CSPlayerCountDiff);
|
||||
m_PlayerCountDiff -= 1;
|
||||
@ -514,6 +516,7 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallbac
|
||||
|
||||
void cServer::PrintHelp(const AStringVector & a_Split, cCommandOutputCallback & a_Output)
|
||||
{
|
||||
UNUSED(a_Split);
|
||||
typedef std::pair<AString, AString> AStringPair;
|
||||
typedef std::vector<AStringPair> AStringPairs;
|
||||
|
||||
@ -525,6 +528,8 @@ void cServer::PrintHelp(const AStringVector & a_Split, cCommandOutputCallback &
|
||||
|
||||
virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override
|
||||
{
|
||||
UNUSED(a_Plugin);
|
||||
UNUSED(a_Permission);
|
||||
if (!a_HelpString.empty())
|
||||
{
|
||||
m_Commands.push_back(AStringPair(a_Command, a_HelpString));
|
||||
|
@ -27,8 +27,14 @@ public:
|
||||
}
|
||||
|
||||
// cSimulator overrides:
|
||||
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override {}
|
||||
virtual void Simulate(float a_Dt) override {}
|
||||
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override
|
||||
{
|
||||
UNUSED(a_BlockX);
|
||||
UNUSED(a_BlockY);
|
||||
UNUSED(a_BlockZ);
|
||||
UNUSED(a_Chunk);
|
||||
}
|
||||
virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);}
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -305,6 +305,7 @@ void cWebAdmin::HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPReque
|
||||
|
||||
void cWebAdmin::HandleRootRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request)
|
||||
{
|
||||
UNUSED(a_Request);
|
||||
static const char LoginForm[] = \
|
||||
"<h1>MCServer WebAdmin</h1>" \
|
||||
"<center>" \
|
||||
@ -450,6 +451,7 @@ AString cWebAdmin::GetBaseURL(const AStringVector & a_URLSplit)
|
||||
|
||||
void cWebAdmin::OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_Request)
|
||||
{
|
||||
UNUSED(a_Connection);
|
||||
const AString & URL = a_Request.GetURL();
|
||||
if (
|
||||
(strncmp(URL.c_str(), "/webadmin", 9) == 0) ||
|
||||
@ -473,6 +475,7 @@ void cWebAdmin::OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_
|
||||
|
||||
void cWebAdmin::OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, int a_Size)
|
||||
{
|
||||
UNUSED(a_Connection);
|
||||
cRequestData * Data = (cRequestData *)(a_Request.GetUserData());
|
||||
if (Data == NULL)
|
||||
{
|
||||
|
@ -723,6 +723,7 @@ void cWorld::Tick(float a_Dt, int a_LastTickDurationMSec)
|
||||
|
||||
void cWorld::TickWeather(float a_Dt)
|
||||
{
|
||||
UNUSED(a_Dt);
|
||||
// There are no weather changes anywhere but in the Overworld:
|
||||
if (GetDimension() != dimOverworld)
|
||||
{
|
||||
@ -794,7 +795,7 @@ void cWorld::TickMobs(float a_Dt)
|
||||
cMonster::mfAmbient,
|
||||
cMonster::mfWater,
|
||||
} ;
|
||||
for (int i = 0; i < ARRAYCOUNT(AllFamilies); i++)
|
||||
for (size_t i = 0; i < ARRAYCOUNT(AllFamilies); i++)
|
||||
{
|
||||
cMonster::eFamily Family = AllFamilies[i];
|
||||
int SpawnDelay = cMonster::GetSpawnDelay(Family);
|
||||
@ -1643,6 +1644,7 @@ int cWorld::SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward)
|
||||
|
||||
void cWorld::SpawnPrimedTNT(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec, double a_InitialVelocityCoeff)
|
||||
{
|
||||
UNUSED(a_InitialVelocityCoeff);
|
||||
cTNTEntity * TNT = new cTNTEntity(a_X, a_Y, a_Z, a_FuseTimeInSec);
|
||||
TNT->Initialize(this);
|
||||
// TODO: Add a bit of speed in horiz and vert axes, based on the a_InitialVelocityCoeff
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
class cTask
|
||||
{
|
||||
public:
|
||||
virtual ~cTask(){};
|
||||
virtual void Run(cWorld & a_World) = 0;
|
||||
} ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user