1
0
Fork 0

Unified the doxy-comment format.

This commit is contained in:
Mattes D 2015-07-31 16:49:10 +02:00
parent 41d7119a38
commit 6e4122e551
114 changed files with 878 additions and 859 deletions

View File

@ -3,6 +3,10 @@
#include <memory>
template <class T>
class cAllocationPool
{
@ -12,100 +16,109 @@ public:
public:
virtual ~cStarvationCallbacks() {}
/** Is called when the reserve buffer starts to be used **/
/** Is called when the reserve buffer starts to be used */
virtual void OnStartUsingReserve() = 0;
/** Is called once the reserve buffer has returned to normal size **/
/** Is called once the reserve buffer has returned to normal size */
virtual void OnEndUsingReserve() = 0;
/** Is called when the allocation pool is unable to allocate memory. Will be repeatedly
called if it does not free sufficient memory **/
called if it does not free sufficient memory */
virtual void OnOutOfReserve() = 0;
};
virtual ~cAllocationPool() {}
/** Allocates a pointer to T **/
/** Allocates a pointer to T */
virtual T * Allocate() = 0;
/** Frees the pointer passed in a_ptr, invalidating it **/
/** Frees the pointer passed in a_ptr, invalidating it */
virtual void Free(T * a_ptr) = 0;
};
/** Allocates memory storing unused elements in a linked list. Keeps at least NumElementsInReserve
elements in the list unless malloc fails so that the program has a reserve to handle OOM.**/
elements in the list unless malloc fails so that the program has a reserve to handle OOM. */
template <class T, size_t NumElementsInReserve>
class cListAllocationPool : public cAllocationPool<T>
class cListAllocationPool:
public cAllocationPool<T>
{
public:
public:
cListAllocationPool(std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> a_Callbacks) :
m_Callbacks(std::move(a_Callbacks))
cListAllocationPool(std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> a_Callbacks):
m_Callbacks(std::move(a_Callbacks))
{
for (size_t i = 0; i < NumElementsInReserve; i++)
{
for (size_t i = 0; i < NumElementsInReserve; i++)
void * space = malloc(sizeof(T));
if (space == nullptr)
{
void * space = malloc(sizeof(T));
if (space == nullptr)
{
m_Callbacks->OnStartUsingReserve();
break;
}
m_FreeList.push_front(space);
m_Callbacks->OnStartUsingReserve();
break;
}
m_FreeList.push_front(space);
}
}
virtual ~cListAllocationPool()
virtual ~cListAllocationPool()
{
while (!m_FreeList.empty())
{
while (!m_FreeList.empty())
{
free (m_FreeList.front());
m_FreeList.pop_front();
}
}
virtual T * Allocate() override
{
if (m_FreeList.size() <= NumElementsInReserve)
{
void * space = malloc(sizeof(T));
if (space != nullptr)
{
return new(space) T;
}
else if (m_FreeList.size() == NumElementsInReserve)
{
m_Callbacks->OnStartUsingReserve();
}
else if (m_FreeList.empty())
{
m_Callbacks->OnOutOfReserve();
// Try again until the memory is avalable
return Allocate();
}
}
// placement new, used to initalize the object
T * ret = new (m_FreeList.front()) T;
free (m_FreeList.front());
m_FreeList.pop_front();
return ret;
}
virtual void Free(T * a_ptr) override
{
if (a_ptr == nullptr)
{
return;
}
// placement destruct.
a_ptr->~T();
m_FreeList.push_front(a_ptr);
if (m_FreeList.size() == NumElementsInReserve)
{
m_Callbacks->OnEndUsingReserve();
}
}
}
private:
std::list<void *> m_FreeList;
std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
virtual T * Allocate() override
{
if (m_FreeList.size() <= NumElementsInReserve)
{
void * space = malloc(sizeof(T));
if (space != nullptr)
{
return new(space) T;
}
else if (m_FreeList.size() == NumElementsInReserve)
{
m_Callbacks->OnStartUsingReserve();
}
else if (m_FreeList.empty())
{
m_Callbacks->OnOutOfReserve();
// Try again until the memory is avalable
return Allocate();
}
}
// placement new, used to initalize the object
T * ret = new (m_FreeList.front()) T;
m_FreeList.pop_front();
return ret;
}
virtual void Free(T * a_ptr) override
{
if (a_ptr == nullptr)
{
return;
}
// placement destruct.
a_ptr->~T();
m_FreeList.push_front(a_ptr);
if (m_FreeList.size() == NumElementsInReserve)
{
m_Callbacks->OnEndUsingReserve();
}
}
private:
std::list<void *> m_FreeList;
std::unique_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
};

View File

@ -31,8 +31,7 @@ To overcome this, this object overloads the Destroy functions, which doesn't let
delete the window, but rather leaves it dangling, with only Lua having the reference to it.
Additionally, to forbid Lua from deleting this object while it is used by players, the manual bindings for
cPlayer:OpenWindow check if the window is of this class, and if so, make a global Lua reference for this object.
This reference needs to be unreferenced in the Destroy() function.
*/
This reference needs to be unreferenced in the Destroy() function. */
// tolua_begin
class cLuaWindow :
public cWindow
@ -43,44 +42,43 @@ class cLuaWindow :
typedef cWindow super;
public:
/// Create a window of the specified type, with a slot grid of a_SlotsX * a_SlotsY size
/** Create a window of the specified type, with a slot grid of a_SlotsX * a_SlotsY size */
cLuaWindow(cWindow::WindowType a_WindowType, int a_SlotsX, int a_SlotsY, const AString & a_Title);
virtual ~cLuaWindow();
/// Returns the internal representation of the contents that are manipulated by Lua
/** Returns the internal representation of the contents that are manipulated by Lua */
cItemGrid & GetContents(void) { return m_Contents; }
// tolua_end
/** Sets the plugin reference and the internal Lua object reference index
used for preventing Lua's GC to collect this class while the window is open
*/
used for preventing Lua's GC to collect this class while the window is open. */
void SetLuaRef(cPluginLua * a_Plugin, int a_LuaRef);
/// Returns true if SetLuaRef() has been called
/** Returns true if SetLuaRef() has been called */
bool IsLuaReferenced(void) const;
/// Sets the callback function (Lua reference) to call when the window is about to close
/** Sets the callback function (Lua reference) to call when the window is about to close */
void SetOnClosing(cPluginLua * a_Plugin, int a_FnRef);
/// Sets the callback function (Lua reference) to call when a slot is changed
/** Sets the callback function (Lua reference) to call when a slot is changed */
void SetOnSlotChanged(cPluginLua * a_Plugin, int a_FnRef);
protected:
/// Contents of the non-inventory part
/** Contents of the non-inventory part */
cItemGrid m_Contents;
/// The plugin that has opened the window and owns the m_LuaRef
/** The plugin that has opened the window and owns the m_LuaRef */
cPluginLua * m_Plugin;
/// The Lua object reference, used for keeping the object alive as long as any player has the window open
/** The Lua object reference, used for keeping the object alive as long as any player has the window open */
int m_LuaRef;
/// The Lua reference for the callback to call when the window is closing for any player
/** The Lua reference for the callback to call when the window is closing for any player */
int m_OnClosingFnRef;
/// The Lua reference for the callback to call when a slot has changed
/** The Lua reference for the callback to call when a slot has changed */
int m_OnSlotChangedFnRef;
// cWindow overrides:

View File

@ -1945,7 +1945,7 @@ tolua_lerror:
/// Provides interface between a Lua table of callbacks and the cBlockTracer::cCallbacks
/** Provides interface between a Lua table of callbacks and the cBlockTracer::cCallbacks */
class cLuaBlockTracerCallbacks :
public cBlockTracer::cCallbacks
{

View File

@ -42,7 +42,7 @@ public:
// Called each tick
virtual void Tick(float a_Dt) = 0;
/** Calls the specified hook with the params given. Returns the bool that the hook callback returns.*/
/** Calls the specified hook with the params given. Returns the bool that the hook callback returns. */
virtual bool OnBlockSpread (cWorld & a_World, int a_BlockX, int a_BlockY, int a_BlockZ, eSpreadSource a_Source) = 0;
virtual bool OnBlockToPickups (cWorld & a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) = 0;
virtual bool OnChat (cPlayer & a_Player, AString & a_Message) = 0;

View File

@ -151,7 +151,7 @@ extern bool IsBiomeVeryCold(EMCSBiome a_Biome);
Doesn't report Very Cold biomes, use IsBiomeVeryCold() for those. */
extern bool IsBiomeCold(EMCSBiome a_Biome);
/** Returns the height when a biome when a biome starts snowing.*/
/** Returns the height when a biome when a biome starts snowing. */
extern int GetSnowStartHeight(EMCSBiome a_Biome);
// tolua_end

View File

@ -26,8 +26,8 @@
typedef void (CombinatorFunc)(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta);
// This wild construct allows us to pass a function argument and still have it inlined by the compiler :)
/// Merges two blocktypes and blockmetas of the specified sizes and offsets using the specified combinator function
/** Merges two blocktypes and blockmetas of the specified sizes and offsets using the specified combinator function
This wild construct allows us to pass a function argument and still have it inlined by the compiler. */
template <bool MetasValid, CombinatorFunc Combinator>
void InternalMergeBlocks(
BLOCKTYPE * a_DstTypes, const BLOCKTYPE * a_SrcTypes,
@ -73,7 +73,7 @@ void InternalMergeBlocks(
/// Combinator used for cBlockArea::msOverwrite merging
/** Combinator used for cBlockArea::msOverwrite merging */
template <bool MetaValid>
void MergeCombinatorOverwrite(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
{
@ -88,7 +88,7 @@ void MergeCombinatorOverwrite(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLE
/// Combinator used for cBlockArea::msFillAir merging
/** Combinator used for cBlockArea::msFillAir merging */
template <bool MetaValid>
void MergeCombinatorFillAir(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
{
@ -107,7 +107,7 @@ void MergeCombinatorFillAir(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETY
/// Combinator used for cBlockArea::msImprint merging
/** Combinator used for cBlockArea::msImprint merging */
template <bool MetaValid>
void MergeCombinatorImprint(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
{
@ -126,7 +126,7 @@ void MergeCombinatorImprint(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETY
/// Combinator used for cBlockArea::msLake merging
/** Combinator used for cBlockArea::msLake merging */
template <bool MetaValid>
void MergeCombinatorLake(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
{

View File

@ -63,9 +63,9 @@ public:
m_World = a_World;
}
/// Creates a new block entity for the specified block type
/// If a_World is valid, then the entity is created bound to that world
/// Returns nullptr for unknown block types
/** Creates a new block entity for the specified block type
If a_World is valid, then the entity is created bound to that world
Returns nullptr for unknown block types. */
static cBlockEntity * CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World = nullptr);
static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates
@ -102,15 +102,14 @@ public:
// tolua_end
/// Called when a player uses this entity; should open the UI window
/** Called when a player uses this entity; should open the UI window */
virtual void UsedBy( cPlayer * a_Player) = 0;
/** Sends the packet defining the block entity to the client specified.
To send to all eligible clients, use cWorld::BroadcastBlockEntity()
*/
To send to all eligible clients, use cWorld::BroadcastBlockEntity() */
virtual void SendTo(cClientHandle & a_Client) = 0;
/// Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. By default does nothing.
/** Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. By default does nothing. */
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
UNUSED(a_Dt);
@ -118,10 +117,10 @@ public:
}
protected:
/// Position in absolute block coordinates
/** Position in absolute block coordinates */
int m_PosX, m_PosY, m_PosZ;
/// Position relative to the chunk, used to speed up ticking
/** Position relative to the chunk, used to speed up ticking */
int m_RelX, m_RelZ;
BLOCKTYPE m_BlockType;

View File

@ -64,12 +64,12 @@ public:
void SetSlot(int a_SlotNum, const cItem & a_Item) { m_Contents.SetSlot(a_SlotNum, a_Item); }
void SetSlot(int a_X, int a_Y, const cItem & a_Item) { m_Contents.SetSlot(a_X, a_Y, a_Item); }
/// Returns the ItemGrid used for storing the contents
/** Returns the ItemGrid used for storing the contents */
cItemGrid & GetContents(void) { return m_Contents; }
// tolua_end
/// Const version of the GetContents() function for C++ type-safety
/** Const version of the GetContents() function for C++ type-safety */
const cItemGrid & GetContents(void) const { return m_Contents; }
protected:

View File

@ -30,7 +30,7 @@ public:
BLOCKENTITY_PROTODEF(cCommandBlockEntity)
/// Creates a new empty command block entity
/** Creates a new empty command block entity */
cCommandBlockEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
@ -43,29 +43,29 @@ public:
// tolua_begin
/// Sets the internal redstone power flag to "on" or "off", depending on the parameter. Calls Activate() if appropriate
/** Sets the internal redstone power flag to "on" or "off", depending on the parameter. Calls Activate() if appropriate */
virtual void SetRedstonePower(bool a_IsPowered) override;
/// Sets the command block to execute a command in the next tick
/** Sets the command block to execute a command in the next tick */
void Activate(void);
/// Sets the command
/** Sets the command */
void SetCommand(const AString & a_Cmd);
/// Retrieves stored command
/** Retrieves stored command */
const AString & GetCommand(void) const;
/// Retrieves the last line of output generated by the command block
/** Retrieves the last line of output generated by the command block */
const AString & GetLastOutput(void) const;
/// Retrieves the result (signal strength) of the last operation
/** Retrieves the result (signal strength) of the last operation */
NIBBLETYPE GetResult(void) const;
// tolua_end
private:
/// Executes the associated command
/** Executes the associated command */
void Execute();
bool m_ShouldExecute;

View File

@ -53,28 +53,28 @@ public:
// tolua_begin
/// Modifies the block coords to match the dropspenser direction given (where the dropspensed pickups should materialize)
/** Modifies the block coords to match the dropspenser direction given (where the dropspensed pickups should materialize) */
void AddDropSpenserDir(int & a_BlockX, int & a_BlockY, int & a_BlockZ, NIBBLETYPE a_Direction);
/// Sets the dropspenser to dropspense an item in the next tick
/** Sets the dropspenser to dropspense an item in the next tick */
void Activate(void);
// tolua_end
/// Sets the internal redstone power flag to "on" or "off", depending on the parameter. Calls Activate() if appropriate
/** Sets the internal redstone power flag to "on" or "off", depending on the parameter. Calls Activate() if appropriate */
virtual void SetRedstonePower(bool a_IsPowered) override;
protected:
bool m_ShouldDropSpense; ///< If true, the dropspenser will dropspense an item in the next tick
bool m_IsPowered; ///< Set to true when the dropspenser receives redstone power.
/// Does the actual work on dropspensing an item. Chooses the slot, calls DropSpenseFromSlot() and handles smoke / sound effects
/** Does the actual work on dropspensing an item. Chooses the slot, calls DropSpenseFromSlot() and handles smoke / sound effects */
void DropSpense(cChunk & a_Chunk);
/// Override this function to provide the specific behavior for item dropspensing (drop / shoot / pour / ...)
/** Override this function to provide the specific behavior for item dropspensing (drop / shoot / pour / ...) */
virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) = 0;
/// Helper function, drops one item from the specified slot (like a dropper)
/** Helper function, drops one item from the specified slot (like a dropper) */
void DropFromSlot(cChunk & a_Chunk, int a_SlotNum);
} ; // tolua_export

View File

@ -27,7 +27,7 @@ public:
BLOCKENTITY_PROTODEF(cDropperEntity)
/// Constructor used for normal operation
/** Constructor used for normal operation */
cDropperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
protected:
@ -36,8 +36,7 @@ protected:
/** Takes an item from slot a_SlotNum and puts it into the container in front of the dropper.
Called when there's a container directly in front of the dropper,
so the dropper should store items there, rather than dropping.
*/
so the dropper should store items there, rather than dropping. */
void PutIntoContainer(cChunk & a_Chunk, int a_SlotNum, BLOCKTYPE a_ContainerBlock, int a_ContainerX, int a_ContainerY, int a_ContainerZ);
} ; // tolua_export

View File

@ -28,9 +28,6 @@ cHopperEntity::cHopperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld *
/** Returns the block coords of the block receiving the output items, based on the meta
Returns false if unattached
*/
bool cHopperEntity::GetOutputBlockPos(NIBBLETYPE a_BlockMeta, int & a_OutputX, int & a_OutputY, int & a_OutputZ)
{
a_OutputX = m_PosX;
@ -115,7 +112,6 @@ void cHopperEntity::UsedBy(cPlayer * a_Player)
/// Opens a new window UI for this hopper
void cHopperEntity::OpenNewWindow(void)
{
OpenWindow(new cHopperWindow(m_PosX, m_PosY, m_PosZ, this));
@ -125,7 +121,6 @@ void cHopperEntity::OpenNewWindow(void)
/// Moves items from the container above it into this hopper. Returns true if the contents have changed.
bool cHopperEntity::MoveItemsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
{
if (m_PosY >= cChunkDef::Height)
@ -180,7 +175,6 @@ bool cHopperEntity::MoveItemsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
/// Moves pickups from above this hopper into it. Returns true if the contents have changed.
bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
{
UNUSED(a_CurrentTick);
@ -273,7 +267,6 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
/// Moves items out from this hopper into the destination. Returns true if the contents have changed.
bool cHopperEntity::MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick)
{
if (a_CurrentTick - m_LastMoveItemsOutTick < TICKS_PER_TRANSFER)
@ -352,7 +345,6 @@ 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.
bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
{
cChestEntity * MainChest = static_cast<cChestEntity *>(a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ));
@ -419,7 +411,6 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
/// Moves items from a furnace above the hopper into this hopper. Returns true if contents have changed.
bool cHopperEntity::MoveItemsFromFurnace(cChunk & a_Chunk)
{
cFurnaceEntity * Furnace = static_cast<cFurnaceEntity *>(a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ));
@ -479,7 +470,6 @@ bool cHopperEntity::MoveItemsFromGrid(cBlockEntityWithItems & a_Entity)
/// Moves one piece of the specified a_Entity's slot itemstack into this hopper. Returns true if contents have changed. Doesn't change the itemstack.
bool cHopperEntity::MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_SlotNum)
{
cItem One(a_Entity.GetSlot(a_SlotNum).CopyOne());
@ -521,7 +511,6 @@ bool cHopperEntity::MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_Sl
/// Moves items to the chest at the specified coords. Returns true if contents have changed
bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ)
{
// Try the chest directly connected to the hopper:
@ -589,7 +578,6 @@ 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
bool cHopperEntity::MoveItemsToFurnace(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_HopperMeta)
{
cFurnaceEntity * Furnace = static_cast<cFurnaceEntity *>(a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ));
@ -674,3 +662,7 @@ bool cHopperEntity::MoveItemsToSlot(cBlockEntityWithItems & a_Entity, int a_DstS
return false;
}
}

View File

@ -33,13 +33,12 @@ public:
BLOCKENTITY_PROTODEF(cHopperEntity)
/// Constructor used for normal operation
/** Constructor used for normal operation */
cHopperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
/** Returns the block coords of the block receiving the output items, based on the meta
Returns false if unattached.
Exported in ManualBindings.cpp
*/
Exported in ManualBindings.cpp. */
bool GetOutputBlockPos(NIBBLETYPE a_BlockMeta, int & a_OutputX, int & a_OutputY, int & a_OutputZ);
protected:
@ -52,40 +51,40 @@ protected:
virtual void SendTo(cClientHandle & a_Client) override;
virtual void UsedBy(cPlayer * a_Player) override;
/// Opens a new chest window for this chest. Scans for neighbors to open a double chest window, if appropriate.
/** Opens a new chest window for this chest. Scans for neighbors to open a double chest window, if appropriate. */
void OpenNewWindow(void);
/// Moves items from the container above it into this hopper. Returns true if the contents have changed.
/** Moves items from the container above it into this hopper. Returns true if the contents have changed. */
bool MoveItemsIn(cChunk & a_Chunk, Int64 a_CurrentTick);
/// Moves pickups from above this hopper into it. Returns true if the contents have changed.
/** Moves pickups from above this hopper into it. Returns true if the contents have changed. */
bool MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick);
/// Moves items out from this hopper into the destination. Returns true if the contents have changed.
/** Moves items out from this hopper into the destination. Returns true if the contents have changed. */
bool 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 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 MoveItemsFromFurnace(cChunk & a_Chunk);
/// Moves items from the specified a_Entity's Contents into this hopper. Returns true if contents have changed.
/** Moves items from the specified a_Entity's Contents into this hopper. Returns true if contents have changed. */
bool MoveItemsFromGrid(cBlockEntityWithItems & a_Entity);
/// Moves one piece from the specified itemstack into this hopper. Returns true if contents have changed. Doesn't change the itemstack.
/** Moves one piece from the specified itemstack into this hopper. Returns true if contents have changed. Doesn't change the itemstack. */
bool MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_SrcSlotNum);
/// Moves items to the chest at the specified coords. Returns true if contents have changed
/** Moves items to the chest at the specified coords. Returns true if contents have changed */
bool MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ);
/// 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 MoveItemsToFurnace(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_HopperMeta);
/// Moves items to the specified ItemGrid. Returns true if contents have changed
/** Moves items to the specified ItemGrid. Returns true if contents have changed */
bool MoveItemsToGrid(cBlockEntityWithItems & a_Entity);
/// Moves one piece to the specified entity's contents' slot. Returns true if contents have changed.
/** Moves one piece to the specified entity's contents' slot. Returns true if contents have changed. */
bool MoveItemsToSlot(cBlockEntityWithItems & a_Entity, int a_DstSlotNum);
} ; // tolua_export

View File

@ -36,7 +36,7 @@ public:
BLOCKENTITY_PROTODEF(cNoteEntity)
/// Creates a new note entity. a_World may be nullptr
/** Creates a new note entity. a_World may be nullptr */
cNoteEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
virtual ~cNoteEntity() {}

View File

@ -27,18 +27,18 @@ public:
BLOCKENTITY_PROTODEF(cSignEntity)
/// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be nullptr
/** Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be nullptr */
cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World);
// tolua_begin
/// Sets all the sign's lines
/** Sets all the sign's lines */
void SetLines(const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
/// Sets individual line (zero-based index)
/** Sets individual line (zero-based index) */
void SetLine(int a_Index, const AString & a_Line);
/// Retrieves individual line (zero-based index)
/** Retrieves individual line (zero-based index) */
AString GetLine(int a_Index) const;
// tolua_end

View File

@ -364,7 +364,7 @@ AString DimensionToString(eDimension a_Dimension)
/// Translates damage type constant to a string representation (built-in).
/** Translates damage type constant to a string representation (built-in) */
AString DamageTypeToString(eDamageType a_DamageType)
{
// Make sure to keep this alpha-sorted.
@ -399,7 +399,8 @@ AString DamageTypeToString(eDamageType a_DamageType)
/// Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 on failure
/** Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in).
Returns -1 on failure. */
eDamageType StringToDamageType(const AString & a_DamageTypeString)
{
// First try decoding as a number:

View File

@ -982,7 +982,7 @@ enum
/// Dimension of a world
/** Dimension of a world */
enum eDimension
{
dimNether = -1,
@ -995,7 +995,7 @@ enum eDimension
/// Damage type, used in the TakeDamageInfo structure and related functions
/** Damage type, used in the TakeDamageInfo structure and related functions */
enum eDamageType
{
// Canonical names for the types (as documented in the plugin wiki):
@ -1099,36 +1099,35 @@ class cIniFile;
// tolua_begin
/// Translates a blocktype string into blocktype. Takes either a number or an items.ini alias as input. Returns -1 on failure.
/** Translates a blocktype string into blocktype. Takes either a number or an items.ini alias as input. Returns -1 on failure. */
extern int BlockStringToType(const AString & a_BlockTypeString);
/// Translates an itemtype string into an item. Takes either a number, number^number, number:number or an items.ini alias as input. Returns true if successful.
/** Translates an itemtype string into an item. Takes either a number, number^number, number:number or an items.ini alias as input. Returns true if successful. */
extern bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item);
/// Translates a full item into a string. If the ItemType is not recognized, the ItemType number is output into the string.
/** Translates a full item into a string. If the ItemType is not recognized, the ItemType number is output into the string. */
extern AString ItemToString(const cItem & a_Item);
/// Translates itemtype into a string. If the type is not recognized, the itemtype number is output into the string.
/** Translates itemtype into a string. If the type is not recognized, the itemtype number is output into the string. */
extern AString ItemTypeToString(short a_ItemType);
/// Translates a full item into a fully-specified string (including meta and count). If the ItemType is not recognized, the ItemType number is output into the string.
/** Translates a full item into a fully-specified string (including meta and count). If the ItemType is not recognized, the ItemType number is output into the string. */
extern AString ItemToFullString(const cItem & a_Item);
/// Translates a dimension string to dimension enum. Takes either a number or a dimension alias (built-in). Returns dimOverworld on failure
/** Translates a dimension string to dimension enum. Takes either a number or a dimension alias (built-in). Returns dimOverworld on failure */
extern eDimension StringToDimension(const AString & a_DimensionString);
/** Translates a dimension enum to dimension string.
Takes an eDimension enum value and returns "Overworld" on failure
*/
Takes an eDimension enum value and returns "Overworld" on failure. */
extern AString DimensionToString(eDimension a_Dimension);
/// Translates damage type constant to a string representation (built-in).
/** Translates damage type constant to a string representation (built-in). */
extern AString DamageTypeToString(eDamageType a_DamageType);
/// Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 on failure
/** Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 on failure */
extern eDamageType StringToDamageType(const AString & a_DamageString);
/// Returns a cItem representing the item described in an IniFile's value; if the value doesn't exist, creates it with the provided default.
/** Returns a cItem representing the item described in an IniFile's value; if the value doesn't exist, creates it with the provided default. */
extern cItem GetIniItemSet(cIniFile & a_IniFile, const char * a_Section, const char * a_Key, const char * a_Default);
// tolua_end

View File

@ -88,7 +88,7 @@ public:
} ;
/// Creates the BlockTracer parent with the specified callbacks
/** Creates the BlockTracer parent with the specified callbacks */
cBlockTracer(cWorld & a_World, cCallbacks & a_Callbacks) :
m_World(&a_World),
m_Callbacks(&a_Callbacks)
@ -96,7 +96,7 @@ public:
}
/// Sets new world, returns the old one. Note that both need to be valid
/** Sets new world, returns the old one. Note that both need to be valid */
cWorld & SetWorld(cWorld & a_World)
{
cWorld & Old = *m_World;
@ -105,7 +105,7 @@ public:
}
/// Sets new callbacks, returns the old ones. Note that both need to be valid
/** Sets new callbacks, returns the old ones. Note that both need to be valid */
cCallbacks & SetCallbacks(cCallbacks & a_NewCallbacks)
{
cCallbacks & Old = *m_Callbacks;
@ -114,10 +114,10 @@ public:
}
protected:
/// The world upon which to operate
/** The world upon which to operate */
cWorld * m_World;
/// The callback to use for reporting
/** The callback to use for reporting */
cCallbacks * m_Callbacks;
} ;

View File

@ -26,15 +26,14 @@ public:
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!
/** 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);
/** Called before a block is placed into a world.
The handler should return true to allow placement, false to refuse.
Also, the handler should set a_BlockType and a_BlockMeta to correct values for the newly placed block.
Called by cItemHandler::GetPlacementBlockTypeMeta() if the item is a block
*/
Called by cItemHandler::GetPlacementBlockTypeMeta() if the item is a block */
virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
@ -50,10 +49,10 @@ public:
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, const sSetBlock & a_BlockChange
);
/// Called before the player has destroyed a block
/** Called before the player has destroyed a block */
virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ);
/// Called before a block gets destroyed / replaced with air
/** Called before a block gets destroyed / replaced with air */
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
/** Called when a direct neighbor of this block has been changed (The position is the block's own position, not the changing neighbor's position)
@ -71,13 +70,13 @@ public:
/** Called when the player starts digging the block. */
virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) {}
/// Called if the user right clicks the block and the block is useable
/** Called if the user right clicks the block and the block is useable */
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) {}
/** Called when a right click to this block is cancelled */
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) {}
/// <summary>Called when the item is mined to convert it into pickups. Pickups may specify multiple items. Appends items to a_Pickups, preserves its original contents</summary>
/** Called when the item is mined to convert it into pickups. Pickups may specify multiple items. Appends items to a_Pickups, preserves its original contents */
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta);
/** Handles the dropping, but not destruction, of a block based on what ConvertTo(Verbatim)Pickups() returns, including the spawning of pickups and alertion of plugins
@ -87,7 +86,7 @@ public:
*/
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop = true);
/// Checks if the block can stay at the specified relative coords in the chunk
/** Checks if the block can stay at the specified relative coords in the chunk */
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk);
/** Checks if the block can be placed at this point.
@ -130,24 +129,24 @@ public:
/** Returns the base colour ID of the block, as will be represented on a map, as per documentation: http://minecraft.gamepedia.com/Map_item_format */
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta);
/// <summary>Rotates a given block meta counter-clockwise. Default: no change</summary>
/// <returns>Block meta following rotation</returns>
/** Rotates a given block meta counter-clockwise. Default: no change
Returns block meta following rotation */
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) { return a_Meta; }
/// <summary>Rotates a given block meta clockwise. Default: no change</summary>
/// <returns>Block meta following rotation</returns>
/** Rotates a given block meta clockwise. Default: no change
Returns block meta following rotation */
virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) { return a_Meta; }
/// <summary>Mirros a given block meta around the XY plane. Default: no change</summary>
/// <returns>Block meta following mirroring</returns>
/** Mirrors a given block meta around the XY plane. Default: no change
Returns block meta following rotation */
virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) { return a_Meta; }
/// <summary>Mirros a given block meta around the XZ plane. Default: no change</summary>
/// <returns>Block meta following mirroring</returns>
/** Mirros a given block meta around the XZ plane. Default: no change
Returns block meta following rotation */
virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) { return a_Meta; }
/// <summary>Mirros a given block meta around the YZ plane. Default: no change</summary>
/// <returns>Block meta following mirroring</returns>
/** Mirros a given block meta around the YZ plane. Default: no change
Returns block meta following rotation */
virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) { return a_Meta; }
protected:

View File

@ -90,13 +90,13 @@ public:
private:
/// Returns true if the piston (specified by blocktype) is a sticky piston
/** Returns true if the piston (specified by blocktype) is a sticky piston */
static inline bool IsSticky(BLOCKTYPE a_BlockType) { return (a_BlockType == E_BLOCK_STICKY_PISTON); }
/// Returns true if the piston (with the specified meta) is extended
/** Returns true if the piston (with the specified meta) is extended */
static inline bool IsExtended(NIBBLETYPE a_PistonMeta) { return ((a_PistonMeta & 0x8) != 0x0); }
/// Returns true if the specified block can be pushed by a piston (and left intact)
/** Returns true if the specified block can be pushed by a piston (and left intact) */
static inline bool CanPush(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
{
switch (a_BlockType)
@ -141,7 +141,7 @@ private:
return true;
}
/// Returns true if the specified block can be pulled by a sticky piston
/** Returns true if the specified block can be pulled by a sticky piston */
static inline bool CanPull(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
{
if (cBlockInfo::IsPistonBreakable(a_BlockType))
@ -152,7 +152,7 @@ private:
return CanPush(a_BlockType, a_BlockMeta);
}
/// Returns how many blocks the piston has to push (where the first free space is); < 0 when unpushable
/** Returns how many blocks the piston has to push (where the first free space is); < 0 when unpushable */
static int FirstPassthroughBlock(int a_PistonX, int a_PistonY, int a_PistonZ, NIBBLETYPE a_PistonMeta, cWorld * a_World);
} ;

View File

@ -20,8 +20,7 @@
/** Represents two sets of coords, minimum and maximum for each direction.
All the coords within those limits (inclusive the edges) are considered "inside" the box.
For intersection purposes, though, if the intersection is "sharp" in any coord (i. e. zero volume),
the boxes are considered non-intersecting.
*/
the boxes are considered non-intersecting. */
class cBoundingBox
{
public:
@ -30,54 +29,52 @@ public:
cBoundingBox(const Vector3d & a_Pos, double a_Radius, double a_Height);
cBoundingBox(const cBoundingBox & a_Orig);
/// Moves the entire boundingbox by the specified offset
/** Moves the entire boundingbox by the specified offset */
void Move(double a_OffX, double a_OffY, double a_OffZ);
/// Moves the entire boundingbox by the specified offset
/** Moves the entire boundingbox by the specified offset */
void Move(const Vector3d & a_Off);
/// Expands the bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in each direction)
/** Expands the bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in each direction) */
void Expand(double a_ExpandX, double a_ExpandY, double a_ExpandZ);
/// Returns true if the two bounding boxes intersect
/** Returns true if the two bounding boxes intersect */
bool DoesIntersect(const cBoundingBox & a_Other);
/// Returns the union of the two bounding boxes
/** Returns the union of the two bounding boxes */
cBoundingBox Union(const cBoundingBox & a_Other);
/// Returns true if the point is inside the bounding box
/** Returns true if the point is inside the bounding box */
bool IsInside(const Vector3d & a_Point);
/// Returns true if the point is inside the bounding box
/** Returns true if the point is inside the bounding box */
bool IsInside(double a_X, double a_Y, double a_Z);
/// Returns true if a_Other is inside this bounding box
/** Returns true if a_Other is inside this bounding box */
bool IsInside(cBoundingBox & a_Other);
/// Returns true if a boundingbox specified by a_Min and a_Max is inside this bounding box
/** Returns true if a boundingbox specified by a_Min and a_Max is inside this bounding box */
bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max);
/// Returns true if the specified point is inside the bounding box specified by its min / max corners
/** Returns true if the specified point is inside the bounding box specified by its min / max corners */
static bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Point);
/// Returns true if the specified point is inside the bounding box specified by its min / max corners
/** Returns true if the specified point is inside the bounding box specified by its min / max corners */
static bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max, double a_X, double a_Y, double a_Z);
/** Returns true if this bounding box is intersected by the line specified by its two points
Also calculates the distance along the line in which the intersection occurs (0 .. 1)
Only forward collisions (a_LineCoeff >= 0) are returned.
*/
Only forward collisions (a_LineCoeff >= 0) are returned. */
bool CalcLineIntersection(const Vector3d & a_Line1, const Vector3d & a_Line2, double & a_LineCoeff, eBlockFace & a_Face);
/** Returns true if the specified bounding box is intersected by the line specified by its two points
Also calculates the distance along the line in which the intersection occurs (0 .. 1) and the face hit (BLOCK_FACE_ constants)
Only forward collisions (a_LineCoeff >= 0) are returned.
*/
Only forward collisions (a_LineCoeff >= 0) are returned. */
static bool CalcLineIntersection(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Line1, const Vector3d & a_Line2, double & a_LineCoeff, eBlockFace & a_Face);
// tolua_end
/// Calculates the intersection of the two bounding boxes; returns true if nonempty
/** Calculates the intersection of the two bounding boxes; returns true if nonempty */
bool Intersect(const cBoundingBox & a_Other, cBoundingBox & a_Intersection);
double GetMinX(void) const { return m_Min.x; }

View File

@ -262,7 +262,6 @@ size_t cByteBuffer::GetFreeSpace(void) const
/// Returns the number of bytes that are currently in the ringbuffer. Note GetReadableBytes()
size_t cByteBuffer::GetUsedSpace(void) const
{
CHECK_THREAD
@ -276,7 +275,6 @@ size_t 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)
size_t cByteBuffer::GetReadableSpace(void) const
{
CHECK_THREAD

View File

@ -127,6 +127,18 @@ local g_ViolationPatterns =
-- Check that all "//"-style comments have at least one spaces after:
{"%s//[^%s/*<]", "Needs a space after a \"//\"-style comment"},
-- Check that doxy-comments are used only in the double-asterisk form:
{"/// ", "Use doxycomments in the form /** Comment */"},
-- Check that /* */ comments have whitespace around the insides:
{"%*%*/", "Wrong comment termination, use */"},
{"/%*[^%s*/\"]", "Needs a space after /*"}, -- Need to take care of the special "//*/" comment ends
{"/%*%*[^%s*<]", "Needs a space after /**"},
{"[^%s/*]%*/", "Needs a space before */"},
-- Check against MS XML doxycomments:
{"/%*%* <", "Remove the MS XML markers from comment"},
-- Check that all commas have spaces after them and not in front of them:
{" ,", "Extra space before a \",\""},
{",[^%s\"%%\']", "Needs a space after a \",\""}, -- Report all except >> "," << needed for splitting and >>,%s<< needed for formatting

View File

@ -442,7 +442,6 @@ void cChunk::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlock
/// Returns true if there is a block entity at the coords specified
bool cChunk::HasBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ)
{
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)

View File

@ -17,8 +17,7 @@
/** Interface class used for getting data out of a chunk using the GetAllData() function.
Implementation must use the pointers immediately and NOT store any of them for later use
The virtual methods are called in the same order as they're declared here.
*/
The virtual methods are called in the same order as they're declared here. */
class cChunkDataCallback abstract
{
public:
@ -27,26 +26,25 @@ public:
/** Called before any other callbacks to inform of the current coords
(only in processes where multiple chunks can be processed, such as cWorld::ForEachChunkInRect()).
If false is returned, the chunk is skipped.
*/
If false is returned, the chunk is skipped. */
virtual bool Coords(int a_ChunkX, int a_ChunkZ) { UNUSED(a_ChunkX); UNUSED(a_ChunkZ); return true; }
/// Called once to provide heightmap data
/** Called once to provide heightmap data */
virtual void HeightMap(const cChunkDef::HeightMap * a_HeightMap) { UNUSED(a_HeightMap); }
/// Called once to provide biome data
/** Called once to provide biome data */
virtual void BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) { UNUSED(a_BiomeMap); }
/// Called once to let know if the chunk lighting is valid. Return value is ignored
/** Called once to let know if the chunk lighting is valid. Return value is ignored */
virtual void LightIsValid(bool a_IsLightValid) { UNUSED(a_IsLightValid); }
/// Called once to export block info
/** Called once to export block info */
virtual void ChunkData(const cChunkData & a_Buffer) { UNUSED(a_Buffer); }
/// Called for each entity in the chunk
/** Called for each entity in the chunk */
virtual void Entity(cEntity * a_Entity) { UNUSED(a_Entity); }
/// Called for each blockentity in the chunk
/** Called for each blockentity in the chunk */
virtual void BlockEntity(cBlockEntity * a_Entity) { UNUSED(a_Entity); }
} ;
@ -54,8 +52,7 @@ public:
/** A simple implementation of the cChunkDataCallback interface that collects all block data into a buffer
*/
/** A simple implementation of the cChunkDataCallback interface that collects all block data into a buffer */
class cChunkDataCollector :
public cChunkDataCallback
{
@ -75,8 +72,7 @@ protected:
/** A simple implementation of the cChunkDataCallback interface that collects all block data into a single buffer
*/
/** A simple implementation of the cChunkDataCallback interface that collects all block data into a single buffer */
class cChunkDataArrayCollector :
public cChunkDataCallback
{

View File

@ -39,13 +39,13 @@ typedef std::list<cBlockEntity *> cBlockEntityList;
// tolua_begin
/// The datatype used by blockdata
/** The datatype used by blockdata */
typedef unsigned char BLOCKTYPE;
/// The datatype used by nibbledata (meta, light, skylight)
/** The datatype used by nibbledata (meta, light, skylight) */
typedef unsigned char NIBBLETYPE;
/// The type used by the heightmap
/** The type used by the heightmap */
typedef unsigned char HEIGHTTYPE;
// tolua_end
@ -53,7 +53,7 @@ typedef unsigned char HEIGHTTYPE;
/// Constants used throughout the code, useful typedefs and utility functions
/** Constants used throughout the code, useful typedefs and utility functions */
class cChunkDef
{
public:
@ -61,22 +61,22 @@ public:
static const int Width = 16;
static const int Height = 256;
static const int NumBlocks = Width * Height * Width;
/// If the data is collected into a single buffer, how large it needs to be:
/** If the data is collected into a single buffer, how large it needs to be: */
static const int BlockDataSize = cChunkDef::NumBlocks * 2 + (cChunkDef::NumBlocks / 2); // 2.5 * numblocks
/// The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the highest non-air block in the column
/** The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the highest non-air block in the column */
typedef HEIGHTTYPE HeightMap[Width * Width];
/** The type used for any biomemap operations and storage inside MCServer,
using MCServer biomes (need not correspond to client representation!)
idx = x + Width * z // Need to verify this with the protocol spec, currently unknown!
*/
idx = x + Width * z */
typedef EMCSBiome BiomeMap[Width * Width];
/// The type used for block type operations and storage, AXIS_ORDER ordering
/** The type used for block type operations and storage, AXIS_ORDER ordering */
typedef BLOCKTYPE BlockTypes[NumBlocks];
/// The type used for block data in nibble format, AXIS_ORDER ordering
/** The type used for block data in nibble format, AXIS_ORDER ordering */
typedef NIBBLETYPE BlockNibbles[NumBlocks / 2];
/** The storage wrapper used for compressed blockdata residing in RAMz */
@ -86,7 +86,7 @@ public:
typedef std::vector<NIBBLETYPE> COMPRESSED_NIBBLETYPE;
/// Converts absolute block coords into relative (chunk + block) coords:
/** Converts absolute block coords into relative (chunk + block) coords: */
inline static void AbsoluteToRelative(/* in-out */ int & a_X, int & a_Y, int & a_Z, /* out */ int & a_ChunkX, int & a_ChunkZ)
{
UNUSED(a_Y);
@ -116,7 +116,7 @@ public:
}
/// Converts absolute block coords to chunk coords:
/** Converts absolute block coords to chunk coords: */
inline static void BlockToChunk(int a_X, int a_Z, int & a_ChunkX, int & a_ChunkZ)
{
a_ChunkX = a_X / Width;
@ -345,18 +345,17 @@ private:
/** Interface class used for comparing clients of two chunks.
Used primarily for entity moving while both chunks are locked.
*/
Used primarily for entity moving while both chunks are locked. */
class cClientDiffCallback
{
public:
virtual ~cClientDiffCallback() {}
/// Called for clients that are in Chunk1 and not in Chunk2,
/** Called for clients that are in Chunk1 and not in Chunk2, */
virtual void Removed(cClientHandle * a_Client) = 0;
/// Called for clients that are in Chunk2 and not in Chunk1.
/** Called for clients that are in Chunk2 and not in Chunk1. */
virtual void Added(cClientHandle * a_Client) = 0;
} ;
@ -418,6 +417,10 @@ public:
typedef std::list<cChunkCoords> cChunkCoordsList;
typedef std::vector<cChunkCoords> cChunkCoordsVector;
/** A simple hash function for chunk coords, we assume that chunk coords won't use more than 16 bits, so the hash is almost an identity.
Used for std::unordered_map<cChunkCoords, ...> */
class cChunkCoordsHash
@ -489,7 +492,7 @@ public:
/** Generic template that can store any kind of data together with a triplet of 3 coords*/
/** Generic template that can store any kind of data together with a triplet of 3 coords */
template <typename X> class cCoordWithData
{
public:

View File

@ -817,7 +817,6 @@ void cChunkMap::WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ)
/// Wakes up the simulators for the specified area of blocks
void cChunkMap::WakeUpSimulatorsInArea(int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ)
{
// Limit the Y coords:

View File

@ -103,7 +103,7 @@ public:
/** Calls the callback for the chunk specified, with ChunkMapCS locked; returns false if the chunk doesn't exist, otherwise returns the same value as the callback */
bool DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback & a_Callback);
/** Calls the callback for the chunk at the block position specified, with ChunkMapCS locked; returns false if the chunk doesn't exist, otherwise returns the same value as the callback **/
/** Calls the callback for the chunk at the block position specified, with ChunkMapCS locked; returns false if the chunk doesn't exist, otherwise returns the same value as the callback */
bool DoWithChunkAt(Vector3i a_BlockPos, std::function<bool(cChunk &)> a_Callback);
/** Wakes up simulators for the specified block */

View File

@ -23,7 +23,7 @@
// cNotifyChunkSender:
/// Callback that can be used to notify chunk sender upon another chunkcoord notification
/** Callback that can be used to notify chunk sender upon another chunkcoord notification */
class cNotifyChunkSender :
public cChunkCoordCallback
{
@ -43,12 +43,23 @@ class cNotifyChunkSender :
cChunkSender & m_ChunkSender;
cWorld & m_World;
public:
cNotifyChunkSender(cChunkSender & a_ChunkSender, cWorld & a_World) : m_ChunkSender(a_ChunkSender), m_World(a_World) {}
cNotifyChunkSender(cChunkSender & a_ChunkSender, cWorld & a_World):
m_ChunkSender(a_ChunkSender),
m_World(a_World)
{
}
};
////////////////////////////////////////////////////////////////////////////////
// cChunkSender:
cChunkSender::cChunkSender(cWorld & a_World) :
super("ChunkSender"),
m_World(a_World)

View File

@ -72,11 +72,11 @@ public:
void Stop(void);
/// Queues a chunk to be sent to a specific client
/** Queues a chunk to be sent to a specific client */
void QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, eChunkPriority a_Priority, cClientHandle * a_Client);
void QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, eChunkPriority a_Priority, std::list<cClientHandle *> a_Client);
/// Removes the a_Client from all waiting chunk send operations
/** Removes the a_Client from all waiting chunk send operations */
void RemoveClient(cClientHandle * a_Client);
protected:
@ -98,7 +98,7 @@ protected:
}
};
/// Used for sending chunks to specific clients
/** Used for sending chunks to specific clients */
struct sSendChunk
{
cChunkCoords m_Chunk;
@ -134,7 +134,7 @@ protected:
virtual void Entity (cEntity * a_Entity) override;
virtual void BlockEntity (cBlockEntity * a_Entity) override;
/// Sends the specified chunk to a_Client, or to all chunk clients if a_Client == nullptr
/** Sends the specified chunk to all the specified clients */
void SendChunk(int a_ChunkX, int a_ChunkZ, std::unordered_set<cClientHandle *> a_Clients);
} ;

View File

@ -56,8 +56,7 @@ public:
All the contained chunks are queued for loading / generating. */
void Enable (cChunkMap & a_ChunkMap);
/** Disables the ChunkStay, the chunks are released and the ChunkStay
object can be edited with Add() and Remove() again*/
/** Disables the ChunkStay, the chunks are released and the ChunkStay object can be edited with Add() and Remove() again */
virtual void Disable(void);
/** Returns all the chunks that should be kept */

View File

@ -108,7 +108,7 @@ public: // tolua_export
If the string given is not a valid UUID, returns false. */
static bool IsUUIDOnline(const AString & a_UUID); // tolua_export
/** Formats the type of message with the proper color and prefix for sending to the client. **/
/** Formats the type of message with the proper color and prefix for sending to the client. */
static AString FormatMessageType(bool ShouldAppendChatPrefixes, eMessageType a_ChatPrefix, const AString & a_AdditionalData);
static AString FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2);

View File

@ -9,20 +9,19 @@
/** Interface for a callback that receives command output
The Out() function is called for any output the command has produced.
Descendants override that function to provide specific processing of the output.
*/
Descendants override that function to provide specific processing of the output. */
class cCommandOutputCallback
{
public:
virtual ~cCommandOutputCallback() {} // Force a virtual destructor in subclasses
/// Syntax sugar function, calls Out() with Printf()-ed parameters; appends a newline"
/** Syntax sugar function, calls Out() with Printf()-ed parameters; appends a newline" */
void Out(const char * a_Fmt, ...) FORMATSTRING(2, 3);
/// Called when the command wants to output anything; may be called multiple times
/** Called when the command wants to output anything; may be called multiple times */
virtual void Out(const AString & a_Text) = 0;
/// Called when the command processing has been finished
/** Called when the command processing has been finished */
virtual void Finished(void) {}
} ;
@ -30,7 +29,7 @@ public:
/// Class that discards all command output
/** Class that discards all command output */
class cNullCommandOutputCallback :
public cCommandOutputCallback
{
@ -70,7 +69,7 @@ protected:
/// Sends all command output to a log, line by line, when the command finishes processing
/** Sends all command output to a log, line by line, when the command finishes processing */
class cLogCommandOutputCallback :
public cStringAccumCommandOutputCallback
{
@ -83,7 +82,7 @@ public:
/// Sends all command output to a log, line by line; deletes self when command finishes processing
/** Sends all command output to a log, line by line; deletes self when command finishes processing */
class cLogCommandDeleteSelfOutputCallback :
public cLogCommandOutputCallback
{

View File

@ -37,17 +37,17 @@ public:
void SetItem (int x, int y, const cItem & a_Item);
void Clear (void);
/// Removes items in a_Grid from m_Items[] (used by cCraftingRecipe::ConsumeIngredients())
/** Removes items in a_Grid from m_Items[] (used by cCraftingRecipe::ConsumeIngredients()) */
void ConsumeGrid(const cCraftingGrid & a_Grid);
/// Dumps the entire crafting grid using LOGD()
/** Dumps the entire crafting grid using LOGD() */
void Dump(void);
// tolua_end
cItem * GetItems(void) const {return m_Items; }
/// Copies internal contents into the item array specified. Assumes that the array has the same dimensions as self
/** Copies internal contents into the item array specified. Assumes that the array has the same dimensions as self */
void CopyToItems(cItem * a_Items) const;
protected:
@ -88,10 +88,10 @@ public:
m_Ingredients.SetItem(x, y, a_Item);
}
/// Consumes ingredients from the crafting grid specified
/** Consumes ingredients from the crafting grid specified */
void ConsumeIngredients(cCraftingGrid & a_CraftingGrid);
/// Dumps the entire recipe using LOGD()
/** Dumps the entire recipe using LOGD() */
void Dump(void);
// tolua_end
@ -114,7 +114,7 @@ public:
cCraftingRecipes(void);
~cCraftingRecipes();
/// Returns the recipe for current crafting grid. Doesn't modify the grid. Clears a_Recipe if no recipe found.
/** Returns the recipe for current crafting grid. Doesn't modify the grid. Clears a_Recipe if no recipe found. */
void GetRecipe(cPlayer & a_Player, cCraftingGrid & a_CraftingGrid, cCraftingRecipe & a_Recipe);
protected:
@ -127,8 +127,7 @@ protected:
typedef std::vector<cRecipeSlot> cRecipeSlots;
/** A single recipe, stored. Each recipe is normalized right after parsing (NormalizeIngredients())
A normalized recipe starts at (0, 0)
*/
A normalized recipe starts at (0, 0) */
struct cRecipe
{
cRecipeSlots m_Ingredients;
@ -145,31 +144,31 @@ protected:
void LoadRecipes(void);
void ClearRecipes(void);
/// Parses the recipe line and adds it into m_Recipes. a_LineNum is used for diagnostic warnings only
/** Parses the recipe line and adds it into m_Recipes. a_LineNum is used for diagnostic warnings only */
void AddRecipeLine(int a_LineNum, const AString & a_RecipeLine);
/// Parses an item string in the format "<ItemType>[^<Damage>]", returns true if successful.
/** Parses an item string in the format "<ItemType>[^<Damage>]", returns true if successful. */
bool ParseItem(const AString & a_String, cItem & a_Item);
/// Parses one ingredient and adds it to the specified recipe. Returns true if successful.
/** Parses one ingredient and adds it to the specified recipe. Returns true if successful. */
bool ParseIngredient(const AString & a_String, cRecipe * a_Recipe);
/// Moves the recipe to top-left corner, sets its MinWidth / MinHeight
/** Moves the recipe to top-left corner, sets its MinWidth / MinHeight */
void NormalizeIngredients(cRecipe * a_Recipe);
/// Finds a recipe matching the crafting grid. Returns a newly allocated recipe (with all its coords set) or nullptr if not found. Caller must delete return value!
/** Finds a recipe matching the crafting grid. Returns a newly allocated recipe (with all its coords set) or nullptr if not found. Caller must delete return value! */
cRecipe * FindRecipe(const cItem * a_CraftingGrid, int a_GridWidth, int a_GridHeight);
/// Same as FindRecipe, but the grid is guaranteed to be of minimal dimensions needed
/** Same as FindRecipe, but the grid is guaranteed to be of minimal dimensions needed */
cRecipe * FindRecipeCropped(const cItem * a_CraftingGrid, int a_GridWidth, int a_GridHeight, int a_GridStride);
/// Checks if the grid matches the specified recipe, offset by the specified offsets. Returns a matched cRecipe * if so, or nullptr if not matching. Caller must delete the return value!
/** Checks if the grid matches the specified recipe, offset by the specified offsets. Returns a matched cRecipe * if so, or nullptr if not matching. Caller must delete the return value! */
cRecipe * MatchRecipe(const cItem * a_CraftingGrid, int a_GridWidth, int a_GridHeight, int a_GridStride, const cRecipe * a_Recipe, int a_OffsetX, int a_OffsetY);
/** Searches for anything firework related, and does the data setting if appropriate */
void HandleFireworks(const cItem * a_CraftingGrid, cCraftingRecipes::cRecipe * a_Recipe, int a_GridStride, int a_OffsetX, int a_OffsetY);
/// Searches for anything dye related for leather, calculates the appropriate color value, and sets the resulting value.
/** Searches for anything dye related for leather, calculates the appropriate color value, and sets the resulting value. */
void HandleDyedLeather(const cItem * a_CraftingGrid, cCraftingRecipes::cRecipe * a_Recipe, int a_GridStride, int a_GridWidth, int a_GridHeight);
} ;

View File

@ -7,7 +7,7 @@
/// Returns true if the two specified intervals have a non-empty union
/** Returns true if the two specified intervals have a non-empty union */
static bool DoIntervalsIntersect(int a_Min1, int a_Max1, int a_Min2, int a_Max2)
{
return (

View File

@ -34,32 +34,32 @@ public:
protected:
struct sWorldAge
{
/// Last m_WorldAge that has been detected in this world
/** Last m_WorldAge that has been detected in this world */
Int64 m_Age;
/// Number of cycles for which the age has been the same
/** Number of cycles for which the age has been the same */
int m_NumCyclesSame;
} ;
/// Maps world name -> sWorldAge
/** Maps world name -> sWorldAge */
typedef std::map<AString, sWorldAge> WorldAges;
WorldAges m_WorldAges;
/// Number of secods for which the ages must be the same for the detection to trigger
/** Number of secods for which the ages must be the same for the detection to trigger */
int m_IntervalSec;
// cIsThread overrides:
virtual void Execute(void) override;
/// Sets the initial world age
/** Sets the initial world age */
void SetWorldAge(const AString & a_WorldName, Int64 a_Age);
/// Checks if the world's age has changed, updates the world's stats; calls DeadlockDetected() if deadlock detected
/** Checks if the world's age has changed, updates the world's stats; calls DeadlockDetected() if deadlock detected */
void CheckWorldAge(const AString & a_WorldName, Int64 a_Age);
/// Called when a deadlock is detected. Aborts the server.
/** Called when a deadlock is detected. Aborts the server. */
NORETURN void DeadlockDetected(void);
} ;

View File

@ -8,7 +8,7 @@
/// List of slot numbers, used for inventory-painting
/** List of slot numbers, used for inventory-painting */
typedef std::vector<int> cSlotNums;
@ -18,7 +18,7 @@ typedef std::vector<int> cSlotNums;
// tolua_begin
/// Experience Orb setup
/** Experience Orb setup */
enum
{
// Open to suggestion on naming convention here :)
@ -57,7 +57,7 @@ enum eBlockFace
/// PlayerDigging status constants
/** PlayerDigging status constants */
enum
{
DIG_STATUS_STARTED = 0,
@ -72,7 +72,7 @@ enum
/// Individual actions sent in the WindowClick packet
/** Individual actions sent in the WindowClick packet */
enum eClickAction
{
// Sorted by occurrence in the 1.5 protocol

View File

@ -1603,7 +1603,6 @@ void cEntity::HandleAir(void)
/// Called when the entity starts burning
void cEntity::OnStartedBurning(void)
{
// Broadcast the change:
@ -1614,7 +1613,6 @@ void cEntity::OnStartedBurning(void)
/// Called when the entity finishes burning
void cEntity::OnFinishedBurning(void)
{
// Broadcast the change:
@ -1625,7 +1623,6 @@ void cEntity::OnFinishedBurning(void)
/// Sets the maximum value for the health
void cEntity::SetMaxHealth(int a_MaxHealth)
{
m_MaxHealth = a_MaxHealth;
@ -1638,7 +1635,6 @@ void cEntity::SetMaxHealth(int a_MaxHealth)
/// Sets whether the entity is fireproof
void cEntity::SetIsFireproof(bool a_IsFireproof)
{
m_IsFireproof = a_IsFireproof;
@ -1648,7 +1644,6 @@ void cEntity::SetIsFireproof(bool a_IsFireproof)
/// Puts the entity on fire for the specified amount of ticks
void cEntity::StartBurning(int a_TicksLeftBurning)
{
if (m_TicksLeftBurning > 0)
@ -1666,7 +1661,6 @@ void cEntity::StartBurning(int a_TicksLeftBurning)
/// Stops the entity from burning, resets all burning timers
void cEntity::StopBurning(void)
{
bool HasBeenBurning = (m_TicksLeftBurning > 0);

View File

@ -173,7 +173,7 @@ public:
bool IsItemFrame (void) const { return (m_EntityType == etItemFrame); }
bool IsPainting (void) const { return (m_EntityType == etPainting); }
/// Returns true if the entity is of the specified class or a subclass (cPawn's IsA("cEntity") returns true)
/** Returns true if the entity is of the specified class or a subclass (cPawn's IsA("cEntity") returns true) */
virtual bool IsA(const char * a_ClassName) const;
/** Returns the class name of this class */
@ -255,16 +255,16 @@ public:
inline UInt32 GetUniqueID(void) const { return m_UniqueID; }
inline bool IsDestroyed(void) const { return !m_IsInitialized; }
/// Schedules the entity for destroying; if a_ShouldBroadcast is set to true, broadcasts the DestroyEntity packet
/** Schedules the entity for destroying; if a_ShouldBroadcast is set to true, broadcasts the DestroyEntity packet */
void Destroy(bool a_ShouldBroadcast = true);
/// Makes this pawn take damage from an attack by a_Attacker. Damage values are calculated automatically and DoTakeDamage() called
/** Makes this pawn take damage from an attack by a_Attacker. Damage values are calculated automatically and DoTakeDamage() called */
void TakeDamage(cEntity & a_Attacker);
/// Makes this entity take the specified damage. The final damage is calculated using current armor, then DoTakeDamage() called
/** Makes this entity take the specified damage. The final damage is calculated using current armor, then DoTakeDamage() called */
void TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_RawDamage, double a_KnockbackAmount);
/// Makes this entity take the specified damage. The values are packed into a TDI, knockback calculated, then sent through DoTakeDamage()
/** Makes this entity take the specified damage. The values are packed into a TDI, knockback calculated, then sent through DoTakeDamage() */
void TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_RawDamage, int a_FinalDamage, double a_KnockbackAmount);
float GetGravity(void) const { return m_Gravity; }
@ -275,10 +275,10 @@ public:
void SetAirDrag(float a_AirDrag) { m_AirDrag = a_AirDrag; }
/// Sets the rotation to match the speed vector (entity goes "face-forward")
/** Sets the rotation to match the speed vector (entity goes "face-forward") */
void SetYawFromSpeed(void);
/// Sets the pitch to match the speed vector (entity gies "face-forward")
/** Sets the pitch to match the speed vector (entity gies "face-forward") */
void SetPitchFromSpeed(void);
// tolua_end
@ -290,56 +290,56 @@ public:
// tolua_begin
/// Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items
/** Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items */
virtual int GetRawDamageAgainst(const cEntity & a_Receiver);
/** Returns whether armor will protect against the passed damage type **/
/** Returns whether armor will protect against the passed damage type */
virtual bool ArmorCoversAgainst(eDamageType a_DamageType);
/// Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover
/** Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover */
virtual int GetArmorCoverAgainst(const cEntity * a_Attacker, eDamageType a_DamageType, int a_RawDamage);
/// Returns the knockback amount that the currently equipped items would cause to a_Receiver on a hit
/** Returns the knockback amount that the currently equipped items would cause to a_Receiver on a hit */
virtual double GetKnockbackAmountAgainst(const cEntity & a_Receiver);
/// Returns the curently equipped weapon; empty item if none
/** Returns the curently equipped weapon; empty item if none */
virtual cItem GetEquippedWeapon(void) const { return cItem(); }
/// Returns the currently equipped helmet; empty item if none
/** Returns the currently equipped helmet; empty item if none */
virtual cItem GetEquippedHelmet(void) const { return cItem(); }
/// Returns the currently equipped chestplate; empty item if none
/** Returns the currently equipped chestplate; empty item if none */
virtual cItem GetEquippedChestplate(void) const { return cItem(); }
/// Returns the currently equipped leggings; empty item if none
/** Returns the currently equipped leggings; empty item if none */
virtual cItem GetEquippedLeggings(void) const { return cItem(); }
/// Returns the currently equipped boots; empty item if none
/** Returns the currently equipped boots; empty item if none */
virtual cItem GetEquippedBoots(void) const { return cItem(); }
/// Called when the health drops below zero. a_Killer may be nullptr (environmental damage)
/** Called when the health drops below zero. a_Killer may be nullptr (environmental damage) */
virtual void KilledBy(TakeDamageInfo & a_TDI);
/// Called when the entity kills another entity
/** Called when the entity kills another entity */
virtual void Killed(cEntity * a_Victim) {}
/// Heals the specified amount of HPs
/** Heals the specified amount of HPs */
virtual void Heal(int a_HitPoints);
/// Returns the health of this entity
/** Returns the health of this entity */
int GetHealth(void) const { return m_Health; }
/// Sets the health of this entity; doesn't broadcast any hurt animation
/** Sets the health of this entity; doesn't broadcast any hurt animation */
void SetHealth(int a_Health);
// tolua_end
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk);
/// Handles the physics of the entity - updates position based on speed, updates speed based on environment
/** Handles the physics of the entity - updates position based on speed, updates speed based on environment */
virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk);
/// Updates the state related to this entity being on fire
/** Updates the state related to this entity being on fire */
virtual void TickBurning(cChunk & a_Chunk);
/** Detects the time for application of cacti damage */
@ -380,8 +380,7 @@ public:
// tolua_end
/** Descendants override this function to send a command to the specified client to spawn the entity on the client.
To spawn on all eligible clients, use cChunkMap::BroadcastSpawnEntity()
*/
To spawn on all eligible clients, use cChunkMap::BroadcastSpawnEntity() */
virtual void SpawnOn(cClientHandle & a_Client) = 0;
// tolua_begin
@ -413,22 +412,22 @@ public:
/** Sets the world the entity will be leaving */
void SetWorldTravellingFrom(cWorld * a_World) { m_WorldTravellingFrom = a_World; }
/// Updates clients of changes in the entity.
/** Updates clients of changes in the entity. */
virtual void BroadcastMovementUpdate(const cClientHandle * a_Exclude = nullptr);
/// Attaches to the specified entity; detaches from any previous one first
/** Attaches to the specified entity; detaches from any previous one first */
void AttachTo(cEntity * a_AttachTo);
/// Detaches from the currently attached entity, if any
/** Detaches from the currently attached entity, if any */
virtual void Detach(void);
/// Makes sure head yaw is not over the specified range.
/** Makes sure head yaw is not over the specified range. */
void WrapHeadYaw();
/// Makes sure rotation is not over the specified range.
/** Makes sure rotation is not over the specified range. */
void WrapRotation();
/// Makes speed is not over 20. Max speed is 20 blocks / second
/** Makes speed is not over 20. Max speed is 20 blocks / second */
void WrapSpeed();
// tolua_begin
@ -443,8 +442,10 @@ public:
/** Returns whether the player is swimming or not */
virtual bool IsSwimming(void) const{ return m_IsSwimming; }
/** Return whether the player is under water or not */
virtual bool IsSubmerged(void) const{ return m_IsSubmerged; }
/** Gets remaining air of a monster */
int GetAirLevel(void) const { return m_AirLevel; }
@ -462,10 +463,10 @@ public:
// tolua_end
/// Called when the specified player right-clicks this entity
/** Called when the specified player right-clicks this entity */
virtual void OnRightClicked(cPlayer & a_Player) {}
/// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy().
/** Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy(). */
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr)
{
UNUSED(a_Drops);
@ -476,6 +477,17 @@ public:
void SetWorld(cWorld * a_World) { m_World = a_World; }
protected:
/** Structure storing the portal delay timer and cooldown boolean */
struct sPortalCooldownData
{
/** Ticks since entry of portal, used to delay teleportation */
unsigned short m_TicksDelayed;
/** Whether the entity has just exited the portal, and should therefore not be teleported again.
This prevents teleportation loops, and is reset when the entity has moved out of the portal. */
bool m_ShouldPreventTeleportation;
};
static cCriticalSection m_CSCount;
static UInt32 m_EntityCount;
@ -490,10 +502,10 @@ protected:
int m_Health;
int m_MaxHealth;
/// The entity to which this entity is attached (vehicle), nullptr if none
/** The entity to which this entity is attached (vehicle), nullptr if none */
cEntity * m_AttachedTo;
/// The entity which is attached to this entity (rider), nullptr if none
/** The entity which is attached to this entity (rider), nullptr if none */
cEntity * m_Attachee;
/** Stores whether head yaw has been set manually */
@ -526,10 +538,9 @@ protected:
/** True when entity is initialised (Initialize()) and false when destroyed pending deletion (Destroy()) */
bool m_IsInitialized;
/** World entity is travelling from
Set to a valid world pointer by MoveToWorld; reset to nullptr when the entity is removed from the old world
Can't be a simple boolean as context switches between worlds may leave the new chunk processing (and therefore immediately removing) the entity before the old chunk could remove it
*/
/** World entity is travelling from (such as when using portals).
Set to a valid world pointer by MoveToWorld; reset to nullptr when the entity is removed from the old world.
Can't be a simple boolean as context switches between worlds may leave the new chunk processing (and therefore immediately removing) the entity before the old chunk could remove it. */
cWorld * m_WorldTravellingFrom;
eEntityType m_EntityType;
@ -560,6 +571,20 @@ protected:
/** Time, in ticks, since the last damage dealt by the void. Reset to zero when moving out of the void. */
int m_TicksSinceLastVoidDamage;
/** If an entity is currently swimming in or submerged under water */
bool m_IsSwimming, m_IsSubmerged;
/** Air level of a mobile */
int m_AirLevel;
int m_AirTickTimer;
/** Portal delay timer and cooldown boolean data */
sPortalCooldownData m_PortalCooldownData;
/** The number of ticks this entity has been alive for */
long int m_TicksAlive;
/** Does the actual speed-setting. The default implementation just sets the member variable value;
overrides can provide further processing, such as forcing players to move at the given speed. */
virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ);
@ -568,8 +593,7 @@ protected:
/** Applies friction to an entity
@param a_Speed The speed vector to apply changes to
@param a_SlowdownMultiplier The factor to reduce the speed by
*/
@param a_SlowdownMultiplier The factor to reduce the speed by */
static void ApplyFriction(Vector3d & a_Speed, double a_SlowdownMultiplier, float a_Dt);
/** Called in each tick to handle air-related processing i.e. drowning */
@ -578,31 +602,6 @@ protected:
/** Called once per tick to set IsSwimming and IsSubmerged */
virtual void SetSwimState(cChunk & a_Chunk);
/** If an entity is currently swimming in or submerged under water */
bool m_IsSwimming, m_IsSubmerged;
/** Air level of a mobile */
int m_AirLevel;
int m_AirTickTimer;
/** Structure storing the portal delay timer and cooldown boolean */
struct sPortalCooldownData
{
/** Ticks since entry of portal, used to delay teleportation */
unsigned short m_TicksDelayed;
/** Whether the entity has just exited the portal, and should therefore not be teleported again
This prevents teleportation loops, and is reset when the entity has moved out of the portal
*/
bool m_ShouldPreventTeleportation;
};
/** Portal delay timer and cooldown boolean data */
sPortalCooldownData m_PortalCooldownData;
/** The number of ticks this entity has been alive for */
long int m_TicksAlive;
private:
/** Measured in degrees, [-180, +180) */
double m_HeadYaw;

View File

@ -22,7 +22,7 @@ class cFallingBlock :
public:
CLASS_PROTODEF(cFallingBlock)
/// Creates a new falling block. a_BlockPosition is expected in world coords
/** Creates a new falling block. a_BlockPosition is expected in world coords */
cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
BLOCKTYPE GetBlockType(void) const { return m_BlockType; }

View File

@ -54,10 +54,10 @@ public:
return false;
}
/// Returns the nearest entity that was hit, after the enumeration has been completed
/** Returns the nearest entity that was hit, after the enumeration has been completed */
cEntity * GetHitEntity(void) const { return m_HitEntity; }
/// Returns true if the callback has encountered a true hit
/** Returns true if the callback has encountered a true hit */
bool HasHit(void) const { return (m_MinCoeff < 1); }
protected:

View File

@ -29,7 +29,7 @@
/// Converts an angle in radians into a byte representation used by the network protocol
/** Converts an angle in radians into a byte representation used by the network protocol */
#define ANGLE_TO_PROTO(X) static_cast<Byte>(X * 255 / 360)
@ -190,13 +190,13 @@ public:
return false;
}
/// Returns the nearest entity that was hit, after the enumeration has been completed
/** Returns the nearest entity that was hit, after the enumeration has been completed */
cEntity * GetHitEntity(void) const { return m_HitEntity; }
/// Returns the line coeff where the hit was encountered, after the enumeration has been completed
/** Returns the line coeff where the hit was encountered, after the enumeration has been completed */
double GetMinCoeff(void) const { return m_MinCoeff; }
/// Returns true if the callback has encountered a true hit
/** Returns true if the callback has encountered a true hit */
bool HasHit(void) const { return (m_MinCoeff < 1); }
protected:

View File

@ -8,9 +8,13 @@
/// Converts an angle in radians into a byte representation used by the network protocol
/** Converts an angle in radians into a byte representation used by the network protocol */
#define ANGLE_TO_PROTO(X) static_cast<Byte>(X * 255 / 360)
////////////////////////////////////////////////////////////////////////////////
// cSplashPotionEntityCallback:

View File

@ -41,7 +41,7 @@ protected:
/// A simple cache that stores N most recently generated chunks' biomes; N being settable upon creation
/** A simple cache that stores N most recently generated chunks' biomes; N being settable upon creation */
class cBioGenCache :
public cBiomeGen
{
@ -112,7 +112,7 @@ protected:
/// Base class for generators that use a list of available biomes. This class takes care of the list.
/** Base class for generators that use a list of available biomes. This class takes care of the list. */
class cBiomeGenList :
public cBiomeGen
{
@ -124,7 +124,7 @@ protected:
EMCSBiomes m_Biomes;
int m_BiomesCount; // Pulled out of m_Biomes for faster access
/// Parses the INI file setting string into m_Biomes.
/** Parses the INI file setting string into m_Biomes. */
void InitializeBiomes(const AString & a_Biomes);
} ;
@ -188,20 +188,20 @@ public:
}
protected:
/// Noise used for the distortion
/** Noise used for the distortion */
cNoise m_Noise;
/// The underlying Voronoi map of the biomes
/** The underlying Voronoi map of the biomes */
cVoronoiMap m_Voronoi;
/// Size of the Voronoi cells, also used for distortion amplitude
/** Size of the Voronoi cells, also used for distortion amplitude */
int m_CellSize;
// cBiomeGen overrides:
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
/// Distorts the coords using a Perlin-like noise
/** Distorts the coords using a Perlin-like noise */
void Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ);
} ;
@ -241,30 +241,27 @@ protected:
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
/** Step 1: Decides between ocean, land and mushroom, using a DistVoronoi with special conditions and post-processing for mushroom islands
Sets biomes to biOcean, -1 (i.e. land), biMushroomIsland or biMushroomShore
*/
Sets biomes to biOcean, -1 (i.e. land), biMushroomIsland or biMushroomShore. */
void DecideOceanLandMushroom(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap);
/** Step 2: Add rivers to the land
Flips some "-1" biomes into biRiver
*/
Flips some "-1" biomes into biRiver. */
void AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap);
/** Step 3: Decide land biomes using a temperature / humidity map; freeze ocean / river in low temperatures.
Flips all remaining "-1" biomes into land biomes. Also flips some biOcean and biRiver into biFrozenOcean, biFrozenRiver, based on temp map.
*/
Flips all remaining "-1" biomes into land biomes. Also flips some biOcean and biRiver into biFrozenOcean, biFrozenRiver, based on temp map. */
void ApplyTemperatureHumidity(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap);
/// Distorts the coords using a Perlin-like noise, with a specified cell-size
/** Distorts the coords using a Perlin-like noise, with a specified cell-size */
void Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ, int a_CellSize);
/// Builds two Perlin-noise maps, one for temperature, the other for humidity. Trims both into [0..255] range
/** Builds two Perlin-noise maps, one for temperature, the other for humidity. Trims both into [0..255] range */
void BuildTemperatureHumidityMaps(int a_ChunkX, int a_ChunkZ, IntMap & a_TemperatureMap, IntMap & a_HumidityMap);
/// Flips all remaining "-1" biomes into land biomes using the two maps
/** Flips all remaining "-1" biomes into land biomes using the two maps */
void DecideLandBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap, const IntMap & a_HumidityMap);
/// Flips biOcean and biRiver into biFrozenOcean and biFrozenRiver if the temperature is too low
/** Flips biOcean and biRiver into biFrozenOcean and biFrozenRiver if the temperature is too low */
void FreezeWaterBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap);
} ;
@ -281,10 +278,10 @@ public:
cBioGenTwoLevel(int a_Seed);
protected:
/// The Voronoi map that decides the groups of biomes
/** The Voronoi map that decides the groups of biomes */
cVoronoiMap m_VoronoiLarge;
/// The Voronoi map that decides biomes inside individual biome groups
/** The Voronoi map that decides biomes inside individual biome groups */
cVoronoiMap m_VoronoiSmall;
// The noises used for the distortion:
@ -308,9 +305,9 @@ protected:
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
/// Selects biome from the specified biome group, based on the specified index.
/// Note that both params may overflow
/// a_DistLevel is either 0 or 1; zero when it is at the edge of the small Voronoi cell, 1 near the center
/** Selects biome from the specified biome group, based on the specified index.
Note that both params may overflow
a_DistLevel is either 0 or 1; zero when it is at the edge of the small Voronoi cell, 1 near the center */
EMCSBiome SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int a_DistLevel);
} ;

View File

@ -64,7 +64,7 @@ typedef std::vector<cCaveDefPoint> cCaveDefPoints;
/// A single non-branching tunnel of a WormNestCave
/** A single non-branching tunnel of a WormNestCave */
class cCaveTunnel
{
// The bounding box, including the radii around defpoints:
@ -72,19 +72,19 @@ class cCaveTunnel
int m_MinBlockY, m_MaxBlockY;
int m_MinBlockZ, m_MaxBlockZ;
/// Generates the shaping defpoints for the ravine, based on the ravine block coords and noise
/** Generates the shaping defpoints for the cave, based on the cave block coords and noise */
void Randomize(cNoise & a_Noise);
/// Refines (adds and smooths) defpoints from a_Src into a_Dst; returns false if no refinement possible (segments too short)
/** Refines (adds and smooths) defpoints from a_Src into a_Dst; returns false if no refinement possible (segments too short) */
bool RefineDefPoints(const cCaveDefPoints & a_Src, cCaveDefPoints & a_Dst);
/// Does rounds of smoothing, two passes of RefineDefPoints(), as long as they return true
/** Does rounds of smoothing, two passes of RefineDefPoints(), as long as they return true */
void Smooth(void);
/// Linearly interpolates the points so that the maximum distance between two neighbors is max 1 block
/** Linearly interpolates the points so that the maximum distance between two neighbors is max 1 block */
void FinishLinear(void);
/// Calculates the bounding box of the points present
/** Calculates the bounding box of the points present */
void CalcBoundingBox(void);
public:
@ -96,7 +96,7 @@ public:
cNoise & a_Noise
);
/// Carves the tunnel into the chunk specified
/** Carves the tunnel into the chunk specified */
void ProcessChunk(
int a_ChunkX, int a_ChunkZ,
cChunkDef::BlockTypes & a_BlockTypes,
@ -115,7 +115,7 @@ typedef std::vector<cCaveTunnel *> cCaveTunnels;
/// A collection of connected tunnels, possibly branching.
/** A collection of connected tunnels, possibly branching. */
class cStructGenWormNestCaves::cCaveSystem :
public cGridStructGen::cStructure
{
@ -135,13 +135,13 @@ protected:
void Clear(void);
/// Generates a_Segment successive tunnels, with possible branches. Generates the same output for the same [x, y, z, a_Segments]
/** Generates a_Segment successive tunnels, with possible branches. Generates the same output for the same [x, y, z, a_Segments] */
void GenerateTunnelsFromPoint(
int a_OriginX, int a_OriginY, int a_OriginZ,
cNoise & a_Noise, int a_Segments
);
/// Returns a radius based on the location provided.
/** Returns a radius based on the location provided. */
int GetRadius(cNoise & a_Noise, int a_OriginX, int a_OriginY, int a_OriginZ);
// cGridStructGen::cStructure overrides:

View File

@ -12,10 +12,10 @@
/// If the generation queue size exceeds this number, a warning will be output
/** If the generation queue size exceeds this number, a warning will be output */
const unsigned int QUEUE_WARNING_LIMIT = 1000;
/// If the generation queue size exceeds this number, chunks with no clients will be skipped
/** If the generation queue size exceeds this number, chunks with no clients will be skipped */
const unsigned int QUEUE_SKIP_LIMIT = 500;

View File

@ -46,16 +46,16 @@ public:
cGenerator(cChunkGenerator & a_ChunkGenerator);
virtual ~cGenerator() {} // Force a virtual destructor
/// Called to initialize the generator on server startup.
/** Called to initialize the generator on server startup. */
virtual void Initialize(cIniFile & a_IniFile);
/// Generates the biomes for the specified chunk (directly, not in a separate thread). Used by the world loader if biomes failed loading.
/** Generates the biomes for the specified chunk (directly, not in a separate thread). Used by the world loader if biomes failed loading. */
virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) = 0;
/// Returns the biome at the specified coords. Used by ChunkMap if an invalid chunk is queried for biome. Default implementation uses GenerateBiomes().
/** Returns the biome at the specified coords. Used by ChunkMap if an invalid chunk is queried for biome. Default implementation uses GenerateBiomes(). */
virtual EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ);
/// Called in a separate thread to do the actual chunk generation. Generator should generate into a_ChunkDesc.
/** Called in a separate thread to do the actual chunk generation. Generator should generate into a_ChunkDesc. */
virtual void DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) = 0;
protected:
@ -71,13 +71,11 @@ public:
virtual ~cPluginInterface() {}
/** Called when the chunk is about to be generated.
The generator may be partly or fully overriden by the implementation
*/
The generator may be partly or fully overriden by the implementation. */
virtual void CallHookChunkGenerating(cChunkDesc & a_ChunkDesc) = 0;
/** Called after the chunk is generated, before it is handed to the chunk sink.
a_ChunkDesc contains the generated chunk data. Implementation may modify this data.
*/
a_ChunkDesc contains the generated chunk data. Implementation may modify this data. */
virtual void CallHookChunkGenerated(cChunkDesc & a_ChunkDesc) = 0;
} ;
@ -92,19 +90,16 @@ public:
/** Called after the chunk has been generated
The interface may store the chunk, send it over network, whatever.
The chunk is not expected to be modified, but the generator will survive if the implementation
changes the data within. All changes are ignored, though.
*/
changes the data within. All changes are ignored, though. */
virtual void OnChunkGenerated(cChunkDesc & a_ChunkDesc) = 0;
/** Called just before the chunk generation is started,
to verify that it hasn't been generated in the meantime.
If this callback returns true, the chunk is not generated.
*/
If this callback returns true, the chunk is not generated. */
virtual bool IsChunkValid(int a_ChunkX, int a_ChunkZ) = 0;
/** Called when the generator is overloaded to skip chunks that are no longer needed.
If this callback returns false, the chunk is not generated.
*/
If this callback returns false, the chunk is not generated. */
virtual bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) = 0;
/** Called to check whether the specified chunk is in the queued state.
@ -126,7 +121,7 @@ public:
If the generator becomes overloaded and skips this chunk, the callback is still called. */
void QueueGenerateChunk(int a_ChunkX, int a_ChunkZ, bool a_ForceGenerate, cChunkCoordCallback * a_Callback = nullptr);
/// Generates the biomes for the specified chunk (directly, not in a separate thread). Used by the world loader if biomes failed loading.
/** Generates the biomes for the specified chunk (directly, not in a separate thread). Used by the world loader if biomes failed loading. */
void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap);
void WaitForQueueEmpty(void);
@ -151,7 +146,7 @@ private:
/** Force the regeneration of an already existing chunk */
bool m_ForceGenerate;
/** Callback to call after generating.*/
/** Callback to call after generating. */
cChunkCoordCallback * m_Callback;
};

View File

@ -98,7 +98,7 @@ protected:
/** Decodes the position index along the room walls into a proper 2D position for a chest.
The Y coord of the returned vector specifies the chest's meta value*/
The Y coord of the returned vector specifies the chest's meta value. */
Vector3i DecodeChestCoords(int a_PosIdx, int a_SizeX, int a_SizeZ)
{
if (a_PosIdx < a_SizeX)

View File

@ -77,7 +77,6 @@ void cEndGen::InitializeCompoGen(cIniFile & a_IniFile)
/// Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array)
void cEndGen::PrepareState(int a_ChunkX, int a_ChunkZ)
{
ASSERT(!IsChunkOutsideRange(a_ChunkX, a_ChunkZ)); // Should be filtered before calling this function
@ -97,7 +96,6 @@ void cEndGen::PrepareState(int a_ChunkX, int a_ChunkZ)
/// Generates the m_NoiseArray array for the current chunk
void cEndGen::GenerateNoiseArray(void)
{
NOISE_DATATYPE NoiseData[DIM_X * DIM_Y * DIM_Z]; // [x + DIM_X * z + DIM_X * DIM_Z * y]
@ -140,7 +138,6 @@ void cEndGen::GenerateNoiseArray(void)
/// Returns true if the chunk is outside of the island's dimensions
bool cEndGen::IsChunkOutsideRange(int a_ChunkX, int a_ChunkZ)
{
return (

View File

@ -25,10 +25,10 @@ public:
protected:
/// Seed for the noise
/** Seed for the noise */
int m_Seed;
/// The Perlin noise used for generating
/** The Perlin noise used for generating */
cPerlinNoise m_Perlin;
// XYZ size of the "island", in blocks:
@ -49,19 +49,22 @@ protected:
int m_LastChunkX;
int m_LastChunkZ;
NOISE_DATATYPE m_NoiseArray[17 * 17 * 257]; // x + 17 * z + 17 * 17 * y
/// Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array)
/** Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array) */
void PrepareState(int a_ChunkX, int a_ChunkZ);
/// Generates the m_NoiseArray array for the current chunk
/** Generates the m_NoiseArray array for the current chunk */
void GenerateNoiseArray(void);
/// Returns true if the chunk is outside of the island's dimensions
/** Returns true if the chunk is outside of the island's dimensions */
bool IsChunkOutsideRange(int a_ChunkX, int a_ChunkZ);
// cTerrainShapeGen overrides:
virtual void GenShape(int a_ChunkX, int a_ChunkZ, cChunkDesc::Shape & a_Shape) override;
// cTerrainCompositionGen overrides:
virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::Shape & a_Shape) override;
virtual void InitializeCompoGen(cIniFile & a_IniFile) override;

View File

@ -192,7 +192,7 @@ protected:
cNoise m_Noise;
int m_Seed;
/// Tries to place sugarcane at the coords specified, returns true if successful
/** Tries to place sugarcane at the coords specified, returns true if successful */
bool TryAddSugarcane(cChunkDesc & a_ChunkDesc, int a_RelX, int a_RelY, int a_RelZ);
// Returns true is the specified biome is a desert or its variant
@ -209,8 +209,7 @@ protected:
/** This class adds a single top block in random positions in the specified biome on top of specified allowed blocks.
Used for:
- Lilypads finisher
- DeadBushes finisher
*/
- DeadBushes finisher */
class cFinishGenSingleTopBlock :
public cFinishGen
{
@ -258,17 +257,20 @@ public:
protected:
cNoise m_Noise;
BLOCKTYPE m_BlockType;
int m_Amount; ///< Relative amount of blocks to try adding. 1 = one block per 256 biome columns.
/** Relative amount of blocks to try adding. 1 = one block per 256 biome columns. */
int m_Amount;
int GetNumToGen(const cChunkDef::BiomeMap & a_BiomeMap);
// Returns true if the given biome is a biome that is allowed.
/** Returns true if the given biome is a biome that is allowed. */
inline bool IsAllowedBiome(EMCSBiome a_Biome)
{
return m_IsBiomeAllowed[a_Biome];
}
// Returns true if the given blocktype may be below m_BlockType
/** Returns true if the given blocktype may be below m_BlockType */
inline bool IsAllowedBlockBelow(BLOCKTYPE a_BlockBelow)
{
return m_IsAllowedBelow[a_BlockBelow];
@ -316,7 +318,7 @@ protected:
bool m_PreSimulateWater;
bool m_PreSimulateLava;
// Drops hanging sand and gravel down to the ground, recalculates heightmap
/** Drops hanging sand and gravel down to the ground, recalculates heightmap */
void CollapseSandGravel(
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
cChunkDef::HeightMap & a_HeightMap // Height map to update by the current data
@ -324,8 +326,7 @@ protected:
/** For each fluid block:
- if all surroundings are of the same fluid, makes it stationary; otherwise makes it flowing (excl. top)
- all fluid on the chunk's edge is made flowing
*/
- all fluid on the chunk's edge is made flowing */
void StationarizeFluid(
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
cChunkDef::HeightMap & a_HeightMap, // Height map to read

View File

@ -390,7 +390,7 @@ void cHeiGenMountains::InitializeHeightGen(cIniFile & a_IniFile)
const cHeiGenBiomal::sGenParam cHeiGenBiomal::m_GenParam[256] =
{
/* Fast-changing | Middle-changing | Slow-changing |*/
/* Fast-changing | Middle-changing | Slow-changing | */
/* Biome | Freq1 | Amp1 | Freq2 | Amp2 | Freq3 | Amp3 | BaseHeight */
/* biOcean */ { 0.1f, 2.0f, 0.05f, 10.0f, 0.01f, 8.0f, 50},
/* biPlains */ { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68},

View File

@ -67,18 +67,17 @@ public:
virtual ~cMineShaft() {}
/// Returns true if this mineshaft intersects the specified cuboid
/** Returns true if this mineshaft intersects the specified cuboid */
bool DoesIntersect(const cCuboid & a_Other)
{
return m_BoundingBox.DoesIntersect(a_Other);
}
/** If recursion level is not too large, appends more branches to the parent system,
using exit points specific to this class.
*/
using exit points specific to this class. */
virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) = 0;
/// Imprints this shape into the specified chunk's data
/** Imprints this shape into the specified chunk's data */
virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) = 0;
} ;
@ -141,16 +140,16 @@ protected:
virtual void AppendBranches(int a_RecursionLevel, cNoise & a_Noise) override;
virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) override;
/// Places a chest, if the corridor has one
/** Places a chest, if the corridor has one */
void PlaceChest(cChunkDesc & a_ChunkDesc);
/// If this corridor has tracks, places them randomly
/** If this corridor has tracks, places them randomly */
void PlaceTracks(cChunkDesc & a_ChunkDesc);
/// If this corridor has a spawner, places the spawner
/** If this corridor has a spawner, places the spawner */
void PlaceSpawner(cChunkDesc & a_ChunkDesc);
/// Randomly places torches around the central beam block
/** Randomly places torches around the central beam block */
void PlaceTorches(cChunkDesc & a_ChunkDesc);
} ;

View File

@ -58,13 +58,13 @@ protected:
NOISE_DATATYPE m_FrequencyZ;
NOISE_DATATYPE m_AirThreshold;
/// Generates the 3D noise array used for terrain generation; a_Noise is of ChunkData-size
/** Generates the 3D noise array used for terrain generation; a_Noise is of ChunkData-size */
void GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DATATYPE * a_Noise);
/// Updates heightmap based on the chunk's contents
/** Updates heightmap based on the chunk's contents */
void UpdateHeightmap(cChunkDesc & a_ChunkDesc);
/// Composes terrain - adds dirt, grass and sand
/** Composes terrain - adds dirt, grass and sand */
void ComposeTerrain(cChunkDesc & a_ChunkDesc);
} ;

View File

@ -31,7 +31,7 @@ protected:
/** The noise used for generating random numbers */
cNoise m_Noise;
/** Maximum depth of the generator tree*/
/** Maximum depth of the generator tree */
int m_MaxDepth;
/** Maximum size, in X / Z blocks, of the structure (radius from the origin) */

View File

@ -64,7 +64,7 @@ public:
cRavine(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise);
#ifdef _DEBUG
/// Exports itself as a SVG line definition
/** Exports itself as a SVG line definition */
AString ExportAsSVG(int a_Color, int a_OffsetX = 0, int a_OffsetZ = 0) const;
#endif // _DEBUG

View File

@ -95,7 +95,7 @@ static const sCoordsArr BigOs[] =
/// Pushes a specified layer of blocks of the same type around (x, h, z) into a_Blocks
/** Pushes a specified layer of blocks of the same type around (x, h, z) into a_Blocks */
inline void PushCoordBlocks(int a_BlockX, int a_Height, int a_BlockZ, sSetBlockVector & a_Blocks, const sCoords * a_Coords, size_t a_NumCoords, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta)
{
for (size_t i = 0; i < a_NumCoords; i++)

View File

@ -52,61 +52,61 @@ class cWorld;
/// Generates an image of a tree at the specified coords (lowest trunk block) in the specified biome
/** Generates an image of a tree at the specified coords (lowest trunk block) in the specified biome */
void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, EMCSBiome a_Biome, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random apple tree
/** Generates an image of a random apple tree */
void GetAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a small (nonbranching) apple tree
/** Generates an image of a small (nonbranching) apple tree */
void GetSmallAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a large (branching) apple tree
/** Generates an image of a large (branching) apple tree */
void GetLargeAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates a branch for a large apple tree
/** Generates a branch for a large apple tree */
void GetLargeAppleTreeBranch(int a_BlockX, int a_BlockY, int a_BlockZ, int a_BranchLength, Vector3d a_StartDirection, Vector3d a_Direction, int a_TreeHeight, cNoise & a_Noise, sSetBlockVector & a_LogBlocks);
/// Returns the meta for a log from the given direction
/** Returns the meta for a log from the given direction */
NIBBLETYPE GetLogMetaFromDirection(NIBBLETYPE a_BlockMeta, Vector3d a_Direction);
/// Generates an image of a random birch tree
/** Generates an image of a random birch tree */
void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random acacia tree
/** Generates an image of a random acacia tree */
void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random darkoak tree
/** Generates an image of a random darkoak tree */
void GetDarkoakTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random large birch tree
/** Generates an image of a random large birch tree */
void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random conifer tree
/** Generates an image of a random conifer tree */
void GetConiferTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random spruce (short conifer, two layers of leaves)
/** Generates an image of a random spruce (short conifer, two layers of leaves) */
void GetSpruceTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random pine (tall conifer, little leaves at top)
/** Generates an image of a random pine (tall conifer, little leaves at top) */
void GetPineTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random swampland tree
/** Generates an image of a random swampland tree */
void GetSwampTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random apple bush (for jungles)
/** Generates an image of a random apple bush (for jungles) */
void GetAppleBushImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random jungle tree
/** Generates an image of a random jungle tree */
void GetJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks, bool a_Large);
/// Generates an image of a large jungle tree (2x2 trunk)
/** Generates an image of a large jungle tree (2x2 trunk) */
void GetLargeJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a small jungle tree (1x1 trunk)
/** Generates an image of a small jungle tree (1x1 trunk) */
void GetSmallJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Moves the x and z coordinants to the north-west corner of a 2x2 of saplings. Returns true if a 2x2 was found, otherwise it returns false
/** Moves the x and z coordinants to the north-west corner of a 2x2 of saplings. Returns true if a 2x2 was found, otherwise it returns false */
bool GetLargeTreeAdjustment(cWorld & a_World, int & a_X, int & a_Y, int & a_Z, NIBBLETYPE a_Meta);

View File

@ -31,7 +31,7 @@ protected:
/** The noise used for generating random numbers */
cNoise m_Noise;
/** Maximum depth of the generator tree*/
/** Maximum depth of the generator tree */
int m_MaxDepth;
/** Maximum size, in X / Z blocks, of the structure (radius from the origin) */

View File

@ -48,7 +48,7 @@ protected:
/** The noise used for generating random numbers */
cNoise m_Noise;
/** Maximum depth of the generator tree*/
/** Maximum depth of the generator tree */
int m_MaxDepth;
/** Maximum size, in X / Z blocks, of the village (radius from the origin) */

View File

@ -329,15 +329,15 @@ void inline LOG(const char * a_Format, ...)
// Common definitions:
/// Evaluates to the number of elements in an array (compile-time!)
/** Evaluates to the number of elements in an array (compile-time!) */
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
/// Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)")
/** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)") */
#define KiB * 1024
#define MiB * 1024 * 1024
/// Faster than (int)floorf((float)x / (float)div)
#define FAST_FLOOR_DIV( x, div) (((x) - (((x) < 0) ? ((div) - 1) : 0)) / (div))
/** Faster than (int)floorf((float)x / (float)div) */
#define FAST_FLOOR_DIV(x, div) (((x) - (((x) < 0) ? ((div) - 1) : 0)) / (div))
// Own version of assert() that writes failed assertions to the log for review
#ifdef TEST_GLOBALS

View File

@ -39,68 +39,67 @@ public:
// Force a virtual destructor in descendants:
virtual ~cCallbacks() {}
/// Called when a new file part is encountered in the form data
/** Called when a new file part is encountered in the form data */
virtual void OnFileStart(cHTTPFormParser & a_Parser, const AString & a_FileName) = 0;
/// Called when more file data has come for the current file in the form data
/** Called when more file data has come for the current file in the form data */
virtual void OnFileData(cHTTPFormParser & a_Parser, const char * a_Data, size_t a_Size) = 0;
/// Called when the current file part has ended in the form data
/** Called when the current file part has ended in the form data */
virtual void OnFileEnd(cHTTPFormParser & a_Parser) = 0;
} ;
/// Creates a parser that is tied to a request and notifies of various events using a callback mechanism
/** Creates a parser that is tied to a request and notifies of various events using a callback mechanism */
cHTTPFormParser(cHTTPRequest & a_Request, cCallbacks & a_Callbacks);
/// Creates a parser with the specified content type that reads data from a string
/** Creates a parser with the specified content type that reads data from a string */
cHTTPFormParser(eKind a_Kind, const char * a_Data, size_t a_Size, cCallbacks & a_Callbacks);
/// Adds more data into the parser, as the request body is received
/** Adds more data into the parser, as the request body is received */
void Parse(const char * a_Data, size_t a_Size);
/** Notifies that there's no more data incoming and the parser should finish its parsing.
Returns true if parsing successful
*/
Returns true if parsing successful. */
bool Finish(void);
/// Returns true if the headers suggest the request has form data parseable by this class
/** Returns true if the headers suggest the request has form data parseable by this class */
static bool HasFormData(const cHTTPRequest & a_Request);
protected:
/// The callbacks to call for incoming file data
/** The callbacks to call for incoming file data */
cCallbacks & m_Callbacks;
/// The kind of the parser (decided in the constructor, used in Parse()
/** The kind of the parser (decided in the constructor, used in Parse() */
eKind m_Kind;
/// Buffer for the incoming data until it's parsed
/** Buffer for the incoming data until it's parsed */
AString m_IncomingData;
/// True if the information received so far is a valid form; set to false on first problem. Further parsing is skipped when false.
/** True if the information received so far is a valid form; set to false on first problem. Further parsing is skipped when false. */
bool m_IsValid;
/// The parser for the multipart data, if used
/** The parser for the multipart data, if used */
std::unique_ptr<cMultipartParser> m_MultipartParser;
/// Name of the currently parsed part in multipart data
/** Name of the currently parsed part in multipart data */
AString m_CurrentPartName;
/// True if the currently parsed part in multipart data is a file
/** True if the currently parsed part in multipart data is a file */
bool m_IsCurrentPartFile;
/// Filename of the current parsed part in multipart data (for file uploads)
/** Filename of the current parsed part in multipart data (for file uploads) */
AString m_CurrentPartFileName;
/// Set to true after m_Callbacks.OnFileStart() has been called, reset to false on PartEnd
/** Set to true after m_Callbacks.OnFileStart() has been called, reset to false on PartEnd */
bool m_FileHasBeenAnnounced;
/// Sets up the object for parsing a fpkMultipart request
/** Sets up the object for parsing a fpkMultipart request */
void BeginMultipart(const cHTTPRequest & a_Request);
/// Parses m_IncomingData as form-urlencoded data (fpkURL or fpkFormUrlEncoded kinds)
/** Parses m_IncomingData as form-urlencoded data (fpkURL or fpkFormUrlEncoded kinds) */
void ParseFormUrlEncoded(void);
// cMultipartParser::cCallbacks overrides:

View File

@ -17,22 +17,22 @@ class cNameValueParser :
public std::map<AString, AString>
{
public:
/// Creates an empty parser
/** Creates an empty parser */
cNameValueParser(bool a_AllowsKeyOnly = true);
/// Creates an empty parser, then parses the data given. Doesn't call Finish(), so more data can be parsed later
/** Creates an empty parser, then parses the data given. Doesn't call Finish(), so more data can be parsed later */
cNameValueParser(const char * a_Data, size_t a_Size, bool a_AllowsKeyOnly = true);
/// Parses the data given
/** Parses the data given */
void Parse(const char * a_Data, size_t a_Size);
/// Notifies the parser that no more data will be coming. Returns true if the parser state is valid
/** Notifies the parser that no more data will be coming. Returns true if the parser state is valid */
bool Finish(void);
/// Returns true if the data parsed so far was valid
/** Returns true if the data parsed so far was valid */
bool IsValid(void) const { return (m_State != psInvalid); }
/// Returns true if the parser expects no more data
/** Returns true if the parser expects no more data */
bool IsFinished(void) const { return ((m_State == psInvalid) || (m_State == psFinished)); }
protected:
@ -50,16 +50,16 @@ protected:
psFinished, ///< The parser has already been instructed to finish and doesn't expect any more data
} ;
/// The current state of the parser
/** The current state of the parser */
eState m_State;
/// If true, the parser will accept keys without an equal sign and the value
/** If true, the parser will accept keys without an equal sign and the value */
bool m_AllowsKeyOnly;
/// Buffer for the current Key
/** Buffer for the current Key */
AString m_CurrentKey;
/// Buffer for the current Value;
/** Buffer for the current Value; */
AString m_CurrentValue;

View File

@ -48,25 +48,25 @@ private:
std::vector<AString> names;
std::vector<AString> comments;
/// If the object is case-insensitive, returns s as lowercase; otherwise returns s as-is
/** If the object is case-insensitive, returns s as lowercase; otherwise returns s as-is */
AString CheckCase(const AString & s) const;
/// Removes the UTF-8 BOMs (Byte order makers), if present.
/** Removes the UTF-8 BOMs (Byte order makers), if present. */
void RemoveBom(AString & a_line) const;
public:
/// Creates a new instance with no data
/** Creates a new instance with no data */
cIniFile(void);
// tolua_end
// tolua_end
virtual ~cIniFile() = default;
virtual std::vector<std::pair<AString, AString>> GetValues(AString a_keyName) override;
virtual bool KeyExists(const AString a_keyName) const override;
// tolua_begin
// tolua_begin
// Sets whether or not keynames and valuenames should be case sensitive.
// The default is case insensitive.
@ -76,31 +76,30 @@ public:
/** Reads the contents of the specified ini file
If the file doesn't exist and a_AllowExampleRedirect is true, tries to read <basename>.example.ini, and
writes its contents as <basename>.ini, if successful.
Returns true if successful, false otherwise.
*/
Returns true if successful, false otherwise. */
bool ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect = true);
/// Writes data stored in class to the specified ini file
/** Writes data stored in class to the specified ini file */
bool WriteFile(const AString & a_FileName) const;
virtual bool Flush() override { return WriteFile(m_Filename); }
/// Deletes all stored ini data (but doesn't touch the file)
/** Deletes all stored ini data (but doesn't touch the file) */
void Clear(void);
/** Returns true iff the specified value exists. */
bool HasValue(const AString & a_KeyName, const AString & a_ValueName) const override;
/// Returns index of specified key, or noID if not found
/** Returns index of specified key, or noID if not found */
int FindKey(const AString & keyname) const;
/// Returns index of specified value, in the specified key, or noID if not found
/** Returns index of specified value, in the specified key, or noID if not found */
int FindValue(const int keyID, const AString & valuename) const;
/// Returns number of keys currently in the ini
/** Returns number of keys currently in the ini */
int GetNumKeys(void) const { return static_cast<int>(keys.size()); }
/// Add a key name
/** Add a key name */
int AddKeyName(const AString & keyname) override;
// Returns key names by index.
@ -172,19 +171,19 @@ public:
// Header comment functions.
// Header comments are those comments before the first key.
/// Returns the number of header comments
/** Returns the number of header comments */
int GetNumHeaderComments(void) {return static_cast<int>(comments.size());}
/// Adds a header comment
/** Adds a header comment */
void AddHeaderComment(const AString & comment);
/// Returns a header comment, or empty string if out of range
/** Returns a header comment, or empty string if out of range */
AString GetHeaderComment(const int commentID) const;
/// Deletes a header comment. Returns true if successful
/** Deletes a header comment. Returns true if successful */
bool DeleteHeaderComment(int commentID);
/// Deletes all header comments
/** Deletes all header comments */
void DeleteHeaderComments(void) {comments.clear();}
@ -194,19 +193,19 @@ public:
// these comments will be moved to the top of the key definition when
// the CIniFile::WriteFile() is called.
/// Get number of key comments
/** Get number of key comments */
int GetNumKeyComments(const int keyID) const;
/// Get number of key comments
/** Get number of key comments */
int GetNumKeyComments(const AString & keyname) const;
/// Add a key comment
/** Add a key comment */
bool AddKeyComment(const int keyID, const AString & comment);
/// Add a key comment
/** Add a key comment */
bool AddKeyComment(const AString & keyname, const AString & comment) override;
/// Return a key comment
/** Return a key comment */
AString GetKeyComment(const int keyID, const int commentID) const;
AString GetKeyComment(const AString & keyname, const int commentID) const override;

View File

@ -111,7 +111,6 @@ char cItem::GetMaxStackSize(void) const
/// Returns the cItemHandler responsible for this item type
cItemHandler * cItem::GetHandler(void) const
{
return ItemHandler(m_ItemType);

View File

@ -14,7 +14,7 @@
/// Chunk data callback that takes the chunk data and puts them into cLightingThread's m_BlockTypes[] / m_HeightMap[]:
/** Chunk data callback that takes the chunk data and puts them into cLightingThread's m_BlockTypes[] / m_HeightMap[]: */
class cReader :
public cChunkDataCallback
{

View File

@ -35,46 +35,47 @@ class cLineBlockTracer :
public:
cLineBlockTracer(cWorld & a_World, cCallbacks & a_Callbacks);
/// Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits())
/** Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits()) */
bool Trace(double a_StartX, double a_StartY, double a_StartZ, double a_EndX, double a_EndY, double a_EndZ);
// Utility functions for simple one-line usage:
/// Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits())
/** Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits()) */
static bool Trace(cWorld & a_World, cCallbacks & a_Callbacks, double a_StartX, double a_StartY, double a_StartZ, double a_EndX, double a_EndY, double a_EndZ);
/// Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits())
/** Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits()) */
static bool Trace(cWorld & a_World, cCallbacks & a_Callbacks, const Vector3d & a_Start, const Vector3d & a_End);
protected:
// The start point of the trace
/** The start point of the trace */
double m_StartX, m_StartY, m_StartZ;
// The end point of the trace
/** The end point of the trace */
double m_EndX, m_EndY, m_EndZ;
// The difference in coords, End - Start
/** The difference in coords, End - Start */
double m_DiffX, m_DiffY, m_DiffZ;
// The increment at which the block coords are going from Start to End; either +1 or -1
/** The increment at which the block coords are going from Start to End; either +1 or -1 */
int m_DirX, m_DirY, m_DirZ;
// The current block
/** The current block */
int m_CurrentX, m_CurrentY, m_CurrentZ;
// The face through which the current block has been entered
/** The face through which the current block has been entered */
char m_CurrentFace;
/// Adjusts the start point above the world to just at the world's top
/** Adjusts the start point above the world to just at the world's top */
void FixStartAboveWorld(void);
/// Adjusts the start point below the world to just at the world's bottom
/** Adjusts the start point below the world to just at the world's bottom */
void FixStartBelowWorld(void);
/// Calculates the XZ coords of an intersection with the specified Yconst plane; assumes that such an intersection exists
/** Calculates the XZ coords of an intersection with the specified Yconst plane; assumes that such an intersection exists */
void CalcXZIntersection(double a_Y, double & a_IntersectX, double & a_IntersectZ);
/// Moves m_Current to the next block on the line; returns false if no move is possible (reached the end)
/** Moves m_Current to the next block on the line; returns false if no move is possible (reached the end) */
bool MoveToNextBlock(void);
// cChunkCallback overrides:

View File

@ -151,7 +151,6 @@ void LinearInterpolate2DArray(
/// Puts linearly interpolated values from one array into another array. 3D version
void LinearInterpolate3DArray(
float * a_Src,
int a_SrcSizeX, int a_SrcSizeY, int a_SrcSizeZ,

View File

@ -23,7 +23,7 @@ const int MAX_INTERPOL_SIZEZ = 256; ///< Maximum Z-size of the interpolated arr
/// Puts linearly interpolated values from one array into another array. 1D version
/** Puts linearly interpolated values from one array into another array. 1D version */
void LinearInterpolate1DArray(
float * a_Src, ///< Src array
int a_SrcSizeX, ///< Count of the src array
@ -35,7 +35,7 @@ void LinearInterpolate1DArray(
/// Puts linearly interpolated values from one array into another array. 2D version
/** Puts linearly interpolated values from one array into another array. 2D version */
void LinearInterpolate2DArray(
float * a_Src, ///< Src array, [x + a_SrcSizeX * y]
int a_SrcSizeX, int a_SrcSizeY, ///< Count of the src array, in each direction
@ -47,7 +47,7 @@ void LinearInterpolate2DArray(
/// Puts linearly interpolated values from one array into another array. 3D version
/** Puts linearly interpolated values from one array into another array. 3D version */
void LinearInterpolate3DArray(
float * a_Src, ///< Src array, [x + a_SrcSizeX * y + a_SrcSizeX * a_SrcSizeY * z]
int a_SrcSizeX, int a_SrcSizeY, int a_SrcSizeZ, ///< Count of the src array, in each direction

View File

@ -25,20 +25,20 @@ as side effect 2 : it also know the caps for mobs number and can compare census
class cMobCensus
{
public:
/// Returns the nested proximity counter
/** Returns the nested proximity counter */
cMobProximityCounter & GetProximityCounter(void);
// collect an elligible Chunk for Mob Spawning
// MG TODO : code the correct rule (not loaded chunk but short distant from players)
void CollectSpawnableChunk(cChunk & a_Chunk);
/// Collect a mob - its distance to player, its family ...
/** Collect a mob - its distance to player, its family ... */
void CollectMob(cMonster & a_Monster, cChunk & a_Chunk, double a_Distance);
/// Returns true if the family is capped (i.e. there are more mobs of this family than max)
/** Returns true if the family is capped (i.e. there are more mobs of this family than max) */
bool IsCapped(cMonster::eFamily a_MobFamily);
/// log the results of census to server console
/** log the results of census to server console */
void Logd(void);
protected :
@ -47,10 +47,10 @@ protected :
std::set<cChunk *> m_EligibleForSpawnChunks;
/// Returns the number of chunks that are elligible for spawning (for now, the loaded, valid chunks)
/** Returns the number of chunks that are elligible for spawning (for now, the loaded, valid chunks) */
int GetNumChunks();
/// Returns the cap multiplier value of the given monster family
/** Returns the cap multiplier value of the given monster family */
static int GetCapMultiplier(cMonster::eFamily a_MobFamily);
} ;

View File

@ -25,24 +25,23 @@ but it also has dynamic part depending on the world.ini settings.
class cMobSpawner
{
public :
// constructor
// a_MobFamily is the Family of mobs that this spawner will spawn
// a_AllowedTypes is the set of types allowed for mobs it will spawn. Empty set
// would result in no spawn at all
// Allowed mobs thah are not of the right Family will not be include (no warning)
/** Constructor
a_MobFamily is the Family of mobs that this spawner will spawn
a_AllowedTypes is the set of types allowed for mobs it will spawn. Empty set would result in no spawn at all
Allowed mobs thah are not of the right Family will not be include (no warning). */
cMobSpawner(cMonster::eFamily MobFamily, const std::set<eMonsterType> & a_AllowedTypes);
/// Check if specified block can be a Pack center for this spawner
/** Check if specified block can be a Pack center for this spawner */
bool CheckPackCenter(BLOCKTYPE a_BlockType);
// Try to create a monster here
// if this is the first of a Pack : determine the type of monster
// BlockType & BlockMeta are used to decide what kind of Mob can Spawn here
// MaxPackSize is set to the maximal size for a pack this type of mob
/** Try to create a monster here
If this is the first of a Pack, determine the type of monster
a_Biome, BlockType & BlockMeta are used to decide what kind of Mob can Spawn here
a_MaxPackSize is set to the maximal size for a pack this type of mob */
cMonster * TryToSpawnHere(cChunk * a_Chunk, int A_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int & a_MaxPackSize);
// mark the beginning of a new Pack
// all mobs of the same Pack are the same type
/** Mark the beginning of a new Pack.
All mobs of the same Pack are the same type */
void NewPack(void);
// return true if there is at least one allowed type
@ -55,11 +54,11 @@ public :
static bool CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, eMonsterType a_MobType, EMCSBiome a_Biome);
protected :
// return a random type that can spawn on specified biome.
// returns E_ENTITY_TYPE_DONOTUSE if none is possible
/** Returns a random type that can spawn in the specified biome.
Returns mtInvalidType if none is possible. */
eMonsterType ChooseMobType(EMCSBiome a_Biome);
// add toAdd inside toAddIn, if toAdd is in m_AllowedTypes
/** Adds toAdd into toAddIn, if toAdd is in m_AllowedTypes */
void addIfAllowed(eMonsterType toAdd, std::set<eMonsterType> & toAddIn);
cMonster::eFamily m_MonsterFamily;

View File

@ -12,7 +12,7 @@ class cMagmaCube :
typedef cAggressiveMonster super;
public:
/// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest
/** Creates a MagmaCube of the specified size; with 1 being the smallest */
cMagmaCube(int a_Size);
CLASS_PROTODEF(cMagmaCube)
@ -26,7 +26,7 @@ public:
protected:
/// Size of the MagmaCube, 1, 2 and 4, with 1 being the smallest
/** Size of the MagmaCube, with 1 being the smallest */
int m_Size;
} ;

View File

@ -73,7 +73,7 @@ public:
virtual void CheckEventSeePlayer(void);
virtual void EventSeePlayer(cEntity * a_Player);
/// Reads the monster configuration for the specified monster name and assigns it to this object.
/** Reads the monster configuration for the specified monster name and assigns it to this object. */
void GetMonsterConfig(const AString & a_Name);
/** Returns whether this mob is undead (skeleton, zombie, etc.) */
@ -105,7 +105,7 @@ public:
void SetDropChanceBoots(float a_DropChanceBoots) { m_DropChanceBoots = a_DropChanceBoots; }
void SetCanPickUpLoot(bool a_CanPickUpLoot) { m_CanPickUpLoot = a_CanPickUpLoot; }
/// Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick
/** Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick */
void SetBurnsInDaylight(bool a_BurnsInDaylight) { m_BurnsInDaylight = a_BurnsInDaylight; }
double GetRelativeWalkSpeed(void) const { return m_RelativeWalkSpeed; } // tolua_export
@ -278,19 +278,19 @@ protected:
char m_Age;
/** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/
/** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops */
void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
/** Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops*/
/** Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops */
void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
/** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/
/** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops */
void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel);
/** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
/** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if picked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop */
void AddRandomArmorDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
/** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
/** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if picked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop */
void AddRandomWeaponDropItem(cItems & a_Drops, unsigned int a_LootingLevel);

View File

@ -1,9 +1,12 @@
#pragma once
/// This identifies individual monster type, as well as their network type-ID
// tolua_begin
/** Identifies individual monster type, as well as their network type-ID. */
enum eMonsterType
{
mtInvalidType = -1,

View File

@ -17,8 +17,9 @@ public:
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
/// When hit by someone, run away
/** When hit by someone, run away */
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
/** Returns the item that the animal of this class follows when a player holds it in hand
Return an empty item not to follow (default). */
virtual const cItem GetFollowedItem(void) const { return cItem(); }

View File

@ -387,7 +387,8 @@ void cPath::ProcessIfWalkable(const Vector3i & a_Location, cPathCell * a_Parent,
}
}
/*y =-1;
/*
y = -1;
for (x = 0; x < m_BoundingBoxWidth; ++x)
{
for (z = 0; z < m_BoundingBoxWidth; ++z)
@ -398,7 +399,8 @@ void cPath::ProcessIfWalkable(const Vector3i & a_Location, cPathCell * a_Parent,
}
}
}
ProcessCell(cell, a_Parent, a_Cost);*/
ProcessCell(cell, a_Parent, a_Cost);
*/
// Make sure there's at least 1 piece of solid below us.

View File

@ -79,7 +79,7 @@ public:
/** Performs part of the path calculation and returns the appropriate status.
If NEARBY_FOUND is returned, it means that the destination is not reachable, but a nearby destination
is reachable. If the user likes the alternative destination, they can call AcceptNearbyPath to treat the path as found,
and to make consequent calls to step return PATH_FOUND*/
and to make consequent calls to step return PATH_FOUND */
ePathFinderStatus Step(cChunk & a_Chunk);
/** Called after the PathFinder's step returns NEARBY_FOUND.
@ -87,7 +87,8 @@ public:
the PathFinder found a path to. */
Vector3i AcceptNearbyPath();
/* Point retrieval functions, inlined for performance. */
// Point retrieval functions, inlined for performance:
/** Returns the next point in the path. */
inline Vector3d GetNextPoint()
{
@ -95,17 +96,23 @@ public:
Vector3i Point = m_PathPoints[m_PathPoints.size() - 1 - (++m_CurrentPoint)];
return Vector3d(Point.x + m_HalfWidth, Point.y, Point.z + m_HalfWidth);
}
/** Checks whether this is the last point or not. Never call getnextPoint when this is true. */
inline bool IsLastPoint()
{
ASSERT(m_Status == ePathFinderStatus::PATH_FOUND);
return (m_CurrentPoint == m_PathPoints.size() - 1);
}
inline bool IsFirstPoint()
{
ASSERT(m_Status == ePathFinderStatus::PATH_FOUND);
return (m_CurrentPoint == 0);
}
/** Get the point at a_index. Remark: Internally, the indexes are reversed. */
inline Vector3d GetPoint(size_t a_index)
{
@ -114,6 +121,8 @@ public:
Vector3i Point = m_PathPoints[m_PathPoints.size() - 1 - a_index];
return Vector3d(Point.x + m_HalfWidth, Point.y, Point.z + m_HalfWidth);
}
/** Returns the total number of points this path has. */
inline size_t GetPointCount()
{

View File

@ -103,7 +103,8 @@ void cVillager::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
////////////////////////////////////////////////////////////////////////////////
// Farmer functions.
// Farmer functions:
void cVillager::HandleFarmerPrepareFarmCrops()
{
if (!m_World->VillagersShouldHarvestCrops())
@ -112,15 +113,16 @@ void cVillager::HandleFarmerPrepareFarmCrops()
}
cBlockArea Surrounding;
/// Read a 11x7x11 area.
// Read a 11x7x11 area:
Surrounding.Read(
m_World,
static_cast<int>(GetPosX()) - 5,
static_cast<int>(GetPosX()) + 6,
static_cast<int>(GetPosY()) - 3,
static_cast<int>(GetPosY()) + 4,
static_cast<int>(GetPosZ()) - 5,
static_cast<int>(GetPosZ()) + 6
FloorC(GetPosX()) - 5,
FloorC(GetPosX()) + 6,
FloorC(GetPosY()) - 3,
FloorC(GetPosY()) + 4,
FloorC(GetPosZ()) - 5,
FloorC(GetPosZ()) + 6
);
for (int I = 0; I < 5; I++)

View File

@ -34,17 +34,17 @@ public:
virtual void Tick (std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
// cVillager functions
/** return true if the given blocktype are: crops, potatoes or carrots.*/
/** return true if the given blocktype are: crops, potatoes or carrots. */
bool IsBlockFarmable(BLOCKTYPE a_BlockType);
// Farmer functions
/** Searches in a 11x7x11 area for crops. If it found some it will navigate to them.*/
/** Searches in a 11x7x11 area for crops. If it found some it will navigate to them. */
void HandleFarmerPrepareFarmCrops();
/** Looks if the farmer has reached it's destination, and if it's still crops and the destination is closer then 2 blocks it will harvest them.*/
/** Looks if the farmer has reached it's destination, and if it's still crops and the destination is closer then 2 blocks it will harvest them. */
void HandleFarmerTryHarvestCrops();
/** Replaces the crops he harvested.*/
/** Replaces the crops he harvested. */
void HandleFarmerPlaceCrops();
// Get and set functions.

View File

@ -204,16 +204,16 @@ public:
const NOISE_DATATYPE * a_FracY ///< Pointer to the attay that stores the Y fractional values
);
/// Uses current m_WorkRnds[] to generate part of the array
/** Uses current m_WorkRnds[] to generate part of the array */
void Generate(
int a_FromX, int a_ToX,
int a_FromY, int a_ToY
);
/// Initializes m_WorkRnds[] with the specified Floor values
/** Initializes m_WorkRnds[] with the specified Floor values */
void InitWorkRnds(int a_FloorX, int a_FloorY);
/// Updates m_WorkRnds[] for the new Floor values.
/** Updates m_WorkRnds[] for the new Floor values. */
void Move(int a_NewFloorX, int a_NewFloorY);
protected:
@ -356,17 +356,17 @@ public:
const NOISE_DATATYPE * a_FracZ ///< Pointer to the array that stores the Z fractional values
);
/// Uses current m_WorkRnds[] to generate part of the array
/** Uses current m_WorkRnds[] to generate part of the array */
void Generate(
int a_FromX, int a_ToX,
int a_FromY, int a_ToY,
int a_FromZ, int a_ToZ
);
/// Initializes m_WorkRnds[] with the specified Floor values
/** Initializes m_WorkRnds[] with the specified Floor values */
void InitWorkRnds(int a_FloorX, int a_FloorY, int a_FloorZ);
/// Updates m_WorkRnds[] for the new Floor values.
/** Updates m_WorkRnds[] for the new Floor values. */
void Move(int a_NewFloorX, int a_NewFloorY, int a_NewFloorZ);
protected:

View File

@ -37,7 +37,7 @@ private:
/// RAII for cCriticalSection - locks the CS on creation, unlocks on destruction
/** RAII for cCriticalSection - locks the CS on creation, unlocks on destruction */
class cCSLock
{
cCriticalSection * m_CS;
@ -64,7 +64,7 @@ private:
/// Temporary RAII unlock for a cCSLock. Useful for unlock-wait-relock scenarios
/** Temporary RAII unlock for a cCSLock. Useful for unlock-wait-relock scenarios */
class cCSUnlock
{
cCSLock & m_Lock;

View File

@ -27,16 +27,16 @@ public:
cGZipFile(void);
~cGZipFile();
/// Opens the file. Returns true if successful. Fails if a file has already been opened through this object.
/** Opens the file. Returns true if successful. Fails if a file has already been opened through this object. */
bool Open(const AString & a_FileName, eMode a_Mode);
/// Closes the file, flushing all buffers. This object may be then reused for a different file and / or mode
/** Closes the file, flushing all buffers. This object may be then reused for a different file and / or mode */
void Close(void);
/// Reads the rest of the file and decompresses it into a_Contents. Returns the number of decompressed bytes, <0 for error
/** Reads the rest of the file and decompresses it into a_Contents. Returns the number of decompressed bytes, <0 for error */
int ReadRestOfFile(AString & a_Contents);
/// Writes a_Contents into file, compressing it along the way. Returns true if successful. Multiple writes are supported.
/** Writes a_Contents into file, compressing it along the way. Returns true if successful. Multiple writes are supported. */
bool Write(const AString & a_Contents) { return Write(a_Contents.data(), static_cast<int>(a_Contents.size())); }
bool Write(const char * a_Data, int a_Size);

View File

@ -16,19 +16,18 @@ To create a queue of type T, instantiate a cQueue<T> object. You can also
modify the behavior of the queue when deleting items and when adding items
that are already in the queue by providing a second parameter, a class that
implements the functions Delete() and Combine(). An example is given in
cQueueFuncs and is used as the default behavior.
*/
cQueueFuncs and is used as the default behavior. */
/// This empty struct allows for the callback functions to be inlined
/** This empty struct allows for the callback functions to be inlined */
template <class T>
struct cQueueFuncs
{
public:
/// Called when an Item is deleted from the queue without being returned
/** Called when an Item is deleted from the queue without being returned */
static void Delete(T) {}
/// Called when an Item is inserted with EnqueueItemIfNotPresent and there is another equal value already inserted
/** Called when an Item is inserted with EnqueueItemIfNotPresent and there is another equal value already inserted */
static void Combine(T & a_existing, const T & a_new)
{
UNUSED(a_existing);
@ -54,7 +53,7 @@ public:
~cQueue() {}
/// Enqueues an item to the queue, may block if other threads are accessing the queue.
/** Enqueues an item to the queue, may block if other threads are accessing the queue. */
void EnqueueItem(ItemType a_Item)
{
cCSLock Lock(m_CS);
@ -63,7 +62,7 @@ public:
}
/// Enqueues an item in the queue if not already present (as determined by operator ==). Blocks other threads from accessing the queue.
/** Enqueues an item in the queue if not already present (as determined by operator ==). Blocks other threads from accessing the queue. */
void EnqueueItemIfNotPresent(ItemType a_Item)
{
cCSLock Lock(m_CS);
@ -81,8 +80,8 @@ public:
}
/// Dequeues an item from the queue if any are present.
/// Returns true if successful. Value of item is undefined if dequeuing was unsuccessful.
/** Dequeues an item from the queue if any are present.
Returns true if successful. Value of item is undefined if dequeuing was unsuccessful. */
bool TryDequeueItem(ItemType & item)
{
cCSLock Lock(m_CS);
@ -97,7 +96,7 @@ public:
}
/// Dequeues an item from the queue, blocking until an item is available.
/** Dequeues an item from the queue, blocking until an item is available. */
ItemType DequeueItem(void)
{
cCSLock Lock(m_CS);
@ -113,7 +112,7 @@ public:
}
/// Blocks until the queue is empty.
/** Blocks until the queue is empty. */
void BlockTillEmpty(void)
{
cCSLock Lock(m_CS);
@ -125,7 +124,7 @@ public:
}
/// Removes all Items from the Queue, calling Delete on each of them.
/** Removes all Items from the Queue, calling Delete on each of them. */
void Clear(void)
{
cCSLock Lock(m_CS);
@ -137,8 +136,8 @@ public:
}
/// Returns the size at time of being called.
/// Do not use to determine whether to call DequeueItem(), use TryDequeueItem() instead
/** Returns the size at time of being called.
Do not use to determine whether to call DequeueItem(), use TryDequeueItem() instead */
size_t Size(void)
{
cCSLock Lock(m_CS);
@ -146,8 +145,8 @@ public:
}
/// Removes the item from the queue. If there are multiple such items, only the first one is removed.
/// Returns true if the item has been removed, false if no such item found.
/** Removes the item from the queue. If there are multiple such items, only the first one is removed.
Returns true if the item has been removed, false if no such item found. */
bool Remove(ItemType a_Item)
{
cCSLock Lock(m_CS);
@ -187,16 +186,16 @@ public:
}
private:
/// The contents of the queue
/** The contents of the queue */
QueueType m_Contents;
/// Mutex that protects access to the queue contents
/** Mutex that protects access to the queue contents */
cCriticalSection m_CS;
/// Event that is signalled when an item is added
/** Event that is signalled when an item is added */
cEvent m_evtAdded;
/// Event that is signalled when an item is removed (both dequeued or erased)
/** Event that is signalled when an item is removed (both dequeued or erased) */
cEvent m_evtRemoved;
};

View File

@ -48,25 +48,29 @@ public:
cProbabDistrib(int a_MaxValue);
/// Sets the distribution curve using an array of [value, probability] points, linearly interpolated. a_Points must not be empty.
/** Sets the distribution curve using an array of [value, probability] points, linearly interpolated. a_Points must not be empty. */
void SetPoints(const cPoints & a_Points);
/// Sets the distribution curve using a definition string; returns true on successful parse
/** Sets the distribution curve using a definition string; returns true on successful parse */
bool SetDefString(const AString & a_DefString);
/// Gets a random value from a_Rand, shapes it into the distribution curve and returns the value.
/** Gets a random value from a_Rand, shapes it into the distribution curve and returns the value. */
int Random(MTRand & a_Rand) const;
/// Maps value in range [0, m_Sum] into the range [0, m_MaxValue] using the stored probability
/** Maps value in range [0, m_Sum] into the range [0, m_MaxValue] using the stored probability */
int MapValue(int a_OrigValue) const;
int GetSum(void) const { return m_Sum; }
protected:
int m_MaxValue;
cPoints m_Cumulative; ///< Cumulative probability of the values, sorted, for fast bsearch lookup
int m_Sum; ///< Sum of all the probabilities across all values in the domain; -1 if not set
int m_MaxValue;
/** Cumulative probability of the values, sorted, for fast bsearch lookup */
cPoints m_Cumulative;
/** Sum of all the probabilities across all values in the domain; -1 if not set */
int m_Sum;
} ;

View File

@ -59,7 +59,7 @@ public:
virtual ~cProtocol() {}
/// Called when client sends some data
/** Called when client sends some data */
virtual void DataReceived(const char * a_Data, size_t a_Size) = 0;
// Sending stuff to clients (alphabetically sorted):
@ -150,7 +150,7 @@ public:
virtual void SendWindowOpen (const cWindow & a_Window) = 0;
virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) = 0;
/// Returns the ServerID used for authentication through session.minecraft.net
/** Returns the ServerID used for authentication through session.minecraft.net */
virtual AString GetAuthServerID(void) = 0;
protected:

View File

@ -41,13 +41,13 @@ public:
cProtocolRecognizer(cClientHandle * a_Client);
virtual ~cProtocolRecognizer();
/// Translates protocol version number into protocol version text: 49 -> "1.4.4"
/** Translates protocol version number into protocol version text: 49 -> "1.4.4" */
static AString GetVersionTextFromInt(int a_ProtocolVersion);
/// Called when client sends some data:
/** Called when client sends some data: */
virtual void DataReceived(const char * a_Data, size_t a_Size) override;
/// Sending stuff to clients (alphabetically sorted):
/** Sending stuff to clients (alphabetically sorted): */
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
virtual void SendBlockBreakAnim (UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override;
@ -140,15 +140,19 @@ public:
virtual void SendData(const char * a_Data, size_t a_Size) override;
protected:
cProtocol * m_Protocol; ///< The recognized protocol
cByteBuffer m_Buffer; ///< Buffer for the incoming data until we recognize the protocol
/** The recognized protocol */
cProtocol * m_Protocol;
/** Buffer for the incoming data until we recognize the protocol */
cByteBuffer m_Buffer;
/// Tries to recognize protocol based on m_Buffer contents; returns true if recognized
/** Tries to recognize protocol based on m_Buffer contents; returns true if recognized */
bool TryRecognizeProtocol(void);
/** Tries to recognize a protocol in the lengthed family (1.7+), based on m_Buffer; returns true if recognized.
The packet length and type have already been read, type is 0
The number of bytes remaining in the packet is passed as a_PacketLengthRemaining. **/
The number of bytes remaining in the packet is passed as a_PacketLengthRemaining. */
bool TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRemaining);
/** Sends a single packet contained within the cPacketizer class.

View File

@ -336,7 +336,6 @@ void cRCONServer::cConnection::UIntToBuffer(UInt32 a_Value, char * a_Buffer)
/// Sends a RCON packet back to the client
void cRCONServer::cConnection::SendResponse(UInt32 a_RequestID, UInt32 a_PacketType, UInt32 a_PayloadLength, const char * a_Payload)
{
ASSERT((a_PayloadLength == 0) || (a_Payload != nullptr)); // Either zero data to send, or a valid payload ptr

View File

@ -78,10 +78,10 @@ public:
}
// tolua_end
/// Calls the callback for each world; returns true if the callback didn't abort (return true)
/** Calls the callback for each world; returns true if the callback didn't abort (return true) */
bool ForEachWorld(cWorldListCallback & a_Callback); // >> Exported in ManualBindings <<
/// Writes chunkstats, for each world and totals, to the output callback
/** Writes chunkstats, for each world and totals, to the output callback */
void LogChunkStats(cCommandOutputCallback & a_Output);
cMonsterConfig * GetMonsterConfig(void) { return m_MonsterConfig; }
@ -89,7 +89,7 @@ public:
cCraftingRecipes * GetCraftingRecipes(void) { return m_CraftingRecipes; } // tolua_export
cFurnaceRecipe * GetFurnaceRecipe (void) { return m_FurnaceRecipe; } // Exported in ManualBindings.cpp with quite a different signature
/// Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel
/** Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel */
static int GetFurnaceFuelBurnTime(const cItem & a_Fuel); // tolua_export
/** The current time where the startup of the server has been completed */
@ -115,28 +115,28 @@ public:
*/
void QueueExecuteConsoleCommand(const AString & a_Cmd); // tolua_export
/// Executes a console command through the cServer class; does special handling for "stop" and "restart".
/** Executes a console command through the cServer class; does special handling for "stop" and "restart". */
void ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output);
/// Kicks the user, no matter in what world they are. Used from cAuthenticator
/** Kicks the user, no matter in what world they are. Used from cAuthenticator */
void KickUser(int a_ClientID, const AString & a_Reason);
/// Called by cAuthenticator to auth the specified user
/** Called by cAuthenticator to auth the specified user */
void AuthenticateUser(int a_ClientID, const AString & a_Name, const AString & a_UUID, const Json::Value & a_Properties);
/// Executes commands queued in the command queue
/** Executes commands queued in the command queue */
void TickCommands(void);
/// Returns the number of chunks loaded
/** Returns the number of chunks loaded */
int GetTotalChunkCount(void); // tolua_export
/// Saves all chunks in all worlds
/** Saves all chunks in all worlds */
void SaveAllChunks(void); // tolua_export
/// Calls the callback for each player in all worlds
/** Calls the callback for each player in all worlds */
bool ForEachPlayer(cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
/// Finds a player from a partial or complete player name and calls the callback - case-insensitive
/** Finds a player from a partial or complete player name and calls the callback - case-insensitive */
bool FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
/** Finds the player over his uuid and calls the callback */
@ -153,7 +153,7 @@ public:
// tolua_begin
/// Sends a chat message to all connected clients (in all worlds)
/** Sends a chat message to all connected clients (in all worlds) */
void BroadcastChat (const AString & a_Message, eMessageType a_ChatPrefix = mtCustom);
void BroadcastChat (const cCompositeChat & a_Message);
void BroadcastChatDeath (const AString & a_Message) { BroadcastChat(a_Message, mtDeath); }
@ -165,13 +165,13 @@ public:
void BroadcastChatSuccess(const AString & a_Message) { BroadcastChat(a_Message, mtSuccess); }
void BroadcastChatWarning(const AString & a_Message) { BroadcastChat(a_Message, mtWarning); }
/// Returns the textual description of the protocol version: 49 -> "1.4.4". Provided specifically for Lua API
/** Returns the textual description of the protocol version: 49 -> "1.4.4". Provided specifically for Lua API */
static AString GetProtocolVersionTextFromInt(int a_ProtocolVersionNum);
/// Returns the amount of virtual RAM used, in KiB. Returns a negative number on error
/** Returns the amount of virtual RAM used, in KiB. Returns a negative number on error */
static int GetVirtualRAMUsage(void);
/// Returns the amount of virtual RAM used, in KiB. Returns a negative number on error
/** Returns the amount of virtual RAM used, in KiB. Returns a negative number on error */
static int GetPhysicalRAMUsage(void);
// tolua_end
@ -220,19 +220,19 @@ private:
void LoadGlobalSettings();
/// Loads the worlds from settings.ini, creates the worldmap
/** Loads the worlds from settings.ini, creates the worldmap */
void LoadWorlds(cSettingsRepositoryInterface & a_Settings);
/// Starts each world's life
/** Starts each world's life */
void StartWorlds(void);
/// Stops each world's threads, so that it's safe to unload them
/** Stops each world's threads, so that it's safe to unload them */
void StopWorlds(void);
/// Unloads all worlds from memory
/** Unloads all worlds from memory */
void UnloadWorlds(void);
/// Does the actual work of executing a command
/** Does the actual work of executing a command */
void DoExecuteConsoleCommand(const AString & a_Cmd);
static cRoot * s_Root;

View File

@ -33,10 +33,10 @@ extern "C"
// For the "dumpmem" server command:
/// Synchronize this with main.cpp - the leak finder needs initialization before it can be used to dump memory
// _X 2014_02_20: Disabled for canon repo, it makes the debug version too slow in MSVC2013
// and we haven't had a memory leak for over a year anyway.
/** Enable the memory leak finder - needed for the "dumpmem" server command:
Synchronize this with main.cpp - the leak finder needs initialization before it can be used to dump memory
_X 2014_02_20: Disabled for canon repo, it makes the debug version too slow in MSVC2013
and we haven't had a memory leak for over a year anyway. */
// #define ENABLE_LEAK_FINDER
#if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)

View File

@ -18,29 +18,29 @@ public:
/** Returns true iff the specified value exists. */
virtual bool HasValue(const AString & a_KeyName, const AString & a_ValueName) const = 0;
/** Add a key name. Return value is not required to mean anything **/
/** Add a key name. Return value is not required to mean anything */
virtual int AddKeyName(const AString & keyname) = 0;
/** Add a key comment, will always fail if the repository does not support comments **/
/** Add a key comment, will always fail if the repository does not support comments */
virtual bool AddKeyComment(const AString & keyname, const AString & comment) = 0;
/** Return a key comment, returns "" for repositories that do not return comments **/
/** Return a key comment, returns "" for repositories that do not return comments */
virtual AString GetKeyComment(const AString & keyname, const int commentID) const = 0;
/** Delete a key comment, will always fail if the repository does not support comments **/
/** Delete a key comment, will always fail if the repository does not support comments */
virtual bool DeleteKeyComment(const AString & keyname, const int commentID) = 0;
/** Adds a new value to the specified key.
If a value of the same name already exists, creates another one **/
If a value of the same name already exists, creates another one */
virtual void AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value) = 0;
/** returns a vector containing a name, value pair for each value under the key **/
/** returns a vector containing a name, value pair for each value under the key */
virtual std::vector<std::pair<AString, AString>> GetValues(AString a_keyName) = 0;
/** Get the value at the specified key and value, returns defValue on failure **/
/** Get the value at the specified key and value, returns defValue on failure */
virtual AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const = 0;
/** Gets the value; if not found, write the default to the repository **/
/** Gets the value; if not found, write the default to the repository */
virtual AString GetValueSet (const AString & keyname, const AString & valuename, const AString & defValue = "") = 0;
virtual int GetValueSetI(const AString & keyname, const AString & valuename, const int defValue = 0) = 0;
virtual Int64 GetValueSetI(const AString & keyname, const AString & valuename, const Int64 defValue = 0) = 0;
@ -48,14 +48,14 @@ public:
/** Overwrites the value of the key, value pair
Specify the optional parameter as false if you do not want the value created if it doesn't exist.
Returns true if value set, false otherwise. **/
Returns true if value set, false otherwise. */
virtual bool SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists = true) = 0;
virtual bool SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists = true) = 0;
/** Deletes the specified key, value pair **/
/** Deletes the specified key, value pair */
virtual bool DeleteValue(const AString & keyname, const AString & valuename) = 0;
/** Writes the changes to the backing store, if the repository has one **/
/** Writes the changes to the backing store, if the repository has one */
virtual bool Flush() = 0;
};

View File

@ -22,10 +22,10 @@ public:
class cSlot
{
public:
/// Returns true if the specified block is stored
/** Returns true if the specified block is stored */
bool HasBlock(int a_RelX, int a_RelY, int a_RelZ);
/// Adds the specified block unless already present; returns true if added, false if the block was already present
/** Adds the specified block unless already present; returns true if added, false if the block was already present */
bool Add(int a_RelX, int a_RelY, int a_RelZ);
/** Array of block containers, each item stores blocks for one Z coord
@ -37,7 +37,7 @@ public:
cDelayedFluidSimulatorChunkData(int a_TickDelay);
virtual ~cDelayedFluidSimulatorChunkData();
/// Slots, one for each delay tick, each containing the blocks to simulate
/** Slots, one for each delay tick, each containing the blocks to simulate */
cSlot * m_Slots;
} ;
@ -67,13 +67,11 @@ protected:
int m_TotalBlocks; // Statistics only: the total number of blocks currently queued
/*
Slots:
/* Slots:
| 0 | 1 | ... | m_AddSlotNum | m_SimSlotNum | ... | m_TickDelay - 1 |
| adding blocks here ^ | ^ simulating here
*/
| adding blocks here ^ | ^ simulating here */
/// Called from SimulateChunk() to simulate each block in one slot of blocks. Descendants override this method to provide custom simulation.
/** Called from SimulateChunk() to simulate each block in one slot of blocks. Descendants override this method to provide custom simulation. */
virtual void SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) = 0;
} ;

View File

@ -31,35 +31,34 @@ public:
static bool DoesBurnForever(BLOCKTYPE a_BlockType);
protected:
/// Time (in msec) that a fire block takes to burn with a fuel block into the next step
/** Time (in msec) that a fire block takes to burn with a fuel block into the next step */
unsigned m_BurnStepTimeFuel;
/// Time (in msec) that a fire block takes to burn without a fuel block into the next step
/** Time (in msec) that a fire block takes to burn without a fuel block into the next step */
unsigned m_BurnStepTimeNonfuel;
/// Chance [0..100000] of an adjacent fuel to catch fire on each tick
/** Chance [0..100000] of an adjacent fuel to catch fire on each tick */
int m_Flammability;
/// Chance [0..100000] of a fuel burning out being replaced by a new fire block instead of an air block
/** Chance [0..100000] of a fuel burning out being replaced by a new fire block instead of an air block */
int m_ReplaceFuelChance;
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override;
/// Returns the time [msec] after which the specified fire block is stepped again; based on surrounding fuels
/** Returns the time [msec] after which the specified fire block is stepped again; based on surrounding fuels */
int GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
/// Tries to spread fire to a neighborhood of the specified block
/** Tries to spread fire to a neighborhood of the specified block */
void TrySpreadFire(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
/// Removes all burnable blocks neighboring the specified block
/** Removes all burnable blocks neighboring the specified block */
void RemoveFuelNeighbors(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
/** Returns true if a fire can be started in the specified block,
that is, it is an air block and has fuel next to it.
Note that a_NearChunk may be a chunk neighbor to the block specified!
The coords are relative to a_NearChunk but not necessarily in it.
*/
The coords are relative to a_NearChunk but not necessarily in it. */
bool CanStartFireInBlock(cChunk * a_NearChunk, int a_RelX, int a_RelY, int a_RelZ);
} ;
@ -67,7 +66,7 @@ protected:
/// Stores individual fire blocks in the chunk; the int data is used as the time [msec] the fire takes to step to another stage (blockmeta++)
/** Stores individual fire blocks in the chunk; the int data is used as the time [msec] the fire takes to step to another stage (blockmeta++) */
typedef cCoordWithIntList cFireSimulatorChunkData;

View File

@ -24,8 +24,7 @@ enum Direction
/** This is a base class for all fluid simulator data classes.
Needed so that cChunk can properly delete instances of fluid simulator data, no matter what simulator it's using
*/
Needed so that cChunk can properly delete instances of fluid simulator data, no matter what simulator it's using. */
class cFluidSimulatorData
{
public:
@ -47,10 +46,10 @@ public:
// cSimulator overrides:
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override;
/// Gets the flowing direction. If a_Over is true also the block over the current block affects the direction (standard)
/** Gets the flowing direction. If a_Over is true also the block over the current block affects the direction (standard) */
virtual Direction GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a_Over = true);
/// Creates a ChunkData object for the simulator to use. The simulator returns the correct object type.
/** Creates a ChunkData object for the simulator to use. The simulator returns the correct object type. */
virtual cFluidSimulatorData * CreateChunkData(void) { return nullptr; }
bool IsFluidBlock (BLOCKTYPE a_BlockType) const { return (a_BlockType == m_FluidBlock); }
@ -62,7 +61,7 @@ public:
bool IsSolidBlock (BLOCKTYPE a_BlockType);
bool IsPassableForFluid(BLOCKTYPE a_BlockType);
/// Returns true if a_Meta1 is a higher fluid than a_Meta2. Takes source blocks into account.
/** Returns true if a_Meta1 is a higher fluid than a_Meta2. Takes source blocks into account. */
bool IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2);
protected:

View File

@ -71,12 +71,11 @@ private:
bool ShouldPowerOn; // What happens when the delay time is fulfilled?
};
/** Per-chunk data for the simulator, specified individual chunks to simulate */
class cIncrementalRedstoneSimulatorChunkData :
public cRedstoneSimulatorChunkData
{
public:
/// Per-chunk data for the simulator, specified individual chunks to simulate
/** test */
std::unordered_map<Vector3i, std::pair<BLOCKTYPE, bool>, VectorHasher<int>> m_ChunkData;
std::vector<sPoweredBlocks> m_PoweredBlocks;
@ -241,7 +240,7 @@ private:
The only diffence between this and a normal AreCoordsPowered is that this function checks for a wire powering another wire */
static unsigned char IsWirePowered(Vector3i a_RelBlockPosition, cChunk * a_Chunk);
/** Handles delayed updates to repeaters **/
/** Handles delayed updates to repeaters */
void HandleRedstoneRepeaterDelays(void);
/** Returns if lever metadata marks it as emitting power */

View File

@ -3,13 +3,25 @@
#include "Simulator.h"
/// Per-chunk data for the simulator, specified individual chunks to simulate; Data is not used
// fwd:
class cChunk;
/** Per-chunk data for the simulator, specified individual chunks to simulate; Data is not used */
typedef cCoordWithIntList cSandSimulatorChunkData;
#include "Chunk.h"
/// Despite the class name, this simulator takes care of all blocks that fall when suspended in the air.
/** Despite the class name, this simulator takes care of all blocks that fall when suspended in the air. */
class cSandSimulator :
public cSimulator
{
@ -21,23 +33,22 @@ public:
virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override;
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override;
/// Returns true if a falling-able block can start falling through the specified block type
/** Returns true if a falling-able block can start falling through the specified block type */
static bool CanStartFallingThrough(BLOCKTYPE a_BlockType);
/// Returns true if an already-falling block can pass through the specified block type (e. g. torch)
/** Returns true if an already-falling block can pass through the specified block type (e. g. torch) */
static bool CanContinueFallThrough(BLOCKTYPE a_BlockType);
/// Returns true if the falling block rematerializing will replace the specified block type (e. g. tall grass)
/** Returns true if the falling block rematerializing will replace the specified block type (e. g. tall grass) */
static bool IsReplacedOnRematerialization(BLOCKTYPE a_BlockType);
/// Returns true if the specified block breaks falling blocks while they fall through it (e. g. halfslabs)
/** Returns true if the specified block breaks falling blocks while they fall through it (e. g. halfslabs) */
static bool DoesBreakFallingThrough(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
/** Called when a block finishes falling at the specified coords, either by insta-fall,
or through cFallingBlock entity.
It either rematerializes the block (a_FallingBlockType) at the specified coords, or creates a pickup,
based on the block currently present in the world at the dest specified coords
*/
based on the block currently present in the world at the dest specified coords. */
static void FinishFalling(
cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ,
BLOCKTYPE a_FallingBlockType, NIBBLETYPE a_FallingBlockMeta
@ -50,7 +61,7 @@ protected:
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override;
/// Performs the instant fall of the block - removes it from top, Finishes it at the bottom
/** Performs the instant fall of the block - removes it from top, Finishes it at the bottom */
void DoInstantFall(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
};

View File

@ -20,10 +20,10 @@ public:
virtual ~cSimulator() {}
/// Called in each tick, a_Dt is the time passed since the last tick, in msec
/** Called in each tick, a_Dt is the time passed since the last tick, in msec */
virtual void Simulate(float a_Dt) = 0;
/// Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available
/** Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available */
virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk)
{
UNUSED(a_Dt);
@ -32,7 +32,7 @@ public:
UNUSED(a_Chunk);
}
/// Called when a block changes
/** Called when a block changes */
virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk);
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) = 0;
@ -40,7 +40,7 @@ public:
protected:
friend class cChunk; // Calls AddBlock() in its WakeUpSimulators() function, to speed things up
/// Called to simulate a new block
/** Called to simulate a new block */
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) = 0;
cWorld & m_World;

View File

@ -10,7 +10,6 @@
/// Compresses a_Data into a_Compressed; returns Z_XXX error constants same as zlib's compress2()
int CompressString(const char * a_Data, size_t a_Length, AString & a_Compressed, int a_Factor)
{
uLongf CompressedSize = compressBound(static_cast<uLong>(a_Length));
@ -32,7 +31,6 @@ int CompressString(const char * a_Data, size_t a_Length, AString & a_Compressed,
/// Uncompresses a_Data into a_Decompressed; returns Z_XXX error constants same as zlib's uncompress()
int UncompressString(const char * a_Data, size_t a_Length, AString & a_Uncompressed, size_t a_UncompressedSize)
{
// HACK: We're assuming that AString returns its internal buffer in its data() call and we're overwriting that buffer!

View File

@ -9,16 +9,16 @@
/// Compresses a_Data into a_Compressed using ZLIB; returns Z_XXX error constants same as zlib's compress2()
/** Compresses a_Data into a_Compressed using ZLIB; returns Z_XXX error constants same as zlib's compress2() */
extern int CompressString(const char * a_Data, size_t a_Length, AString & a_Compressed, int a_Factor);
/// Uncompresses a_Data into a_Uncompressed; returns Z_XXX error constants same as zlib's decompress()
/** Uncompresses a_Data into a_Uncompressed; returns Z_XXX error constants same as zlib's decompress() */
extern int UncompressString(const char * a_Data, size_t a_Length, AString & a_Uncompressed, size_t a_UncompressedSize);
/// Compresses a_Data into a_Compressed using GZIP; returns Z_OK for success or Z_XXX error constants same as zlib
/** Compresses a_Data into a_Compressed using GZIP; returns Z_OK for success or Z_XXX error constants same as zlib */
extern int CompressStringGZIP(const char * a_Data, size_t a_Length, AString & a_Compressed);
/// Uncompresses a_Data into a_Uncompressed using GZIP; returns Z_OK for success or Z_XXX error constants same as zlib
/** Uncompresses a_Data into a_Uncompressed using GZIP; returns Z_OK for success or Z_XXX error constants same as zlib */
extern int UncompressStringGZIP(const char * a_Data, size_t a_Length, AString & a_Uncompressed);
/** Uncompresses a_Data into a_Uncompressed using Inflate; returns Z_OK for success or Z_XXX error constants same as zlib */

View File

@ -782,7 +782,7 @@ AString ReplaceAllCharOccurrences(const AString & a_String, char a_From, char a_
/// Converts one Hex character in a Base64 encoding into the data value
/** Converts one Hex character in a Base64 encoding into the data value */
static inline int UnBase64(char c)
{
if ((c >='A') && (c <= 'Z'))

View File

@ -94,25 +94,25 @@ extern AString EscapeString(const AString & a_Message); // tolua_export
/** Removes all control codes used by MC for colors and styles. */
extern AString StripColorCodes(const AString & a_Message); // tolua_export
/// URL-Decodes the given string, replacing all "%HH" into the correct characters. Invalid % sequences are left intact
/** URL-Decodes the given string, replacing all "%HH" into the correct characters. Invalid % sequences are left intact */
extern AString URLDecode(const AString & a_String); // Cannot export to Lua automatically - would generated an extra return value
/// Replaces all occurrences of char a_From inside a_String with char a_To.
/** Replaces all occurrences of char a_From inside a_String with char a_To. */
extern AString ReplaceAllCharOccurrences(const AString & a_String, char a_From, char a_To); // Needn't export to Lua, since Lua doesn't have chars anyway
/// Decodes a Base64-encoded string into the raw data
/** Decodes a Base64-encoded string into the raw data */
extern AString Base64Decode(const AString & a_Base64String); // Exported manually due to embedded NULs and extra parameter
/// Encodes a string into Base64
/** Encodes a string into Base64 */
extern AString Base64Encode(const AString & a_Input); // Exported manually due to embedded NULs and extra parameter
/// Reads two bytes from the specified memory location and interprets them as BigEndian short
/** Reads two bytes from the specified memory location and interprets them as BigEndian short */
extern short GetBEShort(const char * a_Mem);
/// Reads four bytes from the specified memory location and interprets them as BigEndian int
/** Reads four bytes from the specified memory location and interprets them as BigEndian int */
extern int GetBEInt(const char * a_Mem);
/// Writes four bytes to the specified memory location so that they interpret as BigEndian int
/** Writes four bytes to the specified memory location so that they interpret as BigEndian int */
extern void SetBEInt(char * a_Mem, Int32 a_Value);
/** Splits a string that has embedded \0 characters, on those characters.

Some files were not shown because too many files have changed in this diff Show More