Fixed style
This commit is contained in:
parent
9c459cbe50
commit
799c96661d
@ -19,8 +19,8 @@ public:
|
||||
/** Returns the associated BlockInfo structure for the specified block type. */
|
||||
|
||||
/** This accessor makes sure that the cBlockInfo structures are properly initialized exactly once.
|
||||
It does so by using the C++ singleton approximation - storing the actual singleton as the function's static variable.
|
||||
It works only if it is called for the first time before the app spawns other threads. */
|
||||
It does so by using the C++ singleton approximation - storing the actual singleton as the function's static variable.
|
||||
It works only if it is called for the first time before the app spawns other threads. */
|
||||
static cBlockInfo & Get(BLOCKTYPE a_Type)
|
||||
{
|
||||
static cBlockInfo ms_Info[256];
|
||||
|
@ -5,24 +5,49 @@
|
||||
#include "ChunkMap.h"
|
||||
#include "BlockHandler.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BLOCKTYPE cChunkInterface::GetBlock(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
return m_ChunkMap->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BLOCKTYPE cChunkInterface::GetBlock(const Vector3i & a_Pos)
|
||||
{
|
||||
return GetBlock(a_Pos.x, a_Pos.y, a_Pos.z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NIBBLETYPE cChunkInterface::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
return m_ChunkMap->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunkInterface::GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
|
||||
{
|
||||
return m_ChunkMap->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Sets the block at the specified coords to the specified value.
|
||||
Full processing, incl. updating neighbors, is performed.
|
||||
*/
|
||||
@ -31,16 +56,31 @@ void cChunkInterface::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTY
|
||||
m_ChunkMap->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkInterface::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData)
|
||||
{
|
||||
m_ChunkMap->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, a_MetaData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkInterface::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay, BLOCKTYPE a_PreviousBlockType, cWorldInterface & a_WorldInterface)
|
||||
{
|
||||
m_ChunkMap->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_WorldInterface.GetWorldAge() + a_TickDelay, a_PreviousBlockType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Sets the block at the specified coords to the specified value.
|
||||
The replacement doesn't trigger block updates.
|
||||
The replaced blocks aren't checked for block entities (block entity is leaked if it exists at this block)
|
||||
@ -50,29 +90,55 @@ void cChunkInterface::FastSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLO
|
||||
m_ChunkMap->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkInterface::FastSetBlock(const Vector3i & a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
FastSetBlock( a_Pos.x, a_Pos.y, a_Pos.z, a_BlockType, a_BlockMeta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkInterface::UseBlockEntity(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
m_ChunkMap->UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunkInterface::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback)
|
||||
{
|
||||
return m_ChunkMap->ForEachChunkInRect(a_MinChunkX, a_MaxChunkX, a_MinChunkZ, a_MaxChunkZ, a_Callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunkInterface::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes)
|
||||
{
|
||||
return m_ChunkMap->WriteBlockArea(a_Area, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cChunkInterface::DigBlock(cWorldInterface & a_WorldInterface, int a_X, int a_Y, int a_Z)
|
||||
{
|
||||
cBlockHandler * Handler = cBlockInfo::GetHandler(GetBlock(a_X, a_Y, a_Z));
|
||||
Handler->OnDestroyed(*this, a_WorldInterface, a_X, a_Y, a_Z);
|
||||
return m_ChunkMap->DigBlock(a_X, a_Y, a_Z);
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,20 @@ class cBlockTripwireHookHandler;
|
||||
class cBlockDoorHandler;
|
||||
class cBlockPistonHandler;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<BLOCKTYPE T>
|
||||
class GetHandlerCompileTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
class GetHandlerCompileTime<E_BLOCK_TORCH>
|
||||
{
|
||||
@ -18,6 +29,11 @@ public:
|
||||
typedef cBlockTorchHandler type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
class GetHandlerCompileTime<E_BLOCK_LEVER>
|
||||
{
|
||||
@ -25,6 +41,11 @@ public:
|
||||
typedef cBlockLeverHandler type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
class GetHandlerCompileTime<E_BLOCK_STONE_BUTTON>
|
||||
{
|
||||
@ -32,6 +53,11 @@ public:
|
||||
typedef cBlockButtonHandler type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
class GetHandlerCompileTime<E_BLOCK_TRIPWIRE_HOOK>
|
||||
{
|
||||
@ -39,6 +65,11 @@ public:
|
||||
typedef cBlockTripwireHookHandler type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
class GetHandlerCompileTime<E_BLOCK_WOODEN_DOOR>
|
||||
{
|
||||
@ -46,9 +77,15 @@ public:
|
||||
typedef cBlockDoorHandler type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
class GetHandlerCompileTime<E_BLOCK_PISTON>
|
||||
{
|
||||
public:
|
||||
typedef cBlockPistonHandler type;
|
||||
};
|
||||
|
||||
|
@ -25,6 +25,9 @@ class cMonster :
|
||||
typedef cPawn super;
|
||||
public:
|
||||
|
||||
//Depreciated
|
||||
typedef eMonsterType eType;
|
||||
|
||||
enum eFamily
|
||||
{
|
||||
mfHostile = 0, // Spider, Zombies ...
|
||||
|
Loading…
Reference in New Issue
Block a user