Fixed basic whitespace problems.
Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines.
This commit is contained in:
parent
c3b4b70a73
commit
993fd14ddf
@ -61,7 +61,7 @@ class cListAllocationPool : public cAllocationPool<T>
|
|||||||
free (m_FreeList.front());
|
free (m_FreeList.front());
|
||||||
m_FreeList.pop_front();
|
m_FreeList.pop_front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual T * Allocate() override
|
virtual T * Allocate() override
|
||||||
{
|
{
|
||||||
@ -90,7 +90,7 @@ class cListAllocationPool : public cAllocationPool<T>
|
|||||||
}
|
}
|
||||||
virtual void Free(T * a_ptr) override
|
virtual void Free(T * a_ptr) override
|
||||||
{
|
{
|
||||||
if (a_ptr == NULL)
|
if (a_ptr == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -107,3 +107,7 @@ class cListAllocationPool : public cAllocationPool<T>
|
|||||||
std::list<void *> m_FreeList;
|
std::list<void *> m_FreeList;
|
||||||
std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
|
std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ typedef void (CombinatorFunc)(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLE
|
|||||||
|
|
||||||
// This wild construct allows us to pass a function argument and still have it inlined by the compiler :)
|
// 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
|
||||||
template<bool MetasValid, CombinatorFunc Combinator>
|
template<bool MetasValid, CombinatorFunc Combinator>
|
||||||
void InternalMergeBlocks(
|
void InternalMergeBlocks(
|
||||||
BLOCKTYPE * a_DstTypes, const BLOCKTYPE * a_SrcTypes,
|
BLOCKTYPE * a_DstTypes, const BLOCKTYPE * a_SrcTypes,
|
||||||
NIBBLETYPE * a_DstMetas, const NIBBLETYPE * a_SrcMetas,
|
NIBBLETYPE * a_DstMetas, const NIBBLETYPE * a_SrcMetas,
|
||||||
int a_SizeX, int a_SizeY, int a_SizeZ,
|
int a_SizeX, int a_SizeY, int a_SizeZ,
|
||||||
int a_SrcOffX, int a_SrcOffY, int a_SrcOffZ,
|
int a_SrcOffX, int a_SrcOffY, int a_SrcOffZ,
|
||||||
int a_DstOffX, int a_DstOffY, int a_DstOffZ,
|
int a_DstOffX, int a_DstOffY, int a_DstOffZ,
|
||||||
@ -136,7 +136,7 @@ void MergeCombinatorLake(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Air is always hollowed out
|
// Air is always hollowed out
|
||||||
if (a_SrcType == E_BLOCK_AIR)
|
if (a_SrcType == E_BLOCK_AIR)
|
||||||
{
|
{
|
||||||
a_DstType = E_BLOCK_AIR;
|
a_DstType = E_BLOCK_AIR;
|
||||||
@ -781,7 +781,7 @@ void cBlockArea::Fill(int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_Block
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cBlockArea::FillRelCuboid(int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ,
|
void cBlockArea::FillRelCuboid(int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ,
|
||||||
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta,
|
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta,
|
||||||
NIBBLETYPE a_BlockLight, NIBBLETYPE a_BlockSkyLight
|
NIBBLETYPE a_BlockLight, NIBBLETYPE a_BlockSkyLight
|
||||||
)
|
)
|
||||||
@ -2226,7 +2226,7 @@ void cBlockArea::MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_Rel
|
|||||||
m_Size.x, m_Size.y, m_Size.z
|
m_Size.x, m_Size.y, m_Size.z
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
} // case msDifference
|
} // case msDifference
|
||||||
|
|
||||||
case cBlockArea::msMask:
|
case cBlockArea::msMask:
|
||||||
{
|
{
|
||||||
|
@ -175,7 +175,7 @@ public:
|
|||||||
void Fill(int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta = 0, NIBBLETYPE a_BlockLight = 0, NIBBLETYPE a_BlockSkyLight = 0x0f);
|
void Fill(int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta = 0, NIBBLETYPE a_BlockLight = 0, NIBBLETYPE a_BlockSkyLight = 0x0f);
|
||||||
|
|
||||||
/** Fills a cuboid inside the block area with the specified data */
|
/** Fills a cuboid inside the block area with the specified data */
|
||||||
void FillRelCuboid(int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ,
|
void FillRelCuboid(int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ,
|
||||||
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta = 0,
|
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta = 0,
|
||||||
NIBBLETYPE a_BlockLight = 0, NIBBLETYPE a_BlockSkyLight = 0x0f
|
NIBBLETYPE a_BlockLight = 0, NIBBLETYPE a_BlockSkyLight = 0x0f
|
||||||
);
|
);
|
||||||
@ -357,7 +357,7 @@ protected:
|
|||||||
|
|
||||||
/** Sets the specified datatypes at the specified location. */
|
/** Sets the specified datatypes at the specified location. */
|
||||||
void RelSetData(
|
void RelSetData(
|
||||||
int a_RelX, int a_RelY, int a_RelZ,
|
int a_RelX, int a_RelY, int a_RelZ,
|
||||||
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta,
|
int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta,
|
||||||
NIBBLETYPE a_BlockLight, NIBBLETYPE a_BlockSkyLight
|
NIBBLETYPE a_BlockLight, NIBBLETYPE a_BlockSkyLight
|
||||||
);
|
);
|
||||||
|
@ -286,7 +286,7 @@ int StringToMobType(const AString & a_MobString)
|
|||||||
{cMonster::mtMooshroom, "Mooshroom"},
|
{cMonster::mtMooshroom, "Mooshroom"},
|
||||||
{cMonster::mtSnowGolem, "SnowGolem"},
|
{cMonster::mtSnowGolem, "SnowGolem"},
|
||||||
{cMonster::mtOcelot, "Ocelot"},
|
{cMonster::mtOcelot, "Ocelot"},
|
||||||
{cMonster::mtIronGolem, "IronGolem"},
|
{cMonster::mtIronGolem, "IronGolem"},
|
||||||
{cMonster::mtVillager, "Villager"},
|
{cMonster::mtVillager, "Villager"},
|
||||||
};
|
};
|
||||||
for (size_t i = 0; i < ARRAYCOUNT(MobMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(MobMap); i++)
|
||||||
|
@ -176,7 +176,7 @@ enum ENUM_BLOCK_ID
|
|||||||
E_BLOCK_ACACIA_WOOD_STAIRS = 163,
|
E_BLOCK_ACACIA_WOOD_STAIRS = 163,
|
||||||
E_BLOCK_DARK_OAK_WOOD_STAIRS = 164,
|
E_BLOCK_DARK_OAK_WOOD_STAIRS = 164,
|
||||||
E_BLOCK_HAY_BALE = 170,
|
E_BLOCK_HAY_BALE = 170,
|
||||||
E_BLOCK_CARPET = 171,
|
E_BLOCK_CARPET = 171,
|
||||||
E_BLOCK_HARDENED_CLAY = 172,
|
E_BLOCK_HARDENED_CLAY = 172,
|
||||||
E_BLOCK_BLOCK_OF_COAL = 173,
|
E_BLOCK_BLOCK_OF_COAL = 173,
|
||||||
E_BLOCK_PACKED_ICE = 174,
|
E_BLOCK_PACKED_ICE = 174,
|
||||||
@ -187,7 +187,7 @@ enum ENUM_BLOCK_ID
|
|||||||
E_BLOCK_NUMBER_OF_TYPES, ///< Number of individual (different) blocktypes
|
E_BLOCK_NUMBER_OF_TYPES, ///< Number of individual (different) blocktypes
|
||||||
E_BLOCK_MAX_TYPE_ID = E_BLOCK_NUMBER_OF_TYPES - 1, ///< Maximum BlockType number used
|
E_BLOCK_MAX_TYPE_ID = E_BLOCK_NUMBER_OF_TYPES - 1, ///< Maximum BlockType number used
|
||||||
|
|
||||||
// Synonym or ID compatibility
|
// Synonym or ID compatibility
|
||||||
E_BLOCK_YELLOW_FLOWER = E_BLOCK_DANDELION,
|
E_BLOCK_YELLOW_FLOWER = E_BLOCK_DANDELION,
|
||||||
E_BLOCK_RED_ROSE = E_BLOCK_FLOWER,
|
E_BLOCK_RED_ROSE = E_BLOCK_FLOWER,
|
||||||
E_BLOCK_LOCKED_CHEST = E_BLOCK_STAINED_GLASS,
|
E_BLOCK_LOCKED_CHEST = E_BLOCK_STAINED_GLASS,
|
||||||
|
@ -39,13 +39,13 @@ public:
|
|||||||
/** Called on each block encountered along the path, including the first block (path start), if chunk data is not loaded
|
/** Called on each block encountered along the path, including the first block (path start), if chunk data is not loaded
|
||||||
When this callback returns true, the tracing is aborted.
|
When this callback returns true, the tracing is aborted.
|
||||||
*/
|
*/
|
||||||
virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace)
|
virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace)
|
||||||
{
|
{
|
||||||
UNUSED(a_BlockX);
|
UNUSED(a_BlockX);
|
||||||
UNUSED(a_BlockY);
|
UNUSED(a_BlockY);
|
||||||
UNUSED(a_BlockZ);
|
UNUSED(a_BlockZ);
|
||||||
UNUSED(a_EntryFace);
|
UNUSED(a_EntryFace);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called when the path goes out of world, either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
|
/** Called when the path goes out of world, either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
|
||||||
@ -54,8 +54,8 @@ public:
|
|||||||
Note that some paths can go out of the world and come back again (parabola),
|
Note that some paths can go out of the world and come back again (parabola),
|
||||||
in such a case this callback is followed by OnIntoWorld() and further OnNextBlock() calls
|
in such a case this callback is followed by OnIntoWorld() and further OnNextBlock() calls
|
||||||
*/
|
*/
|
||||||
virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
|
virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
|
||||||
{
|
{
|
||||||
UNUSED(a_BlockX);
|
UNUSED(a_BlockX);
|
||||||
UNUSED(a_BlockY);
|
UNUSED(a_BlockY);
|
||||||
UNUSED(a_BlockZ);
|
UNUSED(a_BlockZ);
|
||||||
@ -68,12 +68,12 @@ public:
|
|||||||
Note that some paths can go out of the world and come back again (parabola),
|
Note that some paths can go out of the world and come back again (parabola),
|
||||||
in such a case this callback is followed by further OnNextBlock() calls
|
in such a case this callback is followed by further OnNextBlock() calls
|
||||||
*/
|
*/
|
||||||
virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
|
virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
|
||||||
{
|
{
|
||||||
UNUSED(a_BlockX);
|
UNUSED(a_BlockX);
|
||||||
UNUSED(a_BlockY);
|
UNUSED(a_BlockY);
|
||||||
UNUSED(a_BlockZ);
|
UNUSED(a_BlockZ);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called when the path is sure not to hit any more blocks.
|
/** Called when the path is sure not to hit any more blocks.
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
static const std::string Rose;
|
static const std::string Rose;
|
||||||
static const std::string LightPurple;
|
static const std::string LightPurple;
|
||||||
static const std::string Yellow;
|
static const std::string Yellow;
|
||||||
static const std::string White;
|
static const std::string White;
|
||||||
|
|
||||||
// Styles ( source: http://wiki.vg/Chat )
|
// Styles ( source: http://wiki.vg/Chat )
|
||||||
static const std::string Random;
|
static const std::string Random;
|
||||||
|
@ -62,7 +62,7 @@ sSetBlock::sSetBlock( int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_Bloc
|
|||||||
// cChunk:
|
// cChunk:
|
||||||
|
|
||||||
cChunk::cChunk(
|
cChunk::cChunk(
|
||||||
int a_ChunkX, int a_ChunkY, int a_ChunkZ,
|
int a_ChunkX, int a_ChunkY, int a_ChunkZ,
|
||||||
cChunkMap * a_ChunkMap, cWorld * a_World,
|
cChunkMap * a_ChunkMap, cWorld * a_World,
|
||||||
cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP,
|
cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP,
|
||||||
cAllocationPool<cChunkData::sChunkSection> & a_Pool
|
cAllocationPool<cChunkData::sChunkSection> & a_Pool
|
||||||
@ -443,7 +443,7 @@ void cChunk::CollectMobCensus(cMobCensus& toFill)
|
|||||||
{
|
{
|
||||||
currentPlayer = (*itr)->GetPlayer();
|
currentPlayer = (*itr)->GetPlayer();
|
||||||
playerPositions.push_back(&(currentPlayer->GetPosition()));
|
playerPositions.push_back(&(currentPlayer->GetPosition()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3d currentPosition;
|
Vector3d currentPosition;
|
||||||
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
|
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
|
||||||
@ -895,7 +895,7 @@ void cChunk::ApplyWeatherToTop()
|
|||||||
SetBlock(X, Height, Z, E_BLOCK_ICE, 0);
|
SetBlock(X, Height, Z, E_BLOCK_ICE, 0);
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
(m_World->IsDeepSnowEnabled()) &&
|
(m_World->IsDeepSnowEnabled()) &&
|
||||||
(
|
(
|
||||||
(TopBlock == E_BLOCK_RED_ROSE) ||
|
(TopBlock == E_BLOCK_RED_ROSE) ||
|
||||||
(TopBlock == E_BLOCK_YELLOW_FLOWER) ||
|
(TopBlock == E_BLOCK_YELLOW_FLOWER) ||
|
||||||
@ -944,10 +944,10 @@ void cChunk::GrowMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_Bl
|
|||||||
IsValid = IsValid && UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ + 1, BlockType[2], BlockMeta);
|
IsValid = IsValid && UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ + 1, BlockType[2], BlockMeta);
|
||||||
IsValid = IsValid && UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ - 1, BlockType[3], BlockMeta);
|
IsValid = IsValid && UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ - 1, BlockType[3], BlockMeta);
|
||||||
if (
|
if (
|
||||||
!IsValid ||
|
!IsValid ||
|
||||||
(BlockType[0] == ProduceType) ||
|
(BlockType[0] == ProduceType) ||
|
||||||
(BlockType[1] == ProduceType) ||
|
(BlockType[1] == ProduceType) ||
|
||||||
(BlockType[2] == ProduceType) ||
|
(BlockType[2] == ProduceType) ||
|
||||||
(BlockType[3] == ProduceType)
|
(BlockType[3] == ProduceType)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -1229,7 +1229,7 @@ bool cChunk::UnboundedRelSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE
|
|||||||
}
|
}
|
||||||
Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta);
|
Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2294,7 +2294,7 @@ bool cChunk::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceC
|
|||||||
}
|
}
|
||||||
} // switch (BlockType)
|
} // switch (BlockType)
|
||||||
|
|
||||||
// The correct block entity is here,
|
// The correct block entity is here,
|
||||||
if (a_Callback.Item((cFurnaceEntity *)*itr))
|
if (a_Callback.Item((cFurnaceEntity *)*itr))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -2326,7 +2326,7 @@ bool cChunk::DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cNoteBl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The correct block entity is here,
|
// The correct block entity is here
|
||||||
if (a_Callback.Item((cNoteEntity *)*itr))
|
if (a_Callback.Item((cNoteEntity *)*itr))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -2358,7 +2358,7 @@ bool cChunk::DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCom
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The correct block entity is here,
|
// The correct block entity is here,
|
||||||
if (a_Callback.Item((cCommandBlockEntity *)*itr))
|
if (a_Callback.Item((cCommandBlockEntity *)*itr))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -2390,7 +2390,7 @@ bool cChunk::DoWithMobHeadAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadC
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The correct block entity is here,
|
// The correct block entity is here,
|
||||||
if (a_Callback.Item((cMobHeadEntity *)*itr))
|
if (a_Callback.Item((cMobHeadEntity *)*itr))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -2422,7 +2422,7 @@ bool cChunk::DoWithFlowerPotAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFlower
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The correct block entity is here,
|
// The correct block entity is here
|
||||||
if (a_Callback.Item((cFlowerPotEntity *)*itr))
|
if (a_Callback.Item((cFlowerPotEntity *)*itr))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -2475,7 +2475,7 @@ bool cChunk::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_
|
|||||||
BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
|
BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
(a_RelX < 0) || (a_RelX >= Width) ||
|
(a_RelX < 0) || (a_RelX >= Width) ||
|
||||||
(a_RelY < 0) || (a_RelY >= Height) ||
|
(a_RelY < 0) || (a_RelY >= Height) ||
|
||||||
(a_RelZ < 0) || (a_RelZ >= Width)
|
(a_RelZ < 0) || (a_RelZ >= Width)
|
||||||
)
|
)
|
||||||
|
@ -87,7 +87,7 @@ public:
|
|||||||
3. Mark the chunk as saved (MarkSaved() )
|
3. Mark the chunk as saved (MarkSaved() )
|
||||||
If anywhere inside this sequence another thread mmodifies the chunk, the chunk will not get marked as saved in MarkSaved()
|
If anywhere inside this sequence another thread mmodifies the chunk, the chunk will not get marked as saved in MarkSaved()
|
||||||
*/
|
*/
|
||||||
void MarkSaving(void); // Marks the chunk as being saved.
|
void MarkSaving(void); // Marks the chunk as being saved.
|
||||||
void MarkSaved(void); // Marks the chunk as saved, if it didn't change from the last call to MarkSaving()
|
void MarkSaved(void); // Marks the chunk as saved, if it didn't change from the last call to MarkSaving()
|
||||||
void MarkLoaded(void); // Marks the chunk as freshly loaded. Fails if the chunk is already valid
|
void MarkLoaded(void); // Marks the chunk as freshly loaded. Fails if the chunk is already valid
|
||||||
void MarkLoadFailed(void); // Marks the chunk as failed to load. Ignored is the chunk is already valid
|
void MarkLoadFailed(void); // Marks the chunk as failed to load. Ignored is the chunk is already valid
|
||||||
@ -97,7 +97,7 @@ public:
|
|||||||
|
|
||||||
/** Sets all chunk data */
|
/** Sets all chunk data */
|
||||||
void SetAllData(
|
void SetAllData(
|
||||||
const BLOCKTYPE * a_BlockTypes,
|
const BLOCKTYPE * a_BlockTypes,
|
||||||
const NIBBLETYPE * a_BlockMeta,
|
const NIBBLETYPE * a_BlockMeta,
|
||||||
const NIBBLETYPE * a_BlockLight,
|
const NIBBLETYPE * a_BlockLight,
|
||||||
const NIBBLETYPE * a_BlockSkyLight,
|
const NIBBLETYPE * a_BlockSkyLight,
|
||||||
|
@ -25,8 +25,8 @@ public:
|
|||||||
|
|
||||||
virtual ~cChunkDataCallback() {}
|
virtual ~cChunkDataCallback() {}
|
||||||
|
|
||||||
/** Called before any other callbacks to inform of the current coords
|
/** Called before any other callbacks to inform of the current coords
|
||||||
(only in processes where multiple chunks can be processed, such as cWorld::ForEachChunkInRect()).
|
(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; };
|
virtual bool Coords(int a_ChunkX, int a_ChunkZ) { UNUSED(a_ChunkX); UNUSED(a_ChunkZ); return true; };
|
||||||
|
@ -22,8 +22,8 @@ It will help us when the new chunk format comes out and we need to patch everyth
|
|||||||
#define ZERO_CHUNK_Y 0
|
#define ZERO_CHUNK_Y 0
|
||||||
|
|
||||||
// Used to smoothly convert to new axis ordering. One will be removed when deemed stable.
|
// Used to smoothly convert to new axis ordering. One will be removed when deemed stable.
|
||||||
#define AXIS_ORDER_YZX 1 // Original (1.1-)
|
#define AXIS_ORDER_YZX 1 // Original (1.1-)
|
||||||
#define AXIS_ORDER_XZY 2 // New (1.2+)
|
#define AXIS_ORDER_XZY 2 // New (1.2+)
|
||||||
#define AXIS_ORDER AXIS_ORDER_XZY
|
#define AXIS_ORDER AXIS_ORDER_XZY
|
||||||
|
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public:
|
|||||||
/// 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];
|
typedef HEIGHTTYPE HeightMap[Width * Width];
|
||||||
|
|
||||||
/** The type used for any biomemap operations and storage inside MCServer,
|
/** The type used for any biomemap operations and storage inside MCServer,
|
||||||
using MCServer biomes (need not correspond to client representation!)
|
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 // Need to verify this with the protocol spec, currently unknown!
|
||||||
*/
|
*/
|
||||||
@ -148,17 +148,17 @@ public:
|
|||||||
inline static Vector3i IndexToCoordinate( unsigned int index )
|
inline static Vector3i IndexToCoordinate( unsigned int index )
|
||||||
{
|
{
|
||||||
#if AXIS_ORDER == AXIS_ORDER_XZY
|
#if AXIS_ORDER == AXIS_ORDER_XZY
|
||||||
return Vector3i( // 1.2
|
return Vector3i( // 1.2
|
||||||
index % cChunkDef::Width, // X
|
index % cChunkDef::Width, // X
|
||||||
index / (cChunkDef::Width * cChunkDef::Width), // Y
|
index / (cChunkDef::Width * cChunkDef::Width), // Y
|
||||||
(index / cChunkDef::Width) % cChunkDef::Width // Z
|
(index / cChunkDef::Width) % cChunkDef::Width // Z
|
||||||
);
|
);
|
||||||
#elif AXIS_ORDER == AXIS_ORDER_YZX
|
#elif AXIS_ORDER == AXIS_ORDER_YZX
|
||||||
return Vector3i( // 1.1
|
return Vector3i( // 1.1
|
||||||
index / (cChunkDef::Height * cChunkDef::Width), // X
|
index / (cChunkDef::Height * cChunkDef::Width), // X
|
||||||
index % cChunkDef::Height, // Y
|
index % cChunkDef::Height, // Y
|
||||||
(index / cChunkDef::Height) % cChunkDef::Width // Z
|
(index / cChunkDef::Height) % cChunkDef::Width // Z
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2711,7 +2711,7 @@ void cChunkMap::SetChunkAlwaysTicked(int a_ChunkX, int a_ChunkZ, bool a_AlwaysTi
|
|||||||
// cChunkMap::cChunkLayer:
|
// cChunkMap::cChunkLayer:
|
||||||
|
|
||||||
cChunkMap::cChunkLayer::cChunkLayer(
|
cChunkMap::cChunkLayer::cChunkLayer(
|
||||||
int a_LayerX, int a_LayerZ,
|
int a_LayerX, int a_LayerZ,
|
||||||
cChunkMap * a_Parent,
|
cChunkMap * a_Parent,
|
||||||
cAllocationPool<cChunkData::sChunkSection> & a_Pool
|
cAllocationPool<cChunkData::sChunkSection> & a_Pool
|
||||||
)
|
)
|
||||||
@ -2923,7 +2923,7 @@ int cChunkMap::cChunkLayer::GetNumChunksLoaded(void) const
|
|||||||
NumChunks++;
|
NumChunks++;
|
||||||
}
|
}
|
||||||
} // for i - m_Chunks[]
|
} // for i - m_Chunks[]
|
||||||
return NumChunks;
|
return NumChunks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2994,7 +2994,7 @@ void cChunkMap::cChunkLayer::UnloadUnusedChunks(void)
|
|||||||
void cChunkMap::FastSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
void cChunkMap::FastSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSFastSetBlock);
|
cCSLock Lock(m_CSFastSetBlock);
|
||||||
m_FastSetBlockQueue.push_back(sSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta));
|
m_FastSetBlockQueue.push_back(sSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
If a_MarkDirty is set, the chunk is set as dirty (used after generating)
|
If a_MarkDirty is set, the chunk is set as dirty (used after generating)
|
||||||
*/
|
*/
|
||||||
void SetChunkData(
|
void SetChunkData(
|
||||||
int a_ChunkX, int a_ChunkZ,
|
int a_ChunkX, int a_ChunkZ,
|
||||||
const BLOCKTYPE * a_BlockTypes,
|
const BLOCKTYPE * a_BlockTypes,
|
||||||
const NIBBLETYPE * a_BlockMeta,
|
const NIBBLETYPE * a_BlockMeta,
|
||||||
const NIBBLETYPE * a_BlockLight,
|
const NIBBLETYPE * a_BlockLight,
|
||||||
@ -361,7 +361,7 @@ private:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cChunkLayer(
|
cChunkLayer(
|
||||||
int a_LayerX, int a_LayerZ,
|
int a_LayerX, int a_LayerZ,
|
||||||
cChunkMap * a_Parent,
|
cChunkMap * a_Parent,
|
||||||
cAllocationPool<cChunkData::sChunkSection> & a_Pool
|
cAllocationPool<cChunkData::sChunkSection> & a_Pool
|
||||||
);
|
);
|
||||||
@ -384,7 +384,7 @@ private:
|
|||||||
void UnloadUnusedChunks(void);
|
void UnloadUnusedChunks(void);
|
||||||
|
|
||||||
/** Collect a mob census, of all mobs, their megatype, their chunk and their distance o closest player */
|
/** Collect a mob census, of all mobs, their megatype, their chunk and their distance o closest player */
|
||||||
void CollectMobCensus(cMobCensus& a_ToFill);
|
void CollectMobCensus(cMobCensus& a_ToFill);
|
||||||
/** Try to Spawn Monsters inside all Chunks */
|
/** Try to Spawn Monsters inside all Chunks */
|
||||||
void SpawnMobs(cMobSpawner& a_MobSpawner);
|
void SpawnMobs(cMobSpawner& a_MobSpawner);
|
||||||
|
|
||||||
|
@ -6,17 +6,17 @@
|
|||||||
/*
|
/*
|
||||||
The whole thing is a thread that runs in a loop, waiting for either:
|
The whole thing is a thread that runs in a loop, waiting for either:
|
||||||
"finished chunks" (ChunkReady()), or
|
"finished chunks" (ChunkReady()), or
|
||||||
"chunks to send" (QueueSendChunkTo() )
|
"chunks to send" (QueueSendChunkTo() )
|
||||||
to come to a queue.
|
to come to a queue.
|
||||||
And once they do, it requests the chunk data and sends it all away, either
|
And once they do, it requests the chunk data and sends it all away, either
|
||||||
broadcasting (ChunkReady), or
|
broadcasting (ChunkReady), or
|
||||||
sends to a specific client (QueueSendChunkTo)
|
sends to a specific client (QueueSendChunkTo)
|
||||||
Chunk data is queried using the cChunkDataCallback interface.
|
Chunk data is queried using the cChunkDataCallback interface.
|
||||||
It is cached inside the ChunkSender object during the query and then processed after the query ends.
|
It is cached inside the ChunkSender object during the query and then processed after the query ends.
|
||||||
Note that the data needs to be compressed only *after* the query finishes,
|
Note that the data needs to be compressed only *after* the query finishes,
|
||||||
because the query callbacks run with ChunkMap's CS locked.
|
because the query callbacks run with ChunkMap's CS locked.
|
||||||
|
|
||||||
A client may remove itself from all direct requests(QueueSendChunkTo()) by calling RemoveClient();
|
A client may remove itself from all direct requests(QueueSendChunkTo()) by calling RemoveClient();
|
||||||
this ensures that the client's Send() won't be called anymore by ChunkSender.
|
this ensures that the client's Send() won't be called anymore by ChunkSender.
|
||||||
Note that it may be called by world's BroadcastToChunk() if the client is still in the chunk.
|
Note that it may be called by world's BroadcastToChunk() if the client is still in the chunk.
|
||||||
*/
|
*/
|
||||||
@ -110,7 +110,7 @@ protected:
|
|||||||
bool operator ==(const sSendChunk & a_Other)
|
bool operator ==(const sSendChunk & a_Other)
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
(a_Other.m_ChunkX == m_ChunkX) &&
|
(a_Other.m_ChunkX == m_ChunkX) &&
|
||||||
(a_Other.m_ChunkY == m_ChunkY) &&
|
(a_Other.m_ChunkY == m_ChunkY) &&
|
||||||
(a_Other.m_ChunkZ == m_ChunkZ) &&
|
(a_Other.m_ChunkZ == m_ChunkZ) &&
|
||||||
(a_Other.m_Client == m_Client)
|
(a_Other.m_Client == m_Client)
|
||||||
|
@ -85,7 +85,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
|
|||||||
{
|
{
|
||||||
m_Protocol = new cProtocolRecognizer(this);
|
m_Protocol = new cProtocolRecognizer(this);
|
||||||
|
|
||||||
s_ClientCount++; // Not protected by CS because clients are always constructed from the same thread
|
s_ClientCount++; // Not protected by CS because clients are always constructed from the same thread
|
||||||
m_UniqueID = s_ClientCount;
|
m_UniqueID = s_ClientCount;
|
||||||
|
|
||||||
cTimer t1;
|
cTimer t1;
|
||||||
@ -531,7 +531,7 @@ void cClientHandle::HandlePing(void)
|
|||||||
AString Reply;
|
AString Reply;
|
||||||
const cServer & Server = *cRoot::Get()->GetServer();
|
const cServer & Server = *cRoot::Get()->GetServer();
|
||||||
|
|
||||||
Printf(Reply, "%s%s%i%s%i",
|
Printf(Reply, "%s%s%i%s%i",
|
||||||
Server.GetDescription().c_str(),
|
Server.GetDescription().c_str(),
|
||||||
cChatColor::Delimiter.c_str(),
|
cChatColor::Delimiter.c_str(),
|
||||||
Server.GetNumPlayers(),
|
Server.GetNumPlayers(),
|
||||||
@ -1169,7 +1169,7 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
|
|||||||
if ((Equipped.m_ItemType != a_HeldItem.m_ItemType) && (a_HeldItem.m_ItemType != -1))
|
if ((Equipped.m_ItemType != a_HeldItem.m_ItemType) && (a_HeldItem.m_ItemType != -1))
|
||||||
{
|
{
|
||||||
// Only compare ItemType, not meta (torches have different metas)
|
// Only compare ItemType, not meta (torches have different metas)
|
||||||
// The -1 check is there because sometimes the client sends -1 instead of the held item
|
// The -1 check is there because sometimes the client sends -1 instead of the held item
|
||||||
// ( http://forum.mc-server.org/showthread.php?tid=549&pid=4502#pid4502 )
|
// ( http://forum.mc-server.org/showthread.php?tid=549&pid=4502#pid4502 )
|
||||||
LOGWARN("Player %s tried to place a block that was not equipped (exp %d, got %d)",
|
LOGWARN("Player %s tried to place a block that was not equipped (exp %d, got %d)",
|
||||||
m_Username.c_str(), Equipped.m_ItemType, a_HeldItem.m_ItemType
|
m_Username.c_str(), Equipped.m_ItemType, a_HeldItem.m_ItemType
|
||||||
@ -1390,7 +1390,7 @@ void cClientHandle::HandleChat(const AString & a_Message)
|
|||||||
Color = AString("@") + Color[2];
|
Color = AString("@") + Color[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Color.clear();
|
Color.clear();
|
||||||
}
|
}
|
||||||
Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color);
|
Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color);
|
||||||
@ -1449,7 +1449,7 @@ void cClientHandle::HandleAnimation(char a_Animation)
|
|||||||
a_Animation--; // Offset by -1
|
a_Animation--; // Offset by -1
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
@ -1517,8 +1517,8 @@ void cClientHandle::HandleWindowClick(char a_WindowID, short a_SlotNum, eClickAc
|
|||||||
|
|
||||||
|
|
||||||
void cClientHandle::HandleUpdateSign(
|
void cClientHandle::HandleUpdateSign(
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ,
|
int a_BlockX, int a_BlockY, int a_BlockZ,
|
||||||
const AString & a_Line1, const AString & a_Line2,
|
const AString & a_Line1, const AString & a_Line2,
|
||||||
const AString & a_Line3, const AString & a_Line4
|
const AString & a_Line3, const AString & a_Line4
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -1821,7 +1821,7 @@ bool cClientHandle::CheckBlockInteractionsRate(void)
|
|||||||
|
|
||||||
|
|
||||||
void cClientHandle::Tick(float a_Dt)
|
void cClientHandle::Tick(float a_Dt)
|
||||||
{
|
{
|
||||||
// Process received network data:
|
// Process received network data:
|
||||||
AString IncomingData;
|
AString IncomingData;
|
||||||
{
|
{
|
||||||
@ -1887,7 +1887,7 @@ void cClientHandle::Tick(float a_Dt)
|
|||||||
|
|
||||||
|
|
||||||
void cClientHandle::ServerTick(float a_Dt)
|
void cClientHandle::ServerTick(float a_Dt)
|
||||||
{
|
{
|
||||||
// Process received network data:
|
// Process received network data:
|
||||||
AString IncomingData;
|
AString IncomingData;
|
||||||
{
|
{
|
||||||
@ -2345,7 +2345,7 @@ void cClientHandle::SendPlayerSpawn(const cPlayer & a_Player)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGD("Spawning player \"%s\" on client \"%s\" @ %s",
|
LOGD("Spawning player \"%s\" on client \"%s\" @ %s",
|
||||||
a_Player.GetName().c_str(), GetPlayer()->GetName().c_str(), GetIPString().c_str()
|
a_Player.GetName().c_str(), GetPlayer()->GetName().c_str(), GetIPString().c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class cStatManager;
|
|||||||
|
|
||||||
class cClientHandle : // tolua_export
|
class cClientHandle : // tolua_export
|
||||||
public cSocketThreads::cCallback
|
public cSocketThreads::cCallback
|
||||||
{ // tolua_export
|
{ // tolua_export
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#if defined(ANDROID_NDK)
|
#if defined(ANDROID_NDK)
|
||||||
@ -64,9 +64,9 @@ public:
|
|||||||
|
|
||||||
const AString & GetIPString(void) const { return m_IPString; }
|
const AString & GetIPString(void) const { return m_IPString; }
|
||||||
|
|
||||||
cPlayer * GetPlayer(void) { return m_Player; } // tolua_export
|
cPlayer * GetPlayer(void) { return m_Player; } // tolua_export
|
||||||
|
|
||||||
const AString & GetUUID(void) const { return m_UUID; } // tolua_export
|
const AString & GetUUID(void) const { return m_UUID; } // tolua_export
|
||||||
void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; }
|
void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; }
|
||||||
|
|
||||||
const Json::Value & GetProperties(void) const { return m_Properties; }
|
const Json::Value & GetProperties(void) const { return m_Properties; }
|
||||||
@ -246,8 +246,8 @@ public:
|
|||||||
void HandleSteerVehicle (float Forward, float Sideways);
|
void HandleSteerVehicle (float Forward, float Sideways);
|
||||||
void HandleTabCompletion (const AString & a_Text);
|
void HandleTabCompletion (const AString & a_Text);
|
||||||
void HandleUpdateSign (
|
void HandleUpdateSign (
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ,
|
int a_BlockX, int a_BlockY, int a_BlockZ,
|
||||||
const AString & a_Line1, const AString & a_Line2,
|
const AString & a_Line1, const AString & a_Line2,
|
||||||
const AString & a_Line3, const AString & a_Line4
|
const AString & a_Line3, const AString & a_Line4
|
||||||
);
|
);
|
||||||
void HandleUnmount (void);
|
void HandleUnmount (void);
|
||||||
@ -338,7 +338,7 @@ private:
|
|||||||
csAuthenticating, ///< The client has logged in, waiting for external authentication
|
csAuthenticating, ///< The client has logged in, waiting for external authentication
|
||||||
csAuthenticated, ///< The client has been authenticated, will start streaming chunks in the next tick
|
csAuthenticated, ///< The client has been authenticated, will start streaming chunks in the next tick
|
||||||
csDownloadingWorld, ///< The client is waiting for chunks, we're waiting for the loader to provide and send them
|
csDownloadingWorld, ///< The client is waiting for chunks, we're waiting for the loader to provide and send them
|
||||||
csConfirmingPos, ///< The client has been sent the position packet, waiting for them to repeat the position back
|
csConfirmingPos, ///< The client has been sent the position packet, waiting for them to repeat the position back
|
||||||
csPlaying, ///< Normal gameplay
|
csPlaying, ///< Normal gameplay
|
||||||
csDestroying, ///< The client is being destroyed, don't queue any more packets / don't add to chunks
|
csDestroying, ///< The client is being destroyed, don't queue any more packets / don't add to chunks
|
||||||
csDestroyed, ///< The client has been destroyed, the destructor is to be called from the owner thread
|
csDestroyed, ///< The client has been destroyed, the destructor is to be called from the owner thread
|
||||||
@ -408,7 +408,7 @@ private:
|
|||||||
virtual bool DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client
|
virtual bool DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client
|
||||||
virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client
|
virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client
|
||||||
virtual void SocketClosed (void) override; // The socket has been closed for any reason
|
virtual void SocketClosed (void) override; // The socket has been closed for any reason
|
||||||
}; // tolua_export
|
}; // tolua_export
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ void cCraftingGrid::ConsumeGrid(const cCraftingGrid & a_Grid)
|
|||||||
{
|
{
|
||||||
if ((a_Grid.m_Width != m_Width) || (a_Grid.m_Height != m_Height))
|
if ((a_Grid.m_Width != m_Width) || (a_Grid.m_Height != m_Height))
|
||||||
{
|
{
|
||||||
LOGWARNING("Consuming a grid of different dimensions: (%d, %d) vs (%d, %d)",
|
LOGWARNING("Consuming a grid of different dimensions: (%d, %d) vs (%d, %d)",
|
||||||
a_Grid.m_Width, a_Grid.m_Height, m_Width, m_Height
|
a_Grid.m_Width, a_Grid.m_Height, m_Width, m_Height
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -196,7 +196,7 @@ void cCraftingGrid::Dump(void)
|
|||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
int idx = x + m_Width * y;
|
int idx = x + m_Width * y;
|
||||||
#endif
|
#endif
|
||||||
LOGD("Slot (%d, %d): Type %d, health %d, count %d",
|
LOGD("Slot (%d, %d): Type %d, health %d, count %d",
|
||||||
x, y, m_Items[idx].m_ItemType, m_Items[idx].m_ItemDamage, m_Items[idx].m_ItemCount
|
x, y, m_Items[idx].m_ItemType, m_Items[idx].m_ItemDamage, m_Items[idx].m_ItemCount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -250,7 +250,7 @@ void cCraftingRecipe::Dump(void)
|
|||||||
{
|
{
|
||||||
LOGD("Recipe ingredients:");
|
LOGD("Recipe ingredients:");
|
||||||
m_Ingredients.Dump();
|
m_Ingredients.Dump();
|
||||||
LOGD("Result: Type %d, health %d, count %d",
|
LOGD("Result: Type %d, health %d, count %d",
|
||||||
m_Result.m_ItemType, m_Result.m_ItemDamage, m_Result.m_ItemCount
|
m_Result.m_ItemType, m_Result.m_ItemDamage, m_Result.m_ItemCount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -665,7 +665,7 @@ cCraftingRecipes::cRecipe * cCraftingRecipes::MatchRecipe(const cItem * a_Crafti
|
|||||||
|
|
||||||
const cItem & Item = itrS->m_Item;
|
const cItem & Item = itrS->m_Item;
|
||||||
if (
|
if (
|
||||||
(itrS->x >= a_GridWidth) ||
|
(itrS->x >= a_GridWidth) ||
|
||||||
(itrS->y >= a_GridHeight) ||
|
(itrS->y >= a_GridHeight) ||
|
||||||
(Item.m_ItemType != a_CraftingGrid[GridID].m_ItemType) || // same item type?
|
(Item.m_ItemType != a_CraftingGrid[GridID].m_ItemType) || // same item type?
|
||||||
(Item.m_ItemCount > a_CraftingGrid[GridID].m_ItemCount) || // not enough items
|
(Item.m_ItemCount > a_CraftingGrid[GridID].m_ItemCount) || // not enough items
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
Assumes both cuboids are sorted. */
|
Assumes both cuboids are sorted. */
|
||||||
bool DoesIntersect(const cCuboid & a_Other) const;
|
bool DoesIntersect(const cCuboid & a_Other) const;
|
||||||
|
|
||||||
bool IsInside(const Vector3i & v) const
|
bool IsInside(const Vector3i & v) const
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
(v.x >= p1.x) && (v.x <= p2.x) &&
|
(v.x >= p1.x) && (v.x <= p2.x) &&
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsInside(int a_X, int a_Y, int a_Z) const
|
bool IsInside(int a_X, int a_Y, int a_Z) const
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
(a_X >= p1.x) && (a_X <= p2.x) &&
|
(a_X >= p1.x) && (a_X <= p2.x) &&
|
||||||
|
@ -512,7 +512,7 @@ inline void VectorToEuler(double a_X, double a_Y, double a_Z, double & a_Pan, do
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a_Pan = atan2(a_Z, a_X) * 180 / PI - 90;
|
a_Pan = atan2(a_Z, a_X) * 180 / PI - 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
a_Pitch = atan2(a_Y, r) * 180 / PI;
|
a_Pitch = atan2(a_Y, r) * 180 / PI;
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
// Disable some warnings that we don't care about:
|
// Disable some warnings that we don't care about:
|
||||||
#pragma warning(disable:4100) // Unreferenced formal parameter
|
#pragma warning(disable:4100) // Unreferenced formal parameter
|
||||||
|
|
||||||
// Useful warnings from warning level 4:
|
// Useful warnings from warning level 4:
|
||||||
#pragma warning(3 : 4127) // Conditional expression is constant
|
#pragma warning(3 : 4127) // Conditional expression is constant
|
||||||
#pragma warning(3 : 4189) // Local variable is initialized but not referenced
|
#pragma warning(3 : 4189) // Local variable is initialized but not referenced
|
||||||
#pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed/unsigned mismatch
|
#pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed/unsigned mismatch
|
||||||
@ -58,8 +58,8 @@
|
|||||||
|
|
||||||
// override is part of c++11
|
// override is part of c++11
|
||||||
#if __cplusplus < 201103L
|
#if __cplusplus < 201103L
|
||||||
#define override
|
#define override
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OBSOLETE __attribute__((deprecated))
|
#define OBSOLETE __attribute__((deprecated))
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ class SizeChecker;
|
|||||||
template <typename T, size_t Size>
|
template <typename T, size_t Size>
|
||||||
class SizeChecker<T, Size, true>
|
class SizeChecker<T, Size, true>
|
||||||
{
|
{
|
||||||
T v;
|
T v;
|
||||||
};
|
};
|
||||||
|
|
||||||
template class SizeChecker<Int64, 8>;
|
template class SizeChecker<Int64, 8>;
|
||||||
|
26
src/Group.h
26
src/Group.h
@ -5,18 +5,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cGroup // tolua_export
|
// tolua_begin
|
||||||
{ // tolua_export
|
class cGroup
|
||||||
public: // tolua_export
|
{
|
||||||
|
public:
|
||||||
|
// tolua_end
|
||||||
cGroup() {}
|
cGroup() {}
|
||||||
~cGroup() {}
|
~cGroup() {}
|
||||||
|
|
||||||
void SetName( const AString & a_Name ) { m_Name = a_Name; } // tolua_export
|
// tolua_begin
|
||||||
const AString & GetName() const { return m_Name; } // tolua_export
|
void SetName( const AString & a_Name ) { m_Name = a_Name; }
|
||||||
void SetColor( const AString & a_Color ) { m_Color = a_Color; } // tolua_export
|
const AString & GetName() const { return m_Name; }
|
||||||
void AddCommand( const AString & a_Command ); // tolua_export
|
void SetColor( const AString & a_Color ) { m_Color = a_Color; }
|
||||||
void AddPermission( const AString & a_Permission ); // tolua_export
|
void AddCommand( const AString & a_Command );
|
||||||
void InheritFrom( cGroup* a_Group ); // tolua_export
|
void AddPermission( const AString & a_Permission );
|
||||||
|
void InheritFrom( cGroup* a_Group );
|
||||||
|
// tolua_end
|
||||||
|
|
||||||
typedef std::map< AString, bool > PermissionMap;
|
typedef std::map< AString, bool > PermissionMap;
|
||||||
const PermissionMap & GetPermissions() const { return m_Permissions; }
|
const PermissionMap & GetPermissions() const { return m_Permissions; }
|
||||||
@ -26,7 +30,7 @@ public: // tolua_export
|
|||||||
typedef std::map< AString, bool > CommandMap;
|
typedef std::map< AString, bool > CommandMap;
|
||||||
const CommandMap & GetCommands() const { return m_Commands; }
|
const CommandMap & GetCommands() const { return m_Commands; }
|
||||||
|
|
||||||
const AString & GetColor() const { return m_Color; } // tolua_export
|
const AString & GetColor() const { return m_Color; } // tolua_export
|
||||||
|
|
||||||
typedef std::list< cGroup* > GroupList;
|
typedef std::list< cGroup* > GroupList;
|
||||||
const GroupList & GetInherits() const { return m_Inherits; }
|
const GroupList & GetInherits() const { return m_Inherits; }
|
||||||
@ -37,4 +41,4 @@ private:
|
|||||||
PermissionMap m_Permissions;
|
PermissionMap m_Permissions;
|
||||||
CommandMap m_Commands;
|
CommandMap m_Commands;
|
||||||
GroupList m_Inherits;
|
GroupList m_Inherits;
|
||||||
};// tolua_export
|
}; // tolua_export
|
||||||
|
@ -183,7 +183,7 @@ protected:
|
|||||||
|
|
||||||
// cItemGrid::cListener override:
|
// cItemGrid::cListener override:
|
||||||
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override;
|
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override;
|
||||||
}; // tolua_export
|
}; // tolua_export
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
14
src/Item.cpp
14
src/Item.cpp
@ -193,17 +193,29 @@ void cItem::FromJson(const Json::Value & a_Value)
|
|||||||
bool cItem::IsEnchantable(short item)
|
bool cItem::IsEnchantable(short item)
|
||||||
{
|
{
|
||||||
if ((item >= 256) && (item <= 259))
|
if ((item >= 256) && (item <= 259))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if ((item >= 267) && (item <= 279))
|
if ((item >= 267) && (item <= 279))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
if ((item >= 283) && (item <= 286))
|
}
|
||||||
|
if ((item >= 283) && (item <= 286))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if ((item >= 290) && (item <= 294))
|
if ((item >= 290) && (item <= 294))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if ((item >= 298) && (item <= 317))
|
if ((item >= 298) && (item <= 317))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if ((item == 346) || (item == 359) || (item == 261))
|
if ((item == 346) || (item == 359) || (item == 261))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
bool IsCustomNameEmpty(void) const { return (m_CustomName.empty()); }
|
bool IsCustomNameEmpty(void) const { return (m_CustomName.empty()); }
|
||||||
bool IsLoreEmpty(void) const { return (m_Lore.empty()); }
|
bool IsLoreEmpty(void) const { return (m_Lore.empty()); }
|
||||||
|
|
||||||
/** Returns a copy of this item with m_ItemCount set to 1. Useful to preserve enchantments etc. on stacked items */
|
/** Returns a copy of this item with m_ItemCount set to 1. Useful to preserve enchantments etc. on stacked items */
|
||||||
cItem CopyOne(void) const;
|
cItem CopyOne(void) const;
|
||||||
@ -184,14 +184,14 @@ public:
|
|||||||
void FromJson(const Json::Value & a_Value);
|
void FromJson(const Json::Value & a_Value);
|
||||||
|
|
||||||
/** Returns true if the specified item type is enchantable (as per 1.2.5 protocol requirements) */
|
/** Returns true if the specified item type is enchantable (as per 1.2.5 protocol requirements) */
|
||||||
static bool IsEnchantable(short a_ItemType); // tolua_export
|
static bool IsEnchantable(short a_ItemType); // tolua_export
|
||||||
|
|
||||||
/** Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0 */
|
/** Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0 */
|
||||||
int GetEnchantability(); // tolua_export
|
int GetEnchantability(); // tolua_export
|
||||||
|
|
||||||
/** Enchants the item using the specified number of XP levels.
|
/** Enchants the item using the specified number of XP levels.
|
||||||
Returns true if item enchanted, false if not. */
|
Returns true if item enchanted, false if not. */
|
||||||
bool EnchantByXPLevels(int a_NumXPLevels); // tolua_export
|
bool EnchantByXPLevels(int a_NumXPLevels); // tolua_export
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ void cLightingThread::CalcLight(NIBBLETYPE * a_Light)
|
|||||||
|
|
||||||
|
|
||||||
void cLightingThread::CalcLightStep(
|
void cLightingThread::CalcLightStep(
|
||||||
NIBBLETYPE * a_Light,
|
NIBBLETYPE * a_Light,
|
||||||
int a_NumSeedsIn, unsigned char * a_IsSeedIn, unsigned int * a_SeedIdxIn,
|
int a_NumSeedsIn, unsigned char * a_IsSeedIn, unsigned int * a_SeedIdxIn,
|
||||||
int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut
|
int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut
|
||||||
)
|
)
|
||||||
|
@ -16,7 +16,7 @@ Lighting is calculated in a flood-fill fashion:
|
|||||||
The seeds need two fast operations:
|
The seeds need two fast operations:
|
||||||
- Check if a block at [x, y, z] is already a seed
|
- Check if a block at [x, y, z] is already a seed
|
||||||
- Get the next seed in the row
|
- Get the next seed in the row
|
||||||
For that reason it is stored in two arrays, one stores a bool saying a seed is in that position,
|
For that reason it is stored in two arrays, one stores a bool saying a seed is in that position,
|
||||||
the other is an array of seed coords, encoded as a single int.
|
the other is an array of seed coords, encoded as a single int.
|
||||||
Step 2 needs two separate storages for old seeds and new seeds, so there are two actual storages for that purpose,
|
Step 2 needs two separate storages for old seeds and new seeds, so there are two actual storages for that purpose,
|
||||||
their content is swapped after each full step-2-cycle.
|
their content is swapped after each full step-2-cycle.
|
||||||
@ -82,7 +82,7 @@ protected:
|
|||||||
cLightingChunkStay(cLightingThread & a_LightingThread, int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallbackAfter);
|
cLightingChunkStay(cLightingThread & a_LightingThread, int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_CallbackAfter);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkZ) override
|
virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkZ) override
|
||||||
{
|
{
|
||||||
UNUSED(a_ChunkX);
|
UNUSED(a_ChunkX);
|
||||||
UNUSED(a_ChunkZ);
|
UNUSED(a_ChunkZ);
|
||||||
@ -157,7 +157,7 @@ protected:
|
|||||||
|
|
||||||
/** Does one step in the light calculation - one seed propagation and seed recalculation */
|
/** Does one step in the light calculation - one seed propagation and seed recalculation */
|
||||||
void CalcLightStep(
|
void CalcLightStep(
|
||||||
NIBBLETYPE * a_Light,
|
NIBBLETYPE * a_Light,
|
||||||
int a_NumSeedsIn, unsigned char * a_IsSeedIn, unsigned int * a_SeedIdxIn,
|
int a_NumSeedsIn, unsigned char * a_IsSeedIn, unsigned int * a_SeedIdxIn,
|
||||||
int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut
|
int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut
|
||||||
);
|
);
|
||||||
@ -166,7 +166,7 @@ protected:
|
|||||||
void CompressLight(NIBBLETYPE * a_LightArray, NIBBLETYPE * a_ChunkLight);
|
void CompressLight(NIBBLETYPE * a_LightArray, NIBBLETYPE * a_ChunkLight);
|
||||||
|
|
||||||
inline void PropagateLight(
|
inline void PropagateLight(
|
||||||
NIBBLETYPE * a_Light,
|
NIBBLETYPE * a_Light,
|
||||||
unsigned int a_SrcIdx, unsigned int a_DstIdx,
|
unsigned int a_SrcIdx, unsigned int a_DstIdx,
|
||||||
int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut
|
int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut
|
||||||
)
|
)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class cLog
|
class cLog
|
||||||
{ // tolua_export
|
{
|
||||||
private:
|
private:
|
||||||
FILE * m_File;
|
FILE * m_File;
|
||||||
static cLog * s_Log;
|
static cLog * s_Log;
|
||||||
@ -23,7 +23,7 @@ public:
|
|||||||
void ClearLog();
|
void ClearLog();
|
||||||
static cLog* GetInstance();
|
static cLog* GetInstance();
|
||||||
};
|
};
|
||||||
// tolua_end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ class cLog;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// tolua_begin
|
|
||||||
class cMCLogger
|
class cMCLogger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -27,9 +26,9 @@ public:
|
|||||||
cMCLogger(void);
|
cMCLogger(void);
|
||||||
|
|
||||||
/** Creates a logger with the specified filename inside "logs" folder */
|
/** Creates a logger with the specified filename inside "logs" folder */
|
||||||
cMCLogger(const AString & a_FileName); // tolua_export
|
cMCLogger(const AString & a_FileName);
|
||||||
|
|
||||||
~cMCLogger(); // tolua_export
|
~cMCLogger();
|
||||||
|
|
||||||
void Log (const char * a_Format, va_list a_ArgList) FORMATSTRING(2, 0);
|
void Log (const char * a_Format, va_list a_ArgList) FORMATSTRING(2, 0);
|
||||||
void Info (const char * a_Format, va_list a_ArgList) FORMATSTRING(2, 0);
|
void Info (const char * a_Format, va_list a_ArgList) FORMATSTRING(2, 0);
|
||||||
@ -37,7 +36,7 @@ public:
|
|||||||
void Error(const char * a_Format, va_list a_ArgList) FORMATSTRING(2, 0);
|
void Error(const char * a_Format, va_list a_ArgList) FORMATSTRING(2, 0);
|
||||||
|
|
||||||
/** Logs the simple text message at the specified log level. */
|
/** Logs the simple text message at the specified log level. */
|
||||||
void LogSimple(const char * a_Text, eLogLevel a_LogLevel = llRegular); // tolua_export
|
void LogSimple(const char * a_Text, eLogLevel a_LogLevel = llRegular);
|
||||||
|
|
||||||
static cMCLogger * GetInstance();
|
static cMCLogger * GetInstance();
|
||||||
private:
|
private:
|
||||||
@ -63,7 +62,7 @@ private:
|
|||||||
|
|
||||||
/// Common initialization for all constructors, creates a logfile with the specified name and assigns s_MCLogger to this
|
/// Common initialization for all constructors, creates a logfile with the specified name and assigns s_MCLogger to this
|
||||||
void InitLog(const AString & a_FileName);
|
void InitLog(const AString & a_FileName);
|
||||||
}; // tolua_export
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
20
src/Map.h
20
src/Map.h
@ -29,13 +29,12 @@ class cMap;
|
|||||||
|
|
||||||
|
|
||||||
/** Encapsulates a map decorator.
|
/** Encapsulates a map decorator.
|
||||||
*
|
A map decorator represents an object drawn on the map that can move freely.
|
||||||
* A map decorator represents an object drawn on the map that can move freely.
|
(e.g. player trackers and item frame pointers)
|
||||||
* (e.g. player trackers and item frame pointers)
|
|
||||||
*
|
Excluding manually placed decorators,
|
||||||
* Excluding manually placed decorators,
|
decorators are automatically managed (allocated and freed) by their parent cMap instance.
|
||||||
* decorators are automatically managed (allocated and freed) by their parent cMap instance.
|
*/
|
||||||
*/
|
|
||||||
class cMapDecorator
|
class cMapDecorator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -194,10 +193,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Encapsulates the state of a map client.
|
/** Encapsulates the state of a map client.
|
||||||
*
|
In order to enhance performace, maps are streamed column-by-column to each client.
|
||||||
* In order to enhance performace, maps are streamed column-by-column to each client.
|
This structure stores the state of the stream.
|
||||||
* This structure stores the state of the stream.
|
*/
|
||||||
*/
|
|
||||||
struct cMapClient
|
struct cMapClient
|
||||||
{
|
{
|
||||||
cClientHandle * m_Handle;
|
cClientHandle * m_Handle;
|
||||||
|
@ -32,25 +32,22 @@ public:
|
|||||||
cMapManager(cWorld * a_World);
|
cMapManager(cWorld * a_World);
|
||||||
|
|
||||||
/** Returns the map with the specified ID, NULL if out of range.
|
/** Returns the map with the specified ID, NULL if out of range.
|
||||||
*
|
WARNING: The returned map object is not thread safe.
|
||||||
* WARNING: The returned map object is not thread safe.
|
*/
|
||||||
*/
|
|
||||||
cMap * GetMapData(unsigned int a_ID);
|
cMap * GetMapData(unsigned int a_ID);
|
||||||
|
|
||||||
/** Creates a new map. Returns NULL on error */
|
/** Creates a new map. Returns NULL on error */
|
||||||
cMap * CreateMap(int a_CenterX, int a_CenterY, int a_Scale = 3);
|
cMap * CreateMap(int a_CenterX, int a_CenterY, int a_Scale = 3);
|
||||||
|
|
||||||
/** Calls the callback for the map with the specified ID.
|
/** Calls the callback for the map with the specified ID.
|
||||||
*
|
Returns true if the map was found and the callback called, false if map not found.
|
||||||
* Returns true if the map was found and the callback called, false if map not found.
|
Callback return value is ignored.
|
||||||
* Callback return ignored.
|
*/
|
||||||
*/
|
|
||||||
bool DoWithMap(int a_ID, cMapCallback & a_Callback); // Exported in ManualBindings.cpp
|
bool DoWithMap(int a_ID, cMapCallback & a_Callback); // Exported in ManualBindings.cpp
|
||||||
|
|
||||||
/** Calls the callback for each map.
|
/** Calls the callback for each map.
|
||||||
*
|
Returns true if all maps processed, false if the callback aborted by returning true.
|
||||||
* Returns true if all maps processed, false if the callback aborted by returning true.
|
*/
|
||||||
*/
|
|
||||||
bool ForEachMap(cMapCallback & a_Callback);
|
bool ForEachMap(cMapCallback & a_Callback);
|
||||||
|
|
||||||
size_t GetNumMaps(void) const; // tolua_export
|
size_t GetNumMaps(void) const; // tolua_export
|
||||||
|
@ -104,7 +104,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void Translate(const Vector3<T> & a_Pos)
|
inline void Translate(const Vector3<T> & a_Pos)
|
||||||
{
|
{
|
||||||
cell[3] += a_Pos.x;
|
cell[3] += a_Pos.x;
|
||||||
cell[7] += a_Pos.y;
|
cell[7] += a_Pos.y;
|
||||||
cell[11] += a_Pos.z;
|
cell[11] += a_Pos.z;
|
||||||
|
@ -21,7 +21,7 @@ bool cMobCensus::IsCapped(cMonster::eFamily a_MobFamily)
|
|||||||
{
|
{
|
||||||
const int ratio = 319; // this should be 256 as we are only supposed to take account from chunks that are in 17x17 from a player
|
const int ratio = 319; // this should be 256 as we are only supposed to take account from chunks that are in 17x17 from a player
|
||||||
// but for now, we use all chunks loaded by players. that means 19 x 19 chunks. That's why we use 256 * (19*19) / (17*17) = 319
|
// but for now, we use all chunks loaded by players. that means 19 x 19 chunks. That's why we use 256 * (19*19) / (17*17) = 319
|
||||||
// MG TODO : code the correct count
|
// MG TODO : code the correct count
|
||||||
if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily))
|
if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -29,7 +29,7 @@ public :
|
|||||||
// return the number of mobs for this family
|
// return the number of mobs for this family
|
||||||
int GetNumberOfCollectedMobs(cMonster::eFamily a_Family);
|
int GetNumberOfCollectedMobs(cMonster::eFamily a_Family);
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
std::map<cMonster::eFamily, std::set<cMonster *> > m_Mobs;
|
std::map<cMonster::eFamily, std::set<cMonster *> > m_Mobs;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance)
|
void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance)
|
||||||
{
|
{
|
||||||
// LOGD("Collecting monster %s, with distance %f",a_Monster->GetClass(),a_Distance);
|
// LOGD("Collecting monster %s, with distance %f",a_Monster->GetClass(),a_Distance);
|
||||||
tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster);
|
tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster);
|
||||||
if (it == m_MonsterToDistance.end())
|
if (it == m_MonsterToDistance.end())
|
||||||
{
|
{
|
||||||
|
@ -27,11 +27,11 @@ protected :
|
|||||||
cChunk& m_Chunk;
|
cChunk& m_Chunk;
|
||||||
};
|
};
|
||||||
|
|
||||||
public :
|
public :
|
||||||
typedef std::map<cEntity*,sDistanceAndChunk> tMonsterToDistance;
|
typedef std::map<cEntity*,sDistanceAndChunk> tMonsterToDistance;
|
||||||
typedef std::multimap<double,sMonsterAndChunk> tDistanceToMonster;
|
typedef std::multimap<double,sMonsterAndChunk> tDistanceToMonster;
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
// this map is filled during collection phase, it will be later transformed into DistanceToMonster
|
// this map is filled during collection phase, it will be later transformed into DistanceToMonster
|
||||||
tMonsterToDistance m_MonsterToDistance;
|
tMonsterToDistance m_MonsterToDistance;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ protected :
|
|||||||
// this are the collected chunks. Used to determinate the number of elligible chunk for spawning.
|
// this are the collected chunks. Used to determinate the number of elligible chunk for spawning.
|
||||||
std::set<cChunk*> m_EligibleForSpawnChunks;
|
std::set<cChunk*> m_EligibleForSpawnChunks;
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
// transform monsterToDistance map (that was usefull for collecting) into distanceToMonster
|
// transform monsterToDistance map (that was usefull for collecting) into distanceToMonster
|
||||||
// that will be usefull for picking up.
|
// that will be usefull for picking up.
|
||||||
void convertMaps();
|
void convertMaps();
|
||||||
|
@ -91,7 +91,7 @@ cMonster::eType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
|
|||||||
addIfAllowed(cMonster::mtCow, allowedMobs);
|
addIfAllowed(cMonster::mtCow, allowedMobs);
|
||||||
addIfAllowed(cMonster::mtChicken, allowedMobs);
|
addIfAllowed(cMonster::mtChicken, allowedMobs);
|
||||||
addIfAllowed(cMonster::mtEnderman, allowedMobs);
|
addIfAllowed(cMonster::mtEnderman, allowedMobs);
|
||||||
addIfAllowed(cMonster::mtSlime, allowedMobs); // MG TODO : much more complicated rule
|
addIfAllowed(cMonster::mtSlime, allowedMobs); // MG TODO : much more complicated rule
|
||||||
|
|
||||||
if (a_Biome == biForest || a_Biome == biForestHills || a_Biome == biTaiga || a_Biome == biTaigaHills)
|
if (a_Biome == biForest || a_Biome == biForestHills || a_Biome == biTaiga || a_Biome == biTaigaHills)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ public :
|
|||||||
typedef const std::set<cMonster *> tSpawnedContainer;
|
typedef const std::set<cMonster *> tSpawnedContainer;
|
||||||
tSpawnedContainer & getSpawned(void);
|
tSpawnedContainer & getSpawned(void);
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
// return true if specified type of mob can spawn on specified block
|
// return true if specified type of mob can spawn on specified block
|
||||||
bool CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, cMonster::eType a_MobType, EMCSBiome a_Biome);
|
bool CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, cMonster::eType a_MobType, EMCSBiome a_Biome);
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ protected :
|
|||||||
// add toAdd inside toAddIn, if toAdd is in m_AllowedTypes
|
// add toAdd inside toAddIn, if toAdd is in m_AllowedTypes
|
||||||
void addIfAllowed(cMonster::eType toAdd, std::set<cMonster::eType> & toAddIn);
|
void addIfAllowed(cMonster::eType toAdd, std::set<cMonster::eType> & toAddIn);
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
cMonster::eFamily m_MonsterFamily;
|
cMonster::eFamily m_MonsterFamily;
|
||||||
std::set<cMonster::eType> m_AllowedTypes;
|
std::set<cMonster::eType> m_AllowedTypes;
|
||||||
bool m_NewPack;
|
bool m_NewPack;
|
||||||
|
@ -487,8 +487,8 @@ NOISE_DATATYPE cNoise::SmoothNoise1D(int a_X) const
|
|||||||
|
|
||||||
NOISE_DATATYPE cNoise::CubicNoise2D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y) const
|
NOISE_DATATYPE cNoise::CubicNoise2D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y) const
|
||||||
{
|
{
|
||||||
const int BaseX = FAST_FLOOR(a_X);
|
const int BaseX = FAST_FLOOR(a_X);
|
||||||
const int BaseY = FAST_FLOOR(a_Y);
|
const int BaseY = FAST_FLOOR(a_Y);
|
||||||
|
|
||||||
const NOISE_DATATYPE points[4][4] =
|
const NOISE_DATATYPE points[4][4] =
|
||||||
{
|
{
|
||||||
@ -515,28 +515,28 @@ NOISE_DATATYPE cNoise::CubicNoise2D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y) cons
|
|||||||
|
|
||||||
NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOISE_DATATYPE a_Z) const
|
NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOISE_DATATYPE a_Z) const
|
||||||
{
|
{
|
||||||
const int BaseX = FAST_FLOOR(a_X);
|
const int BaseX = FAST_FLOOR(a_X);
|
||||||
const int BaseY = FAST_FLOOR(a_Y);
|
const int BaseY = FAST_FLOOR(a_Y);
|
||||||
const int BaseZ = FAST_FLOOR(a_Z);
|
const int BaseZ = FAST_FLOOR(a_Z);
|
||||||
|
|
||||||
const NOISE_DATATYPE points1[4][4] = {
|
const NOISE_DATATYPE points1[4][4] = {
|
||||||
{ IntNoise3D(BaseX - 1, BaseY - 1, BaseZ - 1), IntNoise3D(BaseX, BaseY - 1, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY - 1, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY - 1, BaseZ - 1), },
|
{ IntNoise3D(BaseX - 1, BaseY - 1, BaseZ - 1), IntNoise3D(BaseX, BaseY - 1, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY - 1, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY - 1, BaseZ - 1), },
|
||||||
{ IntNoise3D(BaseX - 1, BaseY, BaseZ - 1), IntNoise3D(BaseX, BaseY, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY, BaseZ - 1), },
|
{ IntNoise3D(BaseX - 1, BaseY, BaseZ - 1), IntNoise3D(BaseX, BaseY, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY, BaseZ - 1), },
|
||||||
{ IntNoise3D(BaseX - 1, BaseY + 1, BaseZ - 1), IntNoise3D(BaseX, BaseY + 1, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY + 1, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY + 1, BaseZ - 1), },
|
{ IntNoise3D(BaseX - 1, BaseY + 1, BaseZ - 1), IntNoise3D(BaseX, BaseY + 1, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY + 1, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY + 1, BaseZ - 1), },
|
||||||
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ - 1), IntNoise3D(BaseX, BaseY + 2, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ - 1), },
|
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ - 1), IntNoise3D(BaseX, BaseY + 2, BaseZ - 1), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ - 1), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ - 1), },
|
||||||
};
|
};
|
||||||
|
|
||||||
const NOISE_DATATYPE FracX = (a_X) - BaseX;
|
const NOISE_DATATYPE FracX = (a_X) - BaseX;
|
||||||
const NOISE_DATATYPE x1interp1 = CubicInterpolate( points1[0][0], points1[0][1], points1[0][2], points1[0][3], FracX );
|
const NOISE_DATATYPE x1interp1 = CubicInterpolate( points1[0][0], points1[0][1], points1[0][2], points1[0][3], FracX );
|
||||||
const NOISE_DATATYPE x1interp2 = CubicInterpolate( points1[1][0], points1[1][1], points1[1][2], points1[1][3], FracX );
|
const NOISE_DATATYPE x1interp2 = CubicInterpolate( points1[1][0], points1[1][1], points1[1][2], points1[1][3], FracX );
|
||||||
const NOISE_DATATYPE x1interp3 = CubicInterpolate( points1[2][0], points1[2][1], points1[2][2], points1[2][3], FracX );
|
const NOISE_DATATYPE x1interp3 = CubicInterpolate( points1[2][0], points1[2][1], points1[2][2], points1[2][3], FracX );
|
||||||
const NOISE_DATATYPE x1interp4 = CubicInterpolate( points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX );
|
const NOISE_DATATYPE x1interp4 = CubicInterpolate( points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX );
|
||||||
|
|
||||||
const NOISE_DATATYPE points2[4][4] = {
|
const NOISE_DATATYPE points2[4][4] = {
|
||||||
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ ), IntNoise3D( BaseX, BaseY-1, BaseZ ), IntNoise3D( BaseX+1, BaseY-1, BaseZ ), IntNoise3D( BaseX+2, BaseY-1, BaseZ ), },
|
{ IntNoise3D(BaseX - 1, BaseY - 1, BaseZ), IntNoise3D(BaseX, BaseY - 1, BaseZ), IntNoise3D(BaseX + 1, BaseY - 1, BaseZ), IntNoise3D(BaseX + 2, BaseY - 1, BaseZ), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY, BaseZ ), IntNoise3D( BaseX, BaseY, BaseZ ), IntNoise3D( BaseX+1, BaseY, BaseZ ), IntNoise3D( BaseX+2, BaseY, BaseZ ), },
|
{ IntNoise3D(BaseX - 1, BaseY, BaseZ), IntNoise3D(BaseX, BaseY, BaseZ), IntNoise3D(BaseX + 1, BaseY, BaseZ), IntNoise3D(BaseX + 2, BaseY, BaseZ), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ ), IntNoise3D( BaseX, BaseY+1, BaseZ ), IntNoise3D( BaseX+1, BaseY+1, BaseZ ), IntNoise3D( BaseX+2, BaseY+1, BaseZ ), },
|
{ IntNoise3D(BaseX - 1, BaseY + 1, BaseZ), IntNoise3D(BaseX, BaseY + 1, BaseZ), IntNoise3D(BaseX + 1, BaseY + 1, BaseZ), IntNoise3D(BaseX + 2, BaseY + 1, BaseZ), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ ), IntNoise3D( BaseX, BaseY+2, BaseZ ), IntNoise3D( BaseX+1, BaseY+2, BaseZ ), IntNoise3D( BaseX+2, BaseY+2, BaseZ ), },
|
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ), IntNoise3D(BaseX, BaseY + 2, BaseZ), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ), },
|
||||||
};
|
};
|
||||||
|
|
||||||
const NOISE_DATATYPE x2interp1 = CubicInterpolate( points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX );
|
const NOISE_DATATYPE x2interp1 = CubicInterpolate( points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX );
|
||||||
@ -544,11 +544,11 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
|
|||||||
const NOISE_DATATYPE x2interp3 = CubicInterpolate( points2[2][0], points2[2][1], points2[2][2], points2[2][3], FracX );
|
const NOISE_DATATYPE x2interp3 = CubicInterpolate( points2[2][0], points2[2][1], points2[2][2], points2[2][3], FracX );
|
||||||
const NOISE_DATATYPE x2interp4 = CubicInterpolate( points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX );
|
const NOISE_DATATYPE x2interp4 = CubicInterpolate( points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX );
|
||||||
|
|
||||||
const NOISE_DATATYPE points3[4][4] = {
|
const NOISE_DATATYPE points3[4][4] = {
|
||||||
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ + 1), },
|
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ + 1), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY, BaseZ+1 ), IntNoise3D( BaseX, BaseY, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY, BaseZ + 1), },
|
{ IntNoise3D( BaseX-1, BaseY, BaseZ+1 ), IntNoise3D( BaseX, BaseY, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY, BaseZ + 1), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ + 1), },
|
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ + 1), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ + 1), },
|
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ + 1), },
|
||||||
};
|
};
|
||||||
|
|
||||||
const NOISE_DATATYPE x3interp1 = CubicInterpolate( points3[0][0], points3[0][1], points3[0][2], points3[0][3], FracX );
|
const NOISE_DATATYPE x3interp1 = CubicInterpolate( points3[0][0], points3[0][1], points3[0][2], points3[0][3], FracX );
|
||||||
@ -556,11 +556,11 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
|
|||||||
const NOISE_DATATYPE x3interp3 = CubicInterpolate( points3[2][0], points3[2][1], points3[2][2], points3[2][3], FracX );
|
const NOISE_DATATYPE x3interp3 = CubicInterpolate( points3[2][0], points3[2][1], points3[2][2], points3[2][3], FracX );
|
||||||
const NOISE_DATATYPE x3interp4 = CubicInterpolate( points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX );
|
const NOISE_DATATYPE x3interp4 = CubicInterpolate( points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX );
|
||||||
|
|
||||||
const NOISE_DATATYPE points4[4][4] = {
|
const NOISE_DATATYPE points4[4][4] = {
|
||||||
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ+2 ), },
|
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ+2 ), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY, BaseZ+2 ), IntNoise3D( BaseX, BaseY, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY, BaseZ+2 ), },
|
{ IntNoise3D( BaseX-1, BaseY, BaseZ+2 ), IntNoise3D( BaseX, BaseY, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY, BaseZ+2 ), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ+2 ), },
|
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ+2 ), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ+2 ), },
|
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ+2 ), },
|
||||||
};
|
};
|
||||||
|
|
||||||
const NOISE_DATATYPE x4interp1 = CubicInterpolate( points4[0][0], points4[0][1], points4[0][2], points4[0][3], FracX );
|
const NOISE_DATATYPE x4interp1 = CubicInterpolate( points4[0][0], points4[0][1], points4[0][2], points4[0][3], FracX );
|
||||||
@ -568,13 +568,13 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
|
|||||||
const NOISE_DATATYPE x4interp3 = CubicInterpolate( points4[2][0], points4[2][1], points4[2][2], points4[2][3], FracX );
|
const NOISE_DATATYPE x4interp3 = CubicInterpolate( points4[2][0], points4[2][1], points4[2][2], points4[2][3], FracX );
|
||||||
const NOISE_DATATYPE x4interp4 = CubicInterpolate( points4[3][0], points4[3][1], points4[3][2], points4[3][3], FracX );
|
const NOISE_DATATYPE x4interp4 = CubicInterpolate( points4[3][0], points4[3][1], points4[3][2], points4[3][3], FracX );
|
||||||
|
|
||||||
const NOISE_DATATYPE FracY = (a_Y) - BaseY;
|
const NOISE_DATATYPE FracY = (a_Y) - BaseY;
|
||||||
const NOISE_DATATYPE yinterp1 = CubicInterpolate( x1interp1, x1interp2, x1interp3, x1interp4, FracY );
|
const NOISE_DATATYPE yinterp1 = CubicInterpolate( x1interp1, x1interp2, x1interp3, x1interp4, FracY );
|
||||||
const NOISE_DATATYPE yinterp2 = CubicInterpolate( x2interp1, x2interp2, x2interp3, x2interp4, FracY );
|
const NOISE_DATATYPE yinterp2 = CubicInterpolate( x2interp1, x2interp2, x2interp3, x2interp4, FracY );
|
||||||
const NOISE_DATATYPE yinterp3 = CubicInterpolate( x3interp1, x3interp2, x3interp3, x3interp4, FracY );
|
const NOISE_DATATYPE yinterp3 = CubicInterpolate( x3interp1, x3interp2, x3interp3, x3interp4, FracY );
|
||||||
const NOISE_DATATYPE yinterp4 = CubicInterpolate( x4interp1, x4interp2, x4interp3, x4interp4, FracY );
|
const NOISE_DATATYPE yinterp4 = CubicInterpolate( x4interp1, x4interp2, x4interp3, x4interp4, FracY );
|
||||||
|
|
||||||
const NOISE_DATATYPE FracZ = (a_Z) - BaseZ;
|
const NOISE_DATATYPE FracZ = (a_Z) - BaseZ;
|
||||||
return CubicInterpolate( yinterp1, yinterp2, yinterp3, yinterp4, FracZ );
|
return CubicInterpolate( yinterp1, yinterp2, yinterp3, yinterp4, FracZ );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ void cCubicNoise::Generate2D(
|
|||||||
Cell.InitWorkRnds(FloorX[0], FloorY[0]);
|
Cell.InitWorkRnds(FloorX[0], FloorY[0]);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// Statistics on the noise-space coords:
|
// Statistics on the noise-space coords:
|
||||||
if (NumSameX == 1)
|
if (NumSameX == 1)
|
||||||
{
|
{
|
||||||
m_NumSingleX++;
|
m_NumSingleX++;
|
||||||
|
@ -100,7 +100,7 @@ protected:
|
|||||||
cNoise m_Noise; // Used for integral rnd values
|
cNoise m_Noise; // Used for integral rnd values
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// Statistics on the noise-space coords:
|
// Statistics on the noise-space coords:
|
||||||
static int m_NumSingleX;
|
static int m_NumSingleX;
|
||||||
static int m_NumSingleXY;
|
static int m_NumSingleXY;
|
||||||
static int m_NumSingleY;
|
static int m_NumSingleY;
|
||||||
|
@ -84,7 +84,7 @@ void cRoot::InputThread(void * a_Params)
|
|||||||
AString Command;
|
AString Command;
|
||||||
std::getline(std::cin, Command);
|
std::getline(std::cin, Command);
|
||||||
if (!Command.empty())
|
if (!Command.empty())
|
||||||
{
|
{
|
||||||
self.ExecuteConsoleCommand(TrimString(Command), Output);
|
self.ExecuteConsoleCommand(TrimString(Command), Output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ void cRoot::Start(void)
|
|||||||
#if !defined(ANDROID_NDK)
|
#if !defined(ANDROID_NDK)
|
||||||
LOGD("Starting InputThread...");
|
LOGD("Starting InputThread...");
|
||||||
m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" );
|
m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" );
|
||||||
m_InputThread->Start( false ); // We should NOT wait? Otherwise we can't stop the server from other threads than the input thread
|
m_InputThread->Start( false ); // We should NOT wait? Otherwise we can't stop the server from other threads than the input thread
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long long finishmseconds = Time.GetNowTime();
|
long long finishmseconds = Time.GetNowTime();
|
||||||
@ -687,7 +687,7 @@ int cRoot::GetVirtualRAMUsage(void)
|
|||||||
&t_info_count
|
&t_info_count
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
return (int)(t_info.virtual_size / 1024);
|
return (int)(t_info.virtual_size / 1024);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
@ -739,7 +739,7 @@ int cRoot::GetPhysicalRAMUsage(void)
|
|||||||
&t_info_count
|
&t_info_count
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
return (int)(t_info.resident_size / 1024);
|
return (int)(t_info.resident_size / 1024);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
|
28
src/Root.h
28
src/Root.h
@ -36,20 +36,24 @@ namespace Json
|
|||||||
|
|
||||||
|
|
||||||
/// The root of the object hierarchy
|
/// The root of the object hierarchy
|
||||||
class cRoot // tolua_export
|
// tolua_begin
|
||||||
{ // tolua_export
|
class cRoot
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
static cRoot * Get() { return s_Root; } // tolua_export
|
static cRoot * Get() { return s_Root; }
|
||||||
|
// tolua_end
|
||||||
|
|
||||||
cRoot(void);
|
cRoot(void);
|
||||||
~cRoot();
|
~cRoot();
|
||||||
|
|
||||||
void Start(void);
|
void Start(void);
|
||||||
|
|
||||||
cServer * GetServer(void) { return m_Server; } // tolua_export
|
// tolua_begin
|
||||||
cWorld * GetDefaultWorld(void); // tolua_export
|
cServer * GetServer(void) { return m_Server; }
|
||||||
cWorld * GetWorld(const AString & a_WorldName); // tolua_export
|
cWorld * GetDefaultWorld(void);
|
||||||
cWorld * CreateAndInitializeWorld(const AString & a_WorldName); // tolua_export
|
cWorld * GetWorld(const AString & a_WorldName);
|
||||||
|
cWorld * CreateAndInitializeWorld(const AString & a_WorldName);
|
||||||
|
// 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 <<
|
bool ForEachWorld(cWorldListCallback & a_Callback); // >> Exported in ManualBindings <<
|
||||||
@ -106,13 +110,13 @@ public:
|
|||||||
void SaveAllChunks(void); // tolua_export
|
void SaveAllChunks(void); // tolua_export
|
||||||
|
|
||||||
/// Reloads all the groups
|
/// Reloads all the groups
|
||||||
void ReloadGroups(void); // tolua_export
|
void ReloadGroups(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 <<
|
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 <<
|
bool FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
|
|
||||||
@ -202,8 +206,8 @@ private:
|
|||||||
|
|
||||||
static void InputThread(void* a_Params);
|
static void InputThread(void* a_Params);
|
||||||
|
|
||||||
static cRoot* s_Root;
|
static cRoot* s_Root;
|
||||||
}; // tolua_export
|
}; // tolua_export
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -197,15 +197,18 @@ void cObjective::SendTo(cClientHandle & a_Client)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cTeam::cTeam(const AString & a_Name, const AString & a_DisplayName,
|
cTeam::cTeam(
|
||||||
const AString & a_Prefix, const AString & a_Suffix)
|
const AString & a_Name, const AString & a_DisplayName,
|
||||||
|
const AString & a_Prefix, const AString & a_Suffix
|
||||||
|
)
|
||||||
: m_AllowsFriendlyFire(true)
|
: m_AllowsFriendlyFire(true)
|
||||||
, m_CanSeeFriendlyInvisible(false)
|
, m_CanSeeFriendlyInvisible(false)
|
||||||
, m_DisplayName(a_DisplayName)
|
, m_DisplayName(a_DisplayName)
|
||||||
, m_Name(a_Name)
|
, m_Name(a_Name)
|
||||||
, m_Prefix(a_Prefix)
|
, m_Prefix(a_Prefix)
|
||||||
, m_Suffix(a_Suffix)
|
, m_Suffix(a_Suffix)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,25 +259,22 @@ public:
|
|||||||
/** Send this scoreboard to the specified client */
|
/** Send this scoreboard to the specified client */
|
||||||
void SendTo(cClientHandle & a_Client);
|
void SendTo(cClientHandle & a_Client);
|
||||||
|
|
||||||
cTeam * QueryPlayerTeam(const AString & a_Name); // WARNING: O(n logn)
|
cTeam * QueryPlayerTeam(const AString & a_Name); // WARNING: O(n logn)
|
||||||
|
|
||||||
/** Execute callback for each objective with the specified type
|
/** Execute callback for each objective with the specified type
|
||||||
*
|
Returns true if all objectives processed, false if the callback aborted by returning true.
|
||||||
* Returns true if all objectives processed, false if the callback aborted by returning true.
|
*/
|
||||||
*/
|
|
||||||
bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback);
|
bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback);
|
||||||
|
|
||||||
/** Execute callback for each objective.
|
/** Execute callback for each objective.
|
||||||
*
|
Returns true if all objectives have been processed, false if the callback aborted by returning true.
|
||||||
* Returns true if all objectives have been processed, false if the callback aborted by returning true.
|
*/
|
||||||
*/
|
bool ForEachObjective(cObjectiveCallback& a_Callback); // Exported in ManualBindings.cpp
|
||||||
bool ForEachObjective(cObjectiveCallback& a_Callback); // Exported in ManualBindings.cpp
|
|
||||||
|
|
||||||
/** Execute callback for each team.
|
/** Execute callback for each team.
|
||||||
*
|
Returns true if all teams have been processed, false if the callback aborted by returning true.
|
||||||
* Returns true if all teams have been processed, false if the callback aborted by returning true.
|
*/
|
||||||
*/
|
bool ForEachTeam(cTeamCallback& a_Callback); // Exported in ManualBindings.cpp
|
||||||
bool ForEachTeam(cTeamCallback& a_Callback); // Exported in ManualBindings.cpp
|
|
||||||
|
|
||||||
void SetDisplay(cObjective * a_Objective, eDisplaySlot a_Slot);
|
void SetDisplay(cObjective * a_Objective, eDisplaySlot a_Slot);
|
||||||
|
|
||||||
|
@ -50,10 +50,10 @@ namespace Json
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cServer // tolua_export
|
class cServer // tolua_export
|
||||||
: public cListenThread::cCallback
|
: public cListenThread::cCallback
|
||||||
{ // tolua_export
|
{ // tolua_export
|
||||||
public: // tolua_export
|
public: // tolua_export
|
||||||
|
|
||||||
virtual ~cServer() {}
|
virtual ~cServer() {}
|
||||||
bool InitServer(cIniFile & a_SettingsIni);
|
bool InitServer(cIniFile & a_SettingsIni);
|
||||||
@ -149,7 +149,7 @@ private:
|
|||||||
|
|
||||||
virtual void Execute(void);
|
virtual void Execute(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
cNotifyWriteThread(void);
|
cNotifyWriteThread(void);
|
||||||
~cNotifyWriteThread();
|
~cNotifyWriteThread();
|
||||||
|
@ -62,7 +62,7 @@ enum eStatistic
|
|||||||
statDistDove,
|
statDistDove,
|
||||||
statDistMinecart,
|
statDistMinecart,
|
||||||
statDistBoat,
|
statDistBoat,
|
||||||
statDistPig,
|
statDistPig,
|
||||||
statDistHorse,
|
statDistHorse,
|
||||||
statJumps,
|
statJumps,
|
||||||
statItemsDropped,
|
statItemsDropped,
|
||||||
@ -143,10 +143,9 @@ public:
|
|||||||
/** Reset everything. */
|
/** Reset everything. */
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
/** Increment the specified stat.
|
/** Increments the specified stat.
|
||||||
*
|
Returns the new value.
|
||||||
* Returns the new value.
|
*/
|
||||||
*/
|
|
||||||
StatValue AddValue(const eStatistic a_Stat, const StatValue a_Delta = 1);
|
StatValue AddValue(const eStatistic a_Stat, const StatValue a_Delta = 1);
|
||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
@ -233,13 +233,13 @@ AString & StrToLower(AString & s)
|
|||||||
int NoCaseCompare(const AString & s1, const AString & s2)
|
int NoCaseCompare(const AString & s1, const AString & s2)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// MSVC has stricmp that compares case-insensitive:
|
// MSVC has stricmp that compares case-insensitive:
|
||||||
return _stricmp(s1.c_str(), s2.c_str());
|
return _stricmp(s1.c_str(), s2.c_str());
|
||||||
#else
|
#else
|
||||||
// Do it the hard way:
|
// Do it the hard way:
|
||||||
AString s1Copy(s1);
|
AString s1Copy(s1);
|
||||||
AString s2Copy(s2);
|
AString s2Copy(s2);
|
||||||
return StrToUpper(s1Copy).compare(StrToUpper(s2Copy));
|
return StrToUpper(s1Copy).compare(StrToUpper(s2Copy));
|
||||||
#endif // else _MSC_VER
|
#endif // else _MSC_VER
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,9 +346,9 @@ AString & RawBEToUTF8(const char * a_RawData, size_t a_NumShorts, AString & a_UT
|
|||||||
/*
|
/*
|
||||||
Notice from the original file:
|
Notice from the original file:
|
||||||
* Copyright 2001-2004 Unicode, Inc.
|
* Copyright 2001-2004 Unicode, Inc.
|
||||||
*
|
*
|
||||||
* Disclaimer
|
* Disclaimer
|
||||||
*
|
*
|
||||||
* This source code is provided as is by Unicode, Inc. No claims are
|
* This source code is provided as is by Unicode, Inc. No claims are
|
||||||
* made as to fitness for any particular purpose. No warranties of any
|
* made as to fitness for any particular purpose. No warranties of any
|
||||||
* kind are expressed or implied. The recipient agrees to determine
|
* kind are expressed or implied. The recipient agrees to determine
|
||||||
@ -356,9 +356,9 @@ Notice from the original file:
|
|||||||
* purchased on magnetic or optical media from Unicode, Inc., the
|
* purchased on magnetic or optical media from Unicode, Inc., the
|
||||||
* sole remedy for any claim will be exchange of defective media
|
* sole remedy for any claim will be exchange of defective media
|
||||||
* within 90 days of receipt.
|
* within 90 days of receipt.
|
||||||
*
|
*
|
||||||
* Limitations on Rights to Redistribute This Code
|
* Limitations on Rights to Redistribute This Code
|
||||||
*
|
*
|
||||||
* Unicode, Inc. hereby grants the right to freely use the information
|
* Unicode, Inc. hereby grants the right to freely use the information
|
||||||
* supplied in this file in the creation of products supporting the
|
* supplied in this file in the creation of products supporting the
|
||||||
* Unicode Standard, and to make copies of this file in any form
|
* Unicode Standard, and to make copies of this file in any form
|
||||||
@ -378,13 +378,13 @@ Notice from the original file:
|
|||||||
|
|
||||||
static const char trailingBytesForUTF8[256] =
|
static const char trailingBytesForUTF8[256] =
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ static const char trailingBytesForUTF8[256] =
|
|||||||
|
|
||||||
static const unsigned int offsetsFromUTF8[6] =
|
static const unsigned int offsetsFromUTF8[6] =
|
||||||
{
|
{
|
||||||
0x00000000UL, 0x00003080UL, 0x000E2080UL,
|
0x00000000UL, 0x00003080UL, 0x000E2080UL,
|
||||||
0x03C82080UL, 0xFA082080UL, 0x82082080UL
|
0x03C82080UL, 0xFA082080UL, 0x82082080UL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -502,22 +502,21 @@ AString & UTF8ToRawBEUTF16(const char * a_UTF8, size_t a_UTF8Length, AString & a
|
|||||||
return a_UTF16;
|
return a_UTF16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/*
|
||||||
|
---------------------------------------------------------------------
|
||||||
Note A.
|
Note A.
|
||||||
The fall-through switches in UTF-8 reading code save a
|
The fall-through switches in UTF-8 reading code save a
|
||||||
temp variable, some decrements & conditionals. The switches
|
temp variable, some decrements & conditionals. The switches
|
||||||
are equivalent to the following loop:
|
are equivalent to the following loop:
|
||||||
{
|
{
|
||||||
int tmpBytesToRead = extraBytesToRead+1;
|
int tmpBytesToRead = extraBytesToRead+1;
|
||||||
do {
|
do {
|
||||||
ch += *source++;
|
ch += *source++;
|
||||||
--tmpBytesToRead;
|
--tmpBytesToRead;
|
||||||
if (tmpBytesToRead) ch <<= 6;
|
if (tmpBytesToRead) ch <<= 6;
|
||||||
} while (tmpBytesToRead > 0);
|
} while (tmpBytesToRead > 0);
|
||||||
}
|
}
|
||||||
|
---------------------------------------------------------------------
|
||||||
---------------------------------------------------------------------
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -761,7 +760,7 @@ AString Base64Decode(const AString & a_Base64String)
|
|||||||
{
|
{
|
||||||
switch (o & 7)
|
switch (o & 7)
|
||||||
{
|
{
|
||||||
case 0: res[o >> 3] |= (c << 2); break;
|
case 0: res[o >> 3] |= (c << 2); break;
|
||||||
case 6: res[o >> 3] |= (c >> 4); res[(o >> 3) + 1] |= (c << 4); break;
|
case 6: res[o >> 3] |= (c >> 4); res[(o >> 3) + 1] |= (c << 4); break;
|
||||||
case 4: res[o >> 3] |= (c >> 2); res[(o >> 3) + 1] |= (c << 6); break;
|
case 4: res[o >> 3] |= (c >> 2); res[(o >> 3) + 1] |= (c << 6); break;
|
||||||
case 2: res[o >> 3] |= c; break;
|
case 2: res[o >> 3] |= c; break;
|
||||||
|
@ -6,10 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef STRINGUTILS_H_INCLUDED
|
#pragma once
|
||||||
#define STRINGUTILS_H_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -101,8 +98,3 @@ extern void SetBEInt(char * a_Mem, Int32 a_Value);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // STRINGUTILS_H_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ private:
|
|||||||
/// Calculates where on the block a collision occured, if it does occur
|
/// Calculates where on the block a collision occured, if it does occur
|
||||||
/// Returns 0 if no intersection occured
|
/// Returns 0 if no intersection occured
|
||||||
/// Returns 1 if an intersection occured at a single point
|
/// Returns 1 if an intersection occured at a single point
|
||||||
/// Returns 2 if the line segment lies in the plane being checked
|
/// Returns 2 if the line segment lies in the plane being checked
|
||||||
int intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f & a_End, const Vector3f & a_PlanePos, const Vector3f & a_PlaneNormal );
|
int intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f & a_End, const Vector3f & a_PlanePos, const Vector3f & a_PlaneNormal );
|
||||||
|
|
||||||
/// Determines which face on the block a collision occured, if it does occur
|
/// Determines which face on the block a collision occured, if it does occur
|
||||||
|
@ -99,7 +99,7 @@ protected:
|
|||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
LOG("" SIZE_T_FMT " chunks to load, %d chunks to generate",
|
LOG("" SIZE_T_FMT " chunks to load, %d chunks to generate",
|
||||||
m_World->GetStorage().GetLoadQueueLength(),
|
m_World->GetStorage().GetLoadQueueLength(),
|
||||||
m_World->GetGenerator().GetQueueLength()
|
m_World->GetGenerator().GetQueueLength()
|
||||||
);
|
);
|
||||||
@ -2226,7 +2226,7 @@ void cWorld::SetChunkData(
|
|||||||
const NIBBLETYPE * a_BlockSkyLight,
|
const NIBBLETYPE * a_BlockSkyLight,
|
||||||
const cChunkDef::HeightMap * a_HeightMap,
|
const cChunkDef::HeightMap * a_HeightMap,
|
||||||
const cChunkDef::BiomeMap * a_BiomeMap,
|
const cChunkDef::BiomeMap * a_BiomeMap,
|
||||||
cEntityList & a_Entities,
|
cEntityList & a_Entities,
|
||||||
cBlockEntityList & a_BlockEntities,
|
cBlockEntityList & a_BlockEntities,
|
||||||
bool a_MarkDirty
|
bool a_MarkDirty
|
||||||
)
|
)
|
||||||
@ -2242,7 +2242,7 @@ void cWorld::SetChunkData(
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_ChunkMap->SetChunkData(
|
m_ChunkMap->SetChunkData(
|
||||||
a_ChunkX, a_ChunkZ,
|
a_ChunkX, a_ChunkZ,
|
||||||
a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight,
|
a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight,
|
||||||
a_HeightMap, *Biomes,
|
a_HeightMap, *Biomes,
|
||||||
a_BlockEntities,
|
a_BlockEntities,
|
||||||
@ -2872,7 +2872,7 @@ void cWorld::RemoveEntity(cEntity * a_Entity)
|
|||||||
unsigned int cWorld::GetNumPlayers(void)
|
unsigned int cWorld::GetNumPlayers(void)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSPlayers);
|
cCSLock Lock(m_CSPlayers);
|
||||||
return m_Players.size();
|
return m_Players.size();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -2920,7 +2920,7 @@ void cWorld::TickQueuedBlocks(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_BlockTickQueue.push_back(Block); // Keep the block in the queue
|
m_BlockTickQueue.push_back(Block); // Keep the block in the queue
|
||||||
}
|
}
|
||||||
} // for itr - m_BlockTickQueueCopy[]
|
} // for itr - m_BlockTickQueueCopy[]
|
||||||
}
|
}
|
||||||
|
14
src/World.h
14
src/World.h
@ -140,7 +140,7 @@ public:
|
|||||||
int GetTicksUntilWeatherChange(void) const { return m_WeatherInterval; }
|
int GetTicksUntilWeatherChange(void) const { return m_WeatherInterval; }
|
||||||
|
|
||||||
virtual Int64 GetWorldAge (void) const override { return m_WorldAge; }
|
virtual Int64 GetWorldAge (void) const override { return m_WorldAge; }
|
||||||
virtual Int64 GetTimeOfDay(void) const override { return m_TimeOfDay; }
|
virtual Int64 GetTimeOfDay(void) const override { return m_TimeOfDay; }
|
||||||
|
|
||||||
void SetTicksUntilWeatherChange(int a_WeatherInterval)
|
void SetTicksUntilWeatherChange(int a_WeatherInterval)
|
||||||
{
|
{
|
||||||
@ -301,10 +301,10 @@ public:
|
|||||||
bool DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
|
bool DoWithPlayer(const AString & a_PlayerName, 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_PlayerNameHint, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
|
bool FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
|
||||||
|
|
||||||
// TODO: This interface is dangerous - rewrite to DoWithClosestPlayer(pos, sight, action)
|
// TODO: This interface is dangerous - rewrite to DoWithClosestPlayer(pos, sight, action)
|
||||||
cPlayer * FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, bool a_CheckLineOfSight = true);
|
cPlayer * FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, bool a_CheckLineOfSight = true);
|
||||||
|
|
||||||
void SendPlayerList(cPlayer * a_DestPlayer); // Sends playerlist to the player
|
void SendPlayerList(cPlayer * a_DestPlayer); // Sends playerlist to the player
|
||||||
|
|
||||||
@ -365,10 +365,10 @@ public:
|
|||||||
bool SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player = NULL); // Exported in ManualBindings.cpp
|
bool SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player = NULL); // Exported in ManualBindings.cpp
|
||||||
|
|
||||||
/** Sets the sign text, asking plugins for permission first. a_Player is the player who this change belongs to, may be NULL. Returns true if sign text changed. Same as SetSignLines() */
|
/** Sets the sign text, asking plugins for permission first. a_Player is the player who this change belongs to, may be NULL. Returns true if sign text changed. Same as SetSignLines() */
|
||||||
bool UpdateSign(int a_X, int a_Y, int a_Z, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player = NULL); // Exported in ManualBindings.cpp
|
bool UpdateSign(int a_X, int a_Y, int a_Z, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player = NULL); // Exported in ManualBindings.cpp
|
||||||
|
|
||||||
/** Sets the command block command. Returns true if command changed. */
|
/** Sets the command block command. Returns true if command changed. */
|
||||||
bool SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Command); // tolua_export
|
bool SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Command); // tolua_export
|
||||||
|
|
||||||
/** Is the trapdoor open? Returns false if there is no trapdoor at the specified coords. */
|
/** Is the trapdoor open? Returns false if there is no trapdoor at the specified coords. */
|
||||||
bool IsTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
|
bool IsTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
|
||||||
@ -377,10 +377,10 @@ public:
|
|||||||
bool SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Open); // tolua_export
|
bool SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Open); // tolua_export
|
||||||
|
|
||||||
/** Regenerate the given chunk: */
|
/** Regenerate the given chunk: */
|
||||||
void RegenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
|
void RegenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
|
||||||
|
|
||||||
/** Generates the given chunk, if not already generated */
|
/** Generates the given chunk, if not already generated */
|
||||||
void GenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
|
void GenerateChunk(int a_ChunkX, int a_ChunkZ); // tolua_export
|
||||||
|
|
||||||
/** Queues a chunk for lighting; a_Callback is called after the chunk is lighted */
|
/** Queues a chunk for lighting; a_Callback is called after the chunk is lighted */
|
||||||
void QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = NULL);
|
void QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = NULL);
|
||||||
|
@ -61,7 +61,7 @@ protected:
|
|||||||
// It uses templates to remove the virtual function call penalty (both size and speed) for each callback
|
// It uses templates to remove the virtual function call penalty (both size and speed) for each callback
|
||||||
|
|
||||||
/* Usage:
|
/* Usage:
|
||||||
1, Declare a subclass:
|
1, Declare a subclass:
|
||||||
class CMyParser : public CExpatImpl<CMyParser>
|
class CMyParser : public CExpatImpl<CMyParser>
|
||||||
2, Declare handlers that you want in that subclass:
|
2, Declare handlers that you want in that subclass:
|
||||||
void CMyParser::OnEndElement(const XML_Char * iTagName);
|
void CMyParser::OnEndElement(const XML_Char * iTagName);
|
||||||
@ -318,7 +318,7 @@ protected:
|
|||||||
void EnableEndDoctypeDeclHandler (bool fEnable = true)
|
void EnableEndDoctypeDeclHandler (bool fEnable = true)
|
||||||
{
|
{
|
||||||
assert (m_p != NULL);
|
assert (m_p != NULL);
|
||||||
XML_SetEndDoctypeDeclHandler (m_p,
|
XML_SetEndDoctypeDeclHandler (m_p,
|
||||||
fEnable ? EndDoctypeDeclHandler : NULL);
|
fEnable ? EndDoctypeDeclHandler : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Get last error
|
// @cmember Get last error
|
||||||
|
|
||||||
enum XML_Error GetErrorCode ()
|
enum XML_Error GetErrorCode ()
|
||||||
{
|
{
|
||||||
assert (m_p != NULL);
|
assert (m_p != NULL);
|
||||||
return XML_GetErrorCode (m_p);
|
return XML_GetErrorCode (m_p);
|
||||||
@ -344,7 +344,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Get the current byte index
|
// @cmember Get the current byte index
|
||||||
|
|
||||||
long GetCurrentByteIndex ()
|
long GetCurrentByteIndex ()
|
||||||
{
|
{
|
||||||
assert (m_p != NULL);
|
assert (m_p != NULL);
|
||||||
return XML_GetCurrentByteIndex (m_p);
|
return XML_GetCurrentByteIndex (m_p);
|
||||||
@ -352,7 +352,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Get the current line number
|
// @cmember Get the current line number
|
||||||
|
|
||||||
int GetCurrentLineNumber ()
|
int GetCurrentLineNumber ()
|
||||||
{
|
{
|
||||||
assert (m_p != NULL);
|
assert (m_p != NULL);
|
||||||
return XML_GetCurrentLineNumber (m_p);
|
return XML_GetCurrentLineNumber (m_p);
|
||||||
@ -360,7 +360,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Get the current column number
|
// @cmember Get the current column number
|
||||||
|
|
||||||
int GetCurrentColumnNumber ()
|
int GetCurrentColumnNumber ()
|
||||||
{
|
{
|
||||||
assert (m_p != NULL);
|
assert (m_p != NULL);
|
||||||
return XML_GetCurrentColumnNumber (m_p);
|
return XML_GetCurrentColumnNumber (m_p);
|
||||||
@ -368,7 +368,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Get the current byte count
|
// @cmember Get the current byte count
|
||||||
|
|
||||||
int GetCurrentByteCount ()
|
int GetCurrentByteCount ()
|
||||||
{
|
{
|
||||||
assert (m_p != NULL);
|
assert (m_p != NULL);
|
||||||
return XML_GetCurrentByteCount (m_p);
|
return XML_GetCurrentByteCount (m_p);
|
||||||
@ -384,7 +384,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Get last error string
|
// @cmember Get last error string
|
||||||
|
|
||||||
const XML_LChar *GetErrorString ()
|
const XML_LChar *GetErrorString ()
|
||||||
{
|
{
|
||||||
return XML_ErrorString (GetErrorCode ());
|
return XML_ErrorString (GetErrorCode ());
|
||||||
}
|
}
|
||||||
@ -411,7 +411,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Get last error string
|
// @cmember Get last error string
|
||||||
|
|
||||||
static const XML_LChar *GetErrorString (enum XML_Error nError)
|
static const XML_LChar *GetErrorString (enum XML_Error nError)
|
||||||
{
|
{
|
||||||
return XML_ErrorString (nError);
|
return XML_ErrorString (nError);
|
||||||
}
|
}
|
||||||
@ -443,7 +443,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Processing instruction handler
|
// @cmember Processing instruction handler
|
||||||
|
|
||||||
void OnProcessingInstruction (const XML_Char *pszTarget,
|
void OnProcessingInstruction (const XML_Char *pszTarget,
|
||||||
const XML_Char *pszData)
|
const XML_Char *pszData)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -495,7 +495,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Start namespace declaration handler
|
// @cmember Start namespace declaration handler
|
||||||
|
|
||||||
void OnStartNamespaceDecl (const XML_Char *pszPrefix,
|
void OnStartNamespaceDecl (const XML_Char *pszPrefix,
|
||||||
const XML_Char *pszURI)
|
const XML_Char *pszURI)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -518,7 +518,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Start DOCTYPE declaration handler
|
// @cmember Start DOCTYPE declaration handler
|
||||||
|
|
||||||
void OnStartDoctypeDecl (const XML_Char *pszDoctypeName,
|
void OnStartDoctypeDecl (const XML_Char *pszDoctypeName,
|
||||||
const XML_Char *pszSysID, const XML_Char *pszPubID,
|
const XML_Char *pszSysID, const XML_Char *pszPubID,
|
||||||
bool fHasInternalSubset)
|
bool fHasInternalSubset)
|
||||||
{
|
{
|
||||||
@ -607,7 +607,7 @@ protected:
|
|||||||
|
|
||||||
// @cmember Default wrapper
|
// @cmember Default wrapper
|
||||||
|
|
||||||
static void __cdecl DefaultHandler (void *pUserData,
|
static void __cdecl DefaultHandler (void *pUserData,
|
||||||
const XML_Char *pszData, int nLength)
|
const XML_Char *pszData, int nLength)
|
||||||
{
|
{
|
||||||
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
|
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
|
||||||
@ -616,12 +616,12 @@ protected:
|
|||||||
|
|
||||||
// @cmember External entity ref wrapper
|
// @cmember External entity ref wrapper
|
||||||
|
|
||||||
static int __cdecl ExternalEntityRefHandler (void *pUserData,
|
static int __cdecl ExternalEntityRefHandler (void *pUserData,
|
||||||
const XML_Char *pszContext, const XML_Char *pszBase,
|
const XML_Char *pszContext, const XML_Char *pszBase,
|
||||||
const XML_Char *pszSystemID, const XML_Char *pszPublicID)
|
const XML_Char *pszSystemID, const XML_Char *pszPublicID)
|
||||||
{
|
{
|
||||||
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
|
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
|
||||||
return pThis ->OnExternalEntityRef (pszContext,
|
return pThis ->OnExternalEntityRef (pszContext,
|
||||||
pszBase, pszSystemID, pszPublicID) ? 1 : 0;
|
pszBase, pszSystemID, pszPublicID) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,12 +660,12 @@ protected:
|
|||||||
// @cmember Start Doctype declaration wrapper
|
// @cmember Start Doctype declaration wrapper
|
||||||
|
|
||||||
static void __cdecl StartDoctypeDeclHandler (
|
static void __cdecl StartDoctypeDeclHandler (
|
||||||
void *pUserData, const XML_Char *pszDoctypeName, const XML_Char *pszSysID,
|
void *pUserData, const XML_Char *pszDoctypeName, const XML_Char *pszSysID,
|
||||||
const XML_Char *pszPubID, int nHasInternalSubset
|
const XML_Char *pszPubID, int nHasInternalSubset
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
|
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
|
||||||
pThis ->OnStartDoctypeDecl (pszDoctypeName, pszSysID,
|
pThis ->OnStartDoctypeDecl (pszDoctypeName, pszSysID,
|
||||||
pszPubID, nHasInternalSubset != 0);
|
pszPubID, nHasInternalSubset != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ bool g_ShouldLogCommOut;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void NonCtrlHandler(int a_Signal)
|
void NonCtrlHandler(int a_Signal)
|
||||||
{
|
{
|
||||||
LOGD("Terminate event raised from std::signal");
|
LOGD("Terminate event raised from std::signal");
|
||||||
g_TERMINATE_EVENT_RAISED = true;
|
g_TERMINATE_EVENT_RAISED = true;
|
||||||
@ -277,7 +277,7 @@ int main( int argc, char **argv )
|
|||||||
try
|
try
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
cRoot Root;
|
cRoot Root;
|
||||||
Root.Start();
|
Root.Start();
|
||||||
}
|
}
|
||||||
#if !defined(ANDROID_NDK)
|
#if !defined(ANDROID_NDK)
|
||||||
|
Loading…
Reference in New Issue
Block a user