commit
8a715db41f
|
@ -677,6 +677,7 @@ void cLuaState::Push(Vector3i * a_Vector)
|
|||
|
||||
void cLuaState::Push(void * a_Ptr)
|
||||
{
|
||||
UNUSED(a_Ptr);
|
||||
ASSERT(IsValid());
|
||||
|
||||
// Investigate the cause of this - what is the callstack?
|
||||
|
|
|
@ -42,8 +42,6 @@ cBlockInfo::~cBlockInfo()
|
|||
|
||||
cBlockInfo & cBlockInfo::Get(BLOCKTYPE a_Type)
|
||||
{
|
||||
ASSERT(a_Type < 256);
|
||||
|
||||
return ms_Info[a_Type];
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ class cBlockHandler
|
|||
public:
|
||||
cBlockHandler(BLOCKTYPE a_BlockType);
|
||||
|
||||
virtual ~cBlockHandler() {}
|
||||
|
||||
/// Called when the block gets ticked either by a random tick or by a queued tick.
|
||||
/// Note that the coords are chunk-relative!
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
|
||||
|
|
|
@ -25,6 +25,14 @@ public:
|
|||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
) override
|
||||
{
|
||||
UNUSED(a_ChunkInterface);
|
||||
UNUSED(a_BlockX);
|
||||
UNUSED(a_BlockY);
|
||||
UNUSED(a_BlockZ);
|
||||
UNUSED(a_CursorX);
|
||||
UNUSED(a_CursorY);
|
||||
UNUSED(a_CursorZ);
|
||||
UNUSED(a_BlockMeta);
|
||||
a_BlockType = m_BlockType;
|
||||
a_BlockMeta = RotationToMetaData(a_Player->GetYaw());
|
||||
switch (a_BlockFace)
|
||||
|
|
|
@ -23,6 +23,10 @@ public:
|
|||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
) override
|
||||
{
|
||||
UNUSED(a_Player);
|
||||
UNUSED(a_CursorX);
|
||||
UNUSED(a_CursorY);
|
||||
UNUSED(a_CursorZ);
|
||||
// TODO: Disallow placement where the vine doesn't attach to something properly
|
||||
BLOCKTYPE BlockType = 0;
|
||||
NIBBLETYPE BlockMeta;
|
||||
|
@ -161,11 +165,17 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void OnUpdate(cWorld * a_World, int X, int Y, int Z)
|
||||
virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ)
|
||||
{
|
||||
if (a_World->GetBlock(X, Y - 1, Z) == E_BLOCK_AIR)
|
||||
UNUSED(a_ChunkInterface);
|
||||
UNUSED(a_WorldInterface);
|
||||
UNUSED(a_BlockPluginInterface);
|
||||
|
||||
BLOCKTYPE Block;
|
||||
a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY - 1, a_RelZ, Block);
|
||||
if (Block == E_BLOCK_AIR)
|
||||
{
|
||||
a_World->SetBlock(X, Y - 1, Z, E_BLOCK_VINES, a_World->GetBlockMeta(X, Y, Z));
|
||||
a_Chunk.UnboundedRelSetBlock(a_RelX, a_RelY - 1, a_RelZ, E_BLOCK_VINES, a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@
|
|||
|
||||
|
||||
|
||||
#if 0
|
||||
#ifdef SELF_TEST
|
||||
|
||||
/// Self-test of the VarInt-reading and writing code
|
||||
class cByteBufferSelfTest
|
||||
static class cByteBufferSelfTest
|
||||
{
|
||||
public:
|
||||
cByteBufferSelfTest(void)
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
cByteBuffer buf(3);
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
int FreeSpace = buf.GetFreeSpace();
|
||||
size_t FreeSpace = buf.GetFreeSpace();
|
||||
assert(buf.GetReadableSpace() == 0);
|
||||
assert(FreeSpace > 0);
|
||||
assert(buf.Write("a", 1));
|
||||
|
@ -171,21 +171,22 @@ cByteBuffer::~cByteBuffer()
|
|||
|
||||
|
||||
|
||||
bool cByteBuffer::Write(const char * a_Bytes, int a_Count)
|
||||
bool cByteBuffer::Write(const char * a_Bytes, size_t a_Count)
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
|
||||
// Store the current free space for a check after writing:
|
||||
int CurFreeSpace = GetFreeSpace();
|
||||
int CurReadableSpace = GetReadableSpace();
|
||||
int WrittenBytes = 0;
|
||||
size_t CurFreeSpace = GetFreeSpace();
|
||||
size_t CurReadableSpace = GetReadableSpace();
|
||||
size_t WrittenBytes = 0;
|
||||
|
||||
if (CurFreeSpace < a_Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int TillEnd = m_BufferSize - m_WritePos;
|
||||
ASSERT(m_BufferSize >= m_WritePos);
|
||||
size_t TillEnd = m_BufferSize - m_WritePos;
|
||||
if (TillEnd <= a_Count)
|
||||
{
|
||||
// Need to wrap around the ringbuffer end
|
||||
|
@ -216,16 +217,20 @@ bool cByteBuffer::Write(const char * a_Bytes, int a_Count)
|
|||
|
||||
|
||||
|
||||
int cByteBuffer::GetFreeSpace(void) const
|
||||
size_t cByteBuffer::GetFreeSpace(void) const
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
if (m_WritePos >= m_DataStart)
|
||||
{
|
||||
// Wrap around the buffer end:
|
||||
ASSERT(m_BufferSize >= m_WritePos);
|
||||
ASSERT((m_BufferSize - m_WritePos + m_DataStart) >= 1);
|
||||
return m_BufferSize - m_WritePos + m_DataStart - 1;
|
||||
}
|
||||
// Single free space partition:
|
||||
ASSERT(m_BufferSize >= m_WritePos);
|
||||
ASSERT(m_BufferSize - m_WritePos >= 1);
|
||||
return m_DataStart - m_WritePos - 1;
|
||||
}
|
||||
|
||||
|
@ -234,10 +239,12 @@ int cByteBuffer::GetFreeSpace(void) const
|
|||
|
||||
|
||||
/// Returns the number of bytes that are currently in the ringbuffer. Note GetReadableBytes()
|
||||
int cByteBuffer::GetUsedSpace(void) const
|
||||
size_t cByteBuffer::GetUsedSpace(void) const
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
ASSERT(m_BufferSize >= GetFreeSpace());
|
||||
ASSERT((m_BufferSize - GetFreeSpace()) >= 1);
|
||||
return m_BufferSize - GetFreeSpace() - 1;
|
||||
}
|
||||
|
||||
|
@ -246,16 +253,18 @@ int cByteBuffer::GetUsedSpace(void) const
|
|||
|
||||
|
||||
/// Returns the number of bytes that are currently available for reading (may be less than UsedSpace due to some data having been read already)
|
||||
int cByteBuffer::GetReadableSpace(void) const
|
||||
size_t cByteBuffer::GetReadableSpace(void) const
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
if (m_ReadPos > m_WritePos)
|
||||
{
|
||||
// Wrap around the buffer end:
|
||||
ASSERT(m_BufferSize >= m_ReadPos);
|
||||
return m_BufferSize - m_ReadPos + m_WritePos;
|
||||
}
|
||||
// Single readable space partition:
|
||||
ASSERT(m_WritePos >= m_ReadPos);
|
||||
return m_WritePos - m_ReadPos ;
|
||||
}
|
||||
|
||||
|
@ -263,7 +272,7 @@ int cByteBuffer::GetReadableSpace(void) const
|
|||
|
||||
|
||||
|
||||
bool cByteBuffer::CanReadBytes(int a_Count) const
|
||||
bool cByteBuffer::CanReadBytes(size_t a_Count) const
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
|
@ -274,7 +283,7 @@ bool cByteBuffer::CanReadBytes(int a_Count) const
|
|||
|
||||
|
||||
|
||||
bool cByteBuffer::CanWriteBytes(int a_Count) const
|
||||
bool cByteBuffer::CanWriteBytes(size_t a_Count) const
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
|
@ -650,15 +659,14 @@ bool cByteBuffer::WriteLEInt(int a_Value)
|
|||
|
||||
|
||||
|
||||
bool cByteBuffer::ReadBuf(void * a_Buffer, int a_Count)
|
||||
bool cByteBuffer::ReadBuf(void * a_Buffer, size_t a_Count)
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
ASSERT(a_Count >= 0);
|
||||
NEEDBYTES(a_Count);
|
||||
char * Dst = (char *)a_Buffer; // So that we can do byte math
|
||||
int BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
|
||||
ASSERT(BytesToEndOfBuffer >= 0); // Sanity check
|
||||
ASSERT(m_BufferSize >= m_ReadPos);
|
||||
size_t BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
|
||||
if (BytesToEndOfBuffer <= a_Count)
|
||||
{
|
||||
// Reading across the ringbuffer end, read the first part and adjust parameters:
|
||||
|
@ -684,14 +692,14 @@ bool cByteBuffer::ReadBuf(void * a_Buffer, int a_Count)
|
|||
|
||||
|
||||
|
||||
bool cByteBuffer::WriteBuf(const void * a_Buffer, int a_Count)
|
||||
bool cByteBuffer::WriteBuf(const void * a_Buffer, size_t a_Count)
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
ASSERT(a_Count >= 0);
|
||||
PUTBYTES(a_Count);
|
||||
char * Src = (char *)a_Buffer; // So that we can do byte math
|
||||
int BytesToEndOfBuffer = m_BufferSize - m_WritePos;
|
||||
ASSERT(m_BufferSize >= m_ReadPos);
|
||||
size_t BytesToEndOfBuffer = m_BufferSize - m_WritePos;
|
||||
if (BytesToEndOfBuffer <= a_Count)
|
||||
{
|
||||
// Reading across the ringbuffer end, read the first part and adjust parameters:
|
||||
|
@ -714,22 +722,22 @@ bool cByteBuffer::WriteBuf(const void * a_Buffer, int a_Count)
|
|||
|
||||
|
||||
|
||||
bool cByteBuffer::ReadString(AString & a_String, int a_Count)
|
||||
bool cByteBuffer::ReadString(AString & a_String, size_t a_Count)
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
ASSERT(a_Count >= 0);
|
||||
NEEDBYTES(a_Count);
|
||||
a_String.clear();
|
||||
a_String.reserve(a_Count);
|
||||
int BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
|
||||
ASSERT(BytesToEndOfBuffer >= 0); // Sanity check
|
||||
ASSERT(m_BufferSize >= m_ReadPos);
|
||||
size_t BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
|
||||
if (BytesToEndOfBuffer <= a_Count)
|
||||
{
|
||||
// Reading across the ringbuffer end, read the first part and adjust parameters:
|
||||
if (BytesToEndOfBuffer > 0)
|
||||
{
|
||||
a_String.assign(m_Buffer + m_ReadPos, BytesToEndOfBuffer);
|
||||
ASSERT(a_Count >= BytesToEndOfBuffer);
|
||||
a_Count -= BytesToEndOfBuffer;
|
||||
}
|
||||
m_ReadPos = 0;
|
||||
|
@ -767,11 +775,10 @@ bool cByteBuffer::ReadUTF16String(AString & a_String, int a_NumChars)
|
|||
|
||||
|
||||
|
||||
bool cByteBuffer::SkipRead(int a_Count)
|
||||
bool cByteBuffer::SkipRead(size_t a_Count)
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
ASSERT(a_Count >= 0);
|
||||
if (!CanReadBytes(a_Count))
|
||||
{
|
||||
return false;
|
||||
|
@ -809,6 +816,7 @@ bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes)
|
|||
size_t num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes;
|
||||
VERIFY(ReadBuf(buf, num));
|
||||
VERIFY(a_Dst.Write(buf, num));
|
||||
ASSERT(a_NumBytes >= num);
|
||||
a_NumBytes -= num;
|
||||
}
|
||||
return true;
|
||||
|
@ -846,13 +854,15 @@ void cByteBuffer::ReadAgain(AString & a_Out)
|
|||
// Used by ProtoProxy to repeat communication twice, once for parsing and the other time for the remote party
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
int DataStart = m_DataStart;
|
||||
size_t DataStart = m_DataStart;
|
||||
if (m_ReadPos < m_DataStart)
|
||||
{
|
||||
// Across the ringbuffer end, read the first part and adjust next part's start:
|
||||
ASSERT(m_BufferSize >= m_DataStart);
|
||||
a_Out.append(m_Buffer + m_DataStart, m_BufferSize - m_DataStart);
|
||||
DataStart = 0;
|
||||
}
|
||||
ASSERT(m_ReadPos >= DataStart);
|
||||
a_Out.append(m_Buffer + DataStart, m_ReadPos - DataStart);
|
||||
}
|
||||
|
||||
|
@ -860,7 +870,7 @@ void cByteBuffer::ReadAgain(AString & a_Out)
|
|||
|
||||
|
||||
|
||||
void cByteBuffer::AdvanceReadPos(int a_Count)
|
||||
void cByteBuffer::AdvanceReadPos(size_t a_Count)
|
||||
{
|
||||
CHECK_THREAD;
|
||||
CheckValid();
|
||||
|
|
|
@ -31,25 +31,25 @@ public:
|
|||
~cByteBuffer();
|
||||
|
||||
/// Writes the bytes specified to the ringbuffer. Returns true if successful, false if not
|
||||
bool Write(const char * a_Bytes, int a_Count);
|
||||
bool Write(const char * a_Bytes, size_t a_Count);
|
||||
|
||||
/// Returns the number of bytes that can be successfully written to the ringbuffer
|
||||
int GetFreeSpace(void) const;
|
||||
size_t GetFreeSpace(void) const;
|
||||
|
||||
/// Returns the number of bytes that are currently in the ringbuffer. Note GetReadableBytes()
|
||||
int GetUsedSpace(void) const;
|
||||
size_t GetUsedSpace(void) const;
|
||||
|
||||
/// Returns the number of bytes that are currently available for reading (may be less than UsedSpace due to some data having been read already)
|
||||
int GetReadableSpace(void) const;
|
||||
size_t GetReadableSpace(void) const;
|
||||
|
||||
/// Returns the current data start index. For debugging purposes.
|
||||
int GetDataStart(void) const { return m_DataStart; }
|
||||
|
||||
/// Returns true if the specified amount of bytes are available for reading
|
||||
bool CanReadBytes(int a_Count) const;
|
||||
bool CanReadBytes(size_t a_Count) const;
|
||||
|
||||
/// Returns true if the specified amount of bytes are available for writing
|
||||
bool CanWriteBytes(int a_Count) const;
|
||||
bool CanWriteBytes(size_t a_Count) const;
|
||||
|
||||
// Read the specified datatype and advance the read pointer; return true if successfully read:
|
||||
bool ReadChar (char & a_Value);
|
||||
|
@ -92,19 +92,19 @@ public:
|
|||
bool WriteLEInt (int a_Value);
|
||||
|
||||
/// Reads a_Count bytes into a_Buffer; returns true if successful
|
||||
bool ReadBuf(void * a_Buffer, int a_Count);
|
||||
bool ReadBuf(void * a_Buffer, size_t a_Count);
|
||||
|
||||
/// Writes a_Count bytes into a_Buffer; returns true if successful
|
||||
bool WriteBuf(const void * a_Buffer, int a_Count);
|
||||
bool WriteBuf(const void * a_Buffer, size_t a_Count);
|
||||
|
||||
/// Reads a_Count bytes into a_String; returns true if successful
|
||||
bool ReadString(AString & a_String, int a_Count);
|
||||
bool ReadString(AString & a_String, size_t a_Count);
|
||||
|
||||
/// Reads 2 * a_NumChars bytes and interprets it as a UTF16-BE string, converting it into UTF8 string a_String
|
||||
bool ReadUTF16String(AString & a_String, int a_NumChars);
|
||||
|
||||
/// Skips reading by a_Count bytes; returns false if not enough bytes in the ringbuffer
|
||||
bool SkipRead(int a_Count);
|
||||
bool SkipRead(size_t a_Count);
|
||||
|
||||
/// Reads all available data into a_Data
|
||||
void ReadAll(AString & a_Data);
|
||||
|
@ -126,18 +126,18 @@ public:
|
|||
|
||||
protected:
|
||||
char * m_Buffer;
|
||||
int m_BufferSize; // Total size of the ringbuffer
|
||||
size_t m_BufferSize; // Total size of the ringbuffer
|
||||
|
||||
#ifdef _DEBUG
|
||||
volatile unsigned long m_ThreadID; // Thread that is currently accessing the object, checked via cSingleThreadAccessChecker
|
||||
#endif // _DEBUG
|
||||
|
||||
int m_DataStart; // Where the data starts in the ringbuffer
|
||||
int m_WritePos; // Where the data ends in the ringbuffer
|
||||
int m_ReadPos; // Where the next read will start in the ringbuffer
|
||||
size_t m_DataStart; // Where the data starts in the ringbuffer
|
||||
size_t m_WritePos; // Where the data ends in the ringbuffer
|
||||
size_t m_ReadPos; // Where the next read will start in the ringbuffer
|
||||
|
||||
/// Advances the m_ReadPos by a_Count bytes
|
||||
void AdvanceReadPos(int a_Count);
|
||||
void AdvanceReadPos(size_t a_Count);
|
||||
} ;
|
||||
|
||||
|
||||
|
|
|
@ -96,8 +96,8 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
|
|||
m_ShouldCheckDownloaded(false),
|
||||
m_NumExplosionsThisTick(0),
|
||||
m_UniqueID(0),
|
||||
m_Locale("en_GB"),
|
||||
m_HasSentPlayerChunk(false)
|
||||
m_HasSentPlayerChunk(false),
|
||||
m_Locale("en_GB")
|
||||
{
|
||||
m_Protocol = new cProtocolRecognizer(this);
|
||||
|
||||
|
|
|
@ -1031,9 +1031,9 @@ cMinecartWithChest::cMinecartWithChest(double a_X, double a_Y, double a_Z) :
|
|||
|
||||
|
||||
|
||||
void cMinecartWithChest::SetSlot(int a_Idx, const cItem & a_Item)
|
||||
void cMinecartWithChest::SetSlot(size_t a_Idx, const cItem & a_Item)
|
||||
{
|
||||
ASSERT((a_Idx >= 0) && (a_Idx < ARRAYCOUNT(m_Items)));
|
||||
ASSERT(a_Idx < ARRAYCOUNT(m_Items));
|
||||
|
||||
m_Items[a_Idx] = a_Item;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
const cItem & GetSlot(int a_Idx) const { return m_Items[a_Idx]; }
|
||||
cItem & GetSlot(int a_Idx) { return m_Items[a_Idx]; }
|
||||
|
||||
void SetSlot(int a_Idx, const cItem & a_Item);
|
||||
void SetSlot(size_t a_Idx, const cItem & a_Item);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual ~cMineShaft() {}
|
||||
|
||||
/// Returns true if this mineshaft intersects the specified cuboid
|
||||
bool DoesIntersect(const cCuboid & a_Other)
|
||||
{
|
||||
|
|
|
@ -595,7 +595,7 @@ void GetPineTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise
|
|||
{
|
||||
break;
|
||||
}
|
||||
ASSERT(LayerSize < ARRAYCOUNT(BigOs));
|
||||
ASSERT((size_t)LayerSize < ARRAYCOUNT(BigOs));
|
||||
PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigOs[LayerSize].Coords, BigOs[LayerSize].Count, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER);
|
||||
h--;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,9 @@ class cItemHandler
|
|||
public:
|
||||
cItemHandler(int a_ItemType);
|
||||
|
||||
// Force virtual destructor
|
||||
virtual ~cItemHandler() {}
|
||||
|
||||
/// Called when the player tries to use the item (right mouse button). Return false to make the item unusable. DEFAULT: False
|
||||
virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir);
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ private:
|
|||
public:
|
||||
|
||||
cSocketThread(cSocketThreads * a_Parent);
|
||||
~cSocketThread();
|
||||
virtual ~cSocketThread();
|
||||
|
||||
// All these methods assume parent's m_CS is locked
|
||||
bool HasEmptySlot(void) const {return m_NumSlots < MAX_SLOTS; }
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
virtual ~cProtocol() {}
|
||||
|
||||
/// Called when client sends some data
|
||||
virtual void DataReceived(const char * a_Data, int a_Size) = 0;
|
||||
virtual void DataReceived(const char * a_Data, size_t a_Size) = 0;
|
||||
|
||||
// Sending stuff to clients (alphabetically sorted):
|
||||
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) = 0;
|
||||
|
|
|
@ -1186,7 +1186,7 @@ void cProtocol125::SendData(const char * a_Data, int a_Size)
|
|||
|
||||
|
||||
|
||||
void cProtocol125::DataReceived(const char * a_Data, int a_Size)
|
||||
void cProtocol125::DataReceived(const char * a_Data, size_t a_Size)
|
||||
{
|
||||
if (!m_ReceivedData.Write(a_Data, a_Size))
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
cProtocol125(cClientHandle * a_Client);
|
||||
|
||||
/// Called when client sends some data:
|
||||
virtual void DataReceived(const char * a_Data, int a_Size) override;
|
||||
virtual void DataReceived(const char * a_Data, size_t a_Size) override;
|
||||
|
||||
/// Sending stuff to clients (alphabetically sorted):
|
||||
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
|
||||
|
@ -57,9 +57,17 @@ public:
|
|||
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
|
||||
virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override;
|
||||
virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override;
|
||||
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override {} // This protocol doesn't support such message
|
||||
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override
|
||||
{
|
||||
// This protocol doesn't support such message
|
||||
UNUSED(a_ID);
|
||||
UNUSED(a_Scale);
|
||||
}
|
||||
virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override;
|
||||
virtual void SendPaintingSpawn (const cPainting & a_Painting) override {};
|
||||
virtual void SendPaintingSpawn (const cPainting & a_Painting) override
|
||||
{
|
||||
UNUSED(a_Painting);
|
||||
};
|
||||
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
|
||||
virtual void SendPlayerAbilities (void) override {} // This protocol doesn't support such message
|
||||
virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
|
||||
|
@ -73,7 +81,12 @@ public:
|
|||
virtual void SendRespawn (void) override;
|
||||
virtual void SendExperience (void) override;
|
||||
virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override;
|
||||
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override {} // This protocol doesn't support such message
|
||||
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override
|
||||
{
|
||||
UNUSED(a_Name);
|
||||
UNUSED(a_DisplayName);
|
||||
UNUSED(a_Mode);
|
||||
} // This protocol doesn't support such message
|
||||
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override {} // This protocol doesn't support such message
|
||||
virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override {} // This protocol doesn't support such message
|
||||
virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8
|
||||
|
|
|
@ -108,7 +108,7 @@ cProtocol132::~cProtocol132()
|
|||
|
||||
|
||||
|
||||
void cProtocol132::DataReceived(const char * a_Data, int a_Size)
|
||||
void cProtocol132::DataReceived(const char * a_Data, size_t a_Size)
|
||||
{
|
||||
if (m_IsEncrypted)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
virtual ~cProtocol132();
|
||||
|
||||
/// Called when client sends some data:
|
||||
virtual void DataReceived(const char * a_Data, int a_Size) override;
|
||||
virtual void DataReceived(const char * a_Data, size_t a_Size) override;
|
||||
|
||||
// Sending commands (alphabetically sorted):
|
||||
virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
|
||||
|
|
|
@ -98,7 +98,7 @@ cProtocol172::cProtocol172(cClientHandle * a_Client, const AString & a_ServerAdd
|
|||
|
||||
|
||||
|
||||
void cProtocol172::DataReceived(const char * a_Data, int a_Size)
|
||||
void cProtocol172::DataReceived(const char * a_Data, size_t a_Size)
|
||||
{
|
||||
if (m_IsEncrypted)
|
||||
{
|
||||
|
@ -1244,7 +1244,7 @@ void cProtocol172::AddReceivedData(const char * a_Data, int a_Size)
|
|||
if (m_ReceivedData.GetReadableSpace() > 0)
|
||||
{
|
||||
AString AllData;
|
||||
int OldReadableSpace = m_ReceivedData.GetReadableSpace();
|
||||
size_t OldReadableSpace = m_ReceivedData.GetReadableSpace();
|
||||
m_ReceivedData.ReadAll(AllData);
|
||||
m_ReceivedData.ResetRead();
|
||||
m_ReceivedData.SkipRead(m_ReceivedData.GetReadableSpace() - OldReadableSpace);
|
||||
|
@ -1366,7 +1366,7 @@ void cProtocol172::AddReceivedData(const char * a_Data, int a_Size)
|
|||
if (g_ShouldLogCommIn && (m_ReceivedData.GetReadableSpace() > 0))
|
||||
{
|
||||
AString AllData;
|
||||
int OldReadableSpace = m_ReceivedData.GetReadableSpace();
|
||||
size_t OldReadableSpace = m_ReceivedData.GetReadableSpace();
|
||||
m_ReceivedData.ReadAll(AllData);
|
||||
m_ReceivedData.ResetRead();
|
||||
m_ReceivedData.SkipRead(m_ReceivedData.GetReadableSpace() - OldReadableSpace);
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
cProtocol172(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State);
|
||||
|
||||
/** Called when client sends some data: */
|
||||
virtual void DataReceived(const char * a_Data, int a_Size) override;
|
||||
virtual void DataReceived(const char * a_Data, size_t a_Size) override;
|
||||
|
||||
/** Sending stuff to clients (alphabetically sorted): */
|
||||
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
|
||||
|
|
|
@ -68,7 +68,7 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion)
|
|||
|
||||
|
||||
|
||||
void cProtocolRecognizer::DataReceived(const char * a_Data, int a_Size)
|
||||
void cProtocolRecognizer::DataReceived(const char * a_Data, size_t a_Size)
|
||||
{
|
||||
if (m_Protocol == NULL)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
static AString GetVersionTextFromInt(int a_ProtocolVersion);
|
||||
|
||||
/// Called when client sends some data:
|
||||
virtual void DataReceived(const char * a_Data, int a_Size) override;
|
||||
virtual void DataReceived(const char * a_Data, size_t a_Size) override;
|
||||
|
||||
/// Sending stuff to clients (alphabetically sorted):
|
||||
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
|
||||
|
|
|
@ -593,7 +593,6 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
|
|||
unsigned m_NameLength;
|
||||
const AString m_PlayerName;
|
||||
|
||||
cPlayerListCallback & m_Callback;
|
||||
virtual bool Item (cPlayer * a_pPlayer)
|
||||
{
|
||||
unsigned int Rating = RateCompareString (m_PlayerName, a_pPlayer->GetName());
|
||||
|
@ -615,18 +614,17 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
|
|||
}
|
||||
|
||||
public:
|
||||
cCallback (const AString & a_PlayerName, cPlayerListCallback & a_Callback) :
|
||||
cCallback (const AString & a_PlayerName) :
|
||||
m_BestRating(0),
|
||||
m_NameLength(a_PlayerName.length()),
|
||||
m_PlayerName(a_PlayerName),
|
||||
m_Callback(a_Callback),
|
||||
m_BestMatch(NULL),
|
||||
m_NumMatches(0)
|
||||
{}
|
||||
|
||||
cPlayer * m_BestMatch;
|
||||
unsigned m_NumMatches;
|
||||
} Callback (a_PlayerName, a_Callback);
|
||||
} Callback (a_PlayerName);
|
||||
ForEachPlayer( Callback );
|
||||
|
||||
if (Callback.m_NumMatches == 1)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
bool cDelayedFluidSimulatorChunkData::cSlot::Add(int a_RelX, int a_RelY, int a_RelZ)
|
||||
{
|
||||
ASSERT(a_RelZ >= 0);
|
||||
ASSERT(a_RelZ < ARRAYCOUNT(m_Blocks));
|
||||
ASSERT(a_RelZ < static_cast<int>(ARRAYCOUNT(m_Blocks)));
|
||||
|
||||
cCoordWithIntVector & Blocks = m_Blocks[a_RelZ];
|
||||
int Index = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
|
||||
|
|
Loading…
Reference in New Issue