CheckBasicStyle: checks spaces around * and &.
This commit is contained in:
parent
c13b1931ff
commit
846d16315a
@ -159,7 +159,7 @@ void cLuaWindow::Destroy(void)
|
||||
m_Plugin->Unreference(m_LuaRef);
|
||||
}
|
||||
|
||||
// Lua will take care of this object, it will garbage-collect it, so we *must not* delete it!
|
||||
// Lua will take care of this object, it will garbage-collect it, so we must not delete it!
|
||||
m_IsDestroyed = false;
|
||||
}
|
||||
|
||||
@ -167,10 +167,10 @@ void cLuaWindow::Destroy(void)
|
||||
|
||||
|
||||
|
||||
void cLuaWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer& a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply)
|
||||
void cLuaWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply)
|
||||
{
|
||||
cSlotAreas Areas;
|
||||
for (auto Area : m_SlotAreas)
|
||||
for (auto && Area : m_SlotAreas)
|
||||
{
|
||||
if (Area != a_ClickedArea)
|
||||
{
|
||||
|
@ -2557,8 +2557,8 @@ static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string,
|
||||
|
||||
for (std::map<std::string, std::string>::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it)
|
||||
{
|
||||
const char* key = it->first.c_str();
|
||||
const char* value = it->second.c_str();
|
||||
const char * key = it->first.c_str();
|
||||
const char * value = it->second.c_str();
|
||||
lua_pushstring(tolua_S, key);
|
||||
lua_pushstring(tolua_S, value);
|
||||
lua_settable(tolua_S, top);
|
||||
@ -2573,7 +2573,7 @@ static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string,
|
||||
|
||||
static int tolua_get_HTTPRequest_Params(lua_State* tolua_S)
|
||||
{
|
||||
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr);
|
||||
HTTPRequest * self = reinterpret_cast<HTTPRequest *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||
return tolua_push_StringStringMap(tolua_S, self->Params);
|
||||
}
|
||||
|
||||
@ -2583,7 +2583,7 @@ static int tolua_get_HTTPRequest_Params(lua_State* tolua_S)
|
||||
|
||||
static int tolua_get_HTTPRequest_PostParams(lua_State* tolua_S)
|
||||
{
|
||||
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr);
|
||||
HTTPRequest * self = reinterpret_cast<HTTPRequest *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||
return tolua_push_StringStringMap(tolua_S, self->PostParams);
|
||||
}
|
||||
|
||||
@ -2593,8 +2593,8 @@ static int tolua_get_HTTPRequest_PostParams(lua_State* tolua_S)
|
||||
|
||||
static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S)
|
||||
{
|
||||
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr);
|
||||
std::map< std::string, HTTPFormData >& FormData = self->FormData;
|
||||
HTTPRequest * self = reinterpret_cast<HTTPRequest *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||
std::map<std::string, HTTPFormData> & FormData = self->FormData;
|
||||
|
||||
lua_newtable(tolua_S);
|
||||
int top = lua_gettop(tolua_S);
|
||||
|
@ -164,12 +164,20 @@ local g_ViolationPatterns =
|
||||
-- Cannot check spaces around "-", because the minus is sometimes used as a hyphen between-words
|
||||
|
||||
-- Check spaces around "*":
|
||||
{"^[a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"},
|
||||
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"},
|
||||
{"^[a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"},
|
||||
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"},
|
||||
{"^[a-zB-Z0-9]+%* [a-zA-Z0-9]+", "Add space before *"},
|
||||
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zB-Z0-9]+%* [a-zA-Z0-9]+", "Add space before *"},
|
||||
|
||||
-- Check spaces around "/":
|
||||
{"^[a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"},
|
||||
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"},
|
||||
|
||||
-- Check spaces around "&":
|
||||
{"^[a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around /"},
|
||||
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around /"},
|
||||
{"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
|
||||
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
|
||||
}
|
||||
|
||||
|
||||
|
@ -472,26 +472,26 @@ void cChunk::Stay(bool a_Stay)
|
||||
|
||||
|
||||
|
||||
void cChunk::CollectMobCensus(cMobCensus& toFill)
|
||||
void cChunk::CollectMobCensus(cMobCensus & toFill)
|
||||
{
|
||||
toFill.CollectSpawnableChunk(*this);
|
||||
std::list<const Vector3d*> playerPositions;
|
||||
cPlayer* currentPlayer;
|
||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr)
|
||||
std::list<const Vector3d *> playerPositions;
|
||||
cPlayer * currentPlayer;
|
||||
for (auto itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr)
|
||||
{
|
||||
currentPlayer = (*itr)->GetPlayer();
|
||||
playerPositions.push_back(&(currentPlayer->GetPosition()));
|
||||
}
|
||||
|
||||
Vector3d currentPosition;
|
||||
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
|
||||
for (auto itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
|
||||
{
|
||||
// LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
|
||||
if ((*itr)->IsMob())
|
||||
{
|
||||
cMonster& Monster = (cMonster&)(**itr);
|
||||
auto & Monster = reinterpret_cast<cMonster &>(**itr);
|
||||
currentPosition = Monster.GetPosition();
|
||||
for (std::list<const Vector3d*>::const_iterator itr2 = playerPositions.begin(); itr2 != playerPositions.end(); ++itr2)
|
||||
for (auto itr2 = playerPositions.cbegin(); itr2 != playerPositions.cend(); ++itr2)
|
||||
{
|
||||
toFill.CollectMob(Monster, *this, (currentPosition - **itr2).SqrLength());
|
||||
}
|
||||
@ -531,7 +531,7 @@ void cChunk::GetRandomBlockCoords(int & a_X, int & a_Y, int & a_Z)
|
||||
|
||||
|
||||
|
||||
void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner)
|
||||
void cChunk::SpawnMobs(cMobSpawner & a_MobSpawner)
|
||||
{
|
||||
int CenterX, CenterY, CenterZ;
|
||||
GetRandomBlockCoords(CenterX, CenterY, CenterZ);
|
||||
@ -1839,7 +1839,7 @@ bool cChunk::SetSignLines(int a_PosX, int a_PosY, int a_PosZ, const AString & a_
|
||||
|
||||
|
||||
|
||||
void cChunk::RemoveBlockEntity( cBlockEntity* a_BlockEntity)
|
||||
void cChunk::RemoveBlockEntity(cBlockEntity * a_BlockEntity)
|
||||
{
|
||||
MarkDirty();
|
||||
m_BlockEntities.remove(a_BlockEntity);
|
||||
|
@ -155,10 +155,10 @@ public:
|
||||
void Stay(bool a_Stay = true);
|
||||
|
||||
/** Recence all mobs proximities to players in order to know what to do with them */
|
||||
void CollectMobCensus(cMobCensus& toFill);
|
||||
void CollectMobCensus(cMobCensus & toFill);
|
||||
|
||||
/** Try to Spawn Monsters inside chunk */
|
||||
void SpawnMobs(cMobSpawner& a_MobSpawner);
|
||||
void SpawnMobs(cMobSpawner & a_MobSpawner);
|
||||
|
||||
void Tick(std::chrono::milliseconds a_Dt);
|
||||
|
||||
|
@ -65,7 +65,7 @@ cChunkMap::~cChunkMap()
|
||||
|
||||
|
||||
|
||||
void cChunkMap::RemoveLayer( cChunkLayer* a_Layer)
|
||||
void cChunkMap::RemoveLayer(cChunkLayer * a_Layer)
|
||||
{
|
||||
cCSLock Lock(m_CSLayers);
|
||||
m_Layers.remove(a_Layer);
|
||||
@ -2716,12 +2716,12 @@ void cChunkMap::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
|
||||
|
||||
void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill)
|
||||
void cChunkMap::CollectMobCensus(cMobCensus & a_ToFill)
|
||||
{
|
||||
cCSLock Lock(m_CSLayers);
|
||||
for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr)
|
||||
for (auto && layer: m_Layers)
|
||||
{
|
||||
(*itr)->CollectMobCensus(a_ToFill);
|
||||
layer->CollectMobCensus(a_ToFill);
|
||||
} // for itr - m_Layers
|
||||
}
|
||||
|
||||
@ -2730,12 +2730,12 @@ void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill)
|
||||
|
||||
|
||||
|
||||
void cChunkMap::SpawnMobs(cMobSpawner& a_MobSpawner)
|
||||
void cChunkMap::SpawnMobs(cMobSpawner & a_MobSpawner)
|
||||
{
|
||||
cCSLock Lock(m_CSLayers);
|
||||
for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr)
|
||||
for (auto && layer: m_Layers)
|
||||
{
|
||||
(*itr)->SpawnMobs(a_MobSpawner);
|
||||
layer->SpawnMobs(a_MobSpawner);
|
||||
} // for itr - m_Layers
|
||||
}
|
||||
|
||||
@ -2936,7 +2936,7 @@ cChunk * cChunkMap::cChunkLayer::FindChunk(int a_ChunkX, int a_ChunkZ)
|
||||
|
||||
|
||||
|
||||
void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill)
|
||||
void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus & a_ToFill)
|
||||
{
|
||||
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||
{
|
||||
@ -2955,7 +2955,7 @@ void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill)
|
||||
|
||||
|
||||
|
||||
void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner& a_MobSpawner)
|
||||
void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner & a_MobSpawner)
|
||||
{
|
||||
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
|
||||
static const int LAYER_SIZE = 32;
|
||||
|
||||
cChunkMap(cWorld* a_World);
|
||||
cChunkMap(cWorld * a_World);
|
||||
~cChunkMap();
|
||||
|
||||
// Broadcast respective packets to all clients of the chunk where the event is taking place
|
||||
@ -364,11 +364,11 @@ public:
|
||||
/** Sets the blockticking to start at the specified block. Only one blocktick per chunk may be set, second call overwrites the first call */
|
||||
void SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
|
||||
/** Make a Mob census, of all mobs, their family, their chunk and theyr distance to closest player */
|
||||
void CollectMobCensus(cMobCensus& a_ToFill);
|
||||
/** Make a Mob census, of all mobs, their family, their chunk and their distance to closest player */
|
||||
void CollectMobCensus(cMobCensus & a_ToFill);
|
||||
|
||||
/** Try to Spawn Monsters inside all Chunks */
|
||||
void SpawnMobs(cMobSpawner& a_MobSpawner);
|
||||
void SpawnMobs(cMobSpawner & a_MobSpawner);
|
||||
|
||||
void Tick(std::chrono::milliseconds a_Dt);
|
||||
|
||||
@ -433,9 +433,10 @@ private:
|
||||
void UnloadUnusedChunks(void);
|
||||
|
||||
/** 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 */
|
||||
void SpawnMobs(cMobSpawner& a_MobSpawner);
|
||||
void SpawnMobs(cMobSpawner & a_MobSpawner);
|
||||
|
||||
void Tick(std::chrono::milliseconds a_Dt);
|
||||
|
||||
|
@ -13,7 +13,7 @@ And once they do, it requests the chunk data and sends it all away, either
|
||||
sends to a specific client (QueueSendChunkTo)
|
||||
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.
|
||||
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.
|
||||
|
||||
A client may remove itself from all direct requests(QueueSendChunkTo()) by calling RemoveClient();
|
||||
|
@ -138,10 +138,10 @@ public:
|
||||
bool operator !=(const cEnchantments & a_Other) const;
|
||||
|
||||
/** Writes the enchantments into the specified NBT writer; begins with the LIST tag of the specified name ("ench" or "StoredEnchantments") */
|
||||
friend void EnchantmentSerializer::WriteToNBTCompound(cEnchantments const& a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName);
|
||||
friend void EnchantmentSerializer::WriteToNBTCompound(const cEnchantments & a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName);
|
||||
|
||||
/** Reads the enchantments from the specified NBT list tag (ench or StoredEnchantments) */
|
||||
friend void EnchantmentSerializer::ParseFromNBT(cEnchantments& a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx);
|
||||
friend void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx);
|
||||
|
||||
protected:
|
||||
/** Maps enchantment ID -> enchantment level */
|
||||
|
@ -21,7 +21,7 @@ inline UInt64 HostToNetwork8(const void * a_Value)
|
||||
|
||||
|
||||
|
||||
inline UInt32 HostToNetwork4(const void* a_Value)
|
||||
inline UInt32 HostToNetwork4(const void * a_Value)
|
||||
{
|
||||
UInt32 buf;
|
||||
memcpy( &buf, a_Value, sizeof( buf));
|
||||
|
@ -529,7 +529,7 @@ void cCaveTunnel::ProcessChunk(
|
||||
|
||||
/*
|
||||
#ifdef _DEBUG
|
||||
// For debugging purposes, outline the shape of the cave using glowstone, *after* carving the entire cave:
|
||||
// For debugging purposes, outline the shape of the cave using glowstone, after carving the entire cave:
|
||||
for (cCaveDefPoints::const_iterator itr = m_Points.begin(), end = m_Points.end(); itr != end; ++itr)
|
||||
{
|
||||
int DifX = itr->m_BlockX - BlockStartX; // substitution for faster calc
|
||||
|
@ -499,7 +499,7 @@ int cInventory::ArmorSlotNumToEntityEquipmentID(short a_ArmorSlotNum)
|
||||
|
||||
|
||||
#if 0
|
||||
bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode /* = 0 */)
|
||||
bool cInventory::AddToBar(cItem & a_Item, const int a_Offset, const int a_Size, bool * a_bChangedSlots, int a_Mode /* = 0 */)
|
||||
{
|
||||
// Fill already present stacks
|
||||
if (a_Mode < 2)
|
||||
|
@ -171,7 +171,7 @@ public:
|
||||
bool LoadFromJson(Json::Value & a_Value);
|
||||
|
||||
protected:
|
||||
bool AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode = 0);
|
||||
bool AddToBar(cItem & a_Item, const int a_Offset, const int a_Size, bool * a_bChangedSlots, int a_Mode = 0);
|
||||
|
||||
cItemGrid m_ArmorSlots;
|
||||
cItemGrid m_InventorySlots;
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision(&a_Player, PlaceMeta)
|
||||
)
|
||||
{
|
||||
// Tried to place a block *into* another?
|
||||
// Tried to place a block into another?
|
||||
// Happens when you place a block aiming at side of block with a torch on it or stem beside it
|
||||
return false;
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ bool cItemHandler::OnPlayerPlace(
|
||||
!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision(&a_Player, PlaceMeta)
|
||||
)
|
||||
{
|
||||
// Tried to place a block *into* another?
|
||||
// Tried to place a block into another?
|
||||
// Happens when you place a block aiming at side of block with a torch on it or stem beside it
|
||||
return false;
|
||||
}
|
||||
|
@ -46,10 +46,10 @@ private:
|
||||
|
||||
|
||||
|
||||
extern void LOG(const char* a_Format, ...) FORMATSTRING(1, 2);
|
||||
extern void LOGINFO(const char* a_Format, ...) FORMATSTRING(1, 2);
|
||||
extern void LOGWARN(const char* a_Format, ...) FORMATSTRING(1, 2);
|
||||
extern void LOGERROR(const char* a_Format, ...) FORMATSTRING(1, 2);
|
||||
extern void LOG (const char * a_Format, ...) FORMATSTRING(1, 2);
|
||||
extern void LOGINFO (const char * a_Format, ...) FORMATSTRING(1, 2);
|
||||
extern void LOGWARN (const char * a_Format, ...) FORMATSTRING(1, 2);
|
||||
extern void LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2);
|
||||
|
||||
|
||||
|
||||
|
@ -591,7 +591,7 @@ void cMap::SendTo(cClientHandle & a_Client)
|
||||
|
||||
for (unsigned int i = 0; i < m_Width; ++i)
|
||||
{
|
||||
const Byte* Colors = &m_Data[i * m_Height];
|
||||
const Byte * Colors = &m_Data[i * m_Height];
|
||||
|
||||
a_Client.SendMapColumn(m_ID, i, 0, Colors, m_Height, m_Scale);
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ public:
|
||||
// MG TODO : code the correct rule (not loaded chunk but short distant from players)
|
||||
void CollectSpawnableChunk(cChunk & a_Chunk);
|
||||
|
||||
/// Collect a mob - it's distance to player, it's family ...
|
||||
void CollectMob(cMonster& a_Monster, cChunk& a_Chunk, double a_Distance);
|
||||
/// Collect a mob - its distance to player, its family ...
|
||||
void CollectMob(cMonster & a_Monster, cChunk & a_Chunk, double a_Distance);
|
||||
|
||||
/// Returns true if the family is capped (i.e. there are more mobs of this family than max)
|
||||
bool IsCapped(cMonster::eFamily a_MobFamily);
|
||||
|
@ -6,7 +6,11 @@
|
||||
#include "Entities/Entity.h"
|
||||
#include "Chunk.h"
|
||||
|
||||
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);
|
||||
tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster);
|
||||
|
@ -16,19 +16,19 @@ protected :
|
||||
// structs used for later maps (see m_MonsterToDistance and m_DistanceToMonster)
|
||||
struct sDistanceAndChunk
|
||||
{
|
||||
sDistanceAndChunk(double a_Distance, cChunk& a_Chunk) : m_Distance(a_Distance), m_Chunk(&a_Chunk) {}
|
||||
sDistanceAndChunk(double a_Distance, cChunk & a_Chunk) : m_Distance(a_Distance), m_Chunk(&a_Chunk) {}
|
||||
double m_Distance;
|
||||
cChunk* m_Chunk;
|
||||
cChunk * m_Chunk;
|
||||
};
|
||||
struct sMonsterAndChunk
|
||||
{
|
||||
sMonsterAndChunk(cEntity& a_Monster, cChunk& a_Chunk) : m_Monster(a_Monster), m_Chunk(a_Chunk) {}
|
||||
cEntity& m_Monster;
|
||||
cChunk& m_Chunk;
|
||||
sMonsterAndChunk(cEntity & a_Monster, cChunk & a_Chunk) : m_Monster(a_Monster), m_Chunk(a_Chunk) {}
|
||||
cEntity & m_Monster;
|
||||
cChunk & m_Chunk;
|
||||
};
|
||||
|
||||
public :
|
||||
typedef std::map<cEntity*, sDistanceAndChunk> tMonsterToDistance;
|
||||
typedef std::map<cEntity *, sDistanceAndChunk> tMonsterToDistance;
|
||||
typedef std::multimap<double, sMonsterAndChunk> tDistanceToMonster;
|
||||
|
||||
protected :
|
||||
@ -50,7 +50,7 @@ public :
|
||||
// count a mob on a specified chunk with specified distance to an unkown player
|
||||
// if the distance is shortest than the one collected, this become the new closest
|
||||
// distance and the chunk become the "hosting" chunk (that is the one that will perform the action)
|
||||
void CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance);
|
||||
void CollectMob(cEntity & a_Monster, cChunk & a_Chunk, double a_Distance);
|
||||
|
||||
// return the mobs that are within the range of distance of the closest player they are
|
||||
// that means that if a mob is 30 m from a player and 150 m from another one. It will be
|
||||
|
@ -321,9 +321,9 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R
|
||||
|
||||
|
||||
|
||||
cMonster* cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize)
|
||||
cMonster * cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int & a_MaxPackSize)
|
||||
{
|
||||
cMonster* toReturn = nullptr;
|
||||
cMonster * toReturn = nullptr;
|
||||
if (m_NewPack)
|
||||
{
|
||||
m_MobType = ChooseMobType(a_Biome);
|
||||
|
@ -39,7 +39,7 @@ public :
|
||||
// if this is the first of a Pack : determine the type of monster
|
||||
// BlockType & BlockMeta are used to decide what kind of Mob can Spawn here
|
||||
// MaxPackSize is set to the maximal size for a pack this type of mob
|
||||
cMonster * TryToSpawnHere(cChunk * a_Chunk, int A_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize);
|
||||
cMonster * TryToSpawnHere(cChunk * a_Chunk, int A_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int & a_MaxPackSize);
|
||||
|
||||
// mark the beginning of a new Pack
|
||||
// all mobs of the same Pack are the same type
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
private:
|
||||
struct sAttributesStruct;
|
||||
struct sMonsterConfigState;
|
||||
sMonsterConfigState* m_pState;
|
||||
sMonsterConfigState * m_pState;
|
||||
void Initialize();
|
||||
} ;
|
||||
|
||||
|
@ -9,7 +9,7 @@ public:
|
||||
void Wait();
|
||||
void Signal();
|
||||
private:
|
||||
void* m_Handle; // HANDLE pointer
|
||||
void * m_Handle; // HANDLE pointer
|
||||
|
||||
#ifndef _WIN32
|
||||
bool m_bNamed;
|
||||
|
@ -68,7 +68,7 @@ const AString & cChunkDataSerializer::Serialize(int a_Version, int a_ChunkX, int
|
||||
|
||||
void cChunkDataSerializer::Serialize29(AString & a_Data)
|
||||
{
|
||||
// TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream)
|
||||
// TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib can stream)
|
||||
|
||||
const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width;
|
||||
const int MetadataOffset = sizeof(m_BlockTypes);
|
||||
@ -126,7 +126,7 @@ void cChunkDataSerializer::Serialize29(AString & a_Data)
|
||||
|
||||
void cChunkDataSerializer::Serialize39(AString & a_Data)
|
||||
{
|
||||
// TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream)
|
||||
// TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib can stream)
|
||||
|
||||
const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width;
|
||||
const int MetadataOffset = sizeof(m_BlockTypes);
|
||||
|
@ -311,8 +311,8 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
|
||||
continue;
|
||||
}
|
||||
FoundAdditionalWorlds = true;
|
||||
cWorld* NewWorld = new cWorld( WorldName.c_str());
|
||||
m_WorldsByName[ WorldName ] = NewWorld;
|
||||
cWorld * NewWorld = new cWorld(WorldName.c_str());
|
||||
m_WorldsByName[WorldName] = NewWorld;
|
||||
} // for i - Worlds
|
||||
|
||||
if (!FoundAdditionalWorlds)
|
||||
|
@ -218,7 +218,7 @@ private:
|
||||
/// Does the actual work of executing a command
|
||||
void DoExecuteConsoleCommand(const AString & a_Cmd);
|
||||
|
||||
static cRoot* s_Root;
|
||||
static cRoot * s_Root;
|
||||
|
||||
static void InputThread(cRoot & a_Params);
|
||||
}; // tolua_export
|
||||
|
@ -286,7 +286,7 @@ cScoreboard::cScoreboard(cWorld * a_World) : m_World(a_World)
|
||||
|
||||
|
||||
|
||||
cObjective* cScoreboard::RegisterObjective(const AString & a_Name, const AString & a_DisplayName, cObjective::eType a_Type)
|
||||
cObjective * cScoreboard::RegisterObjective(const AString & a_Name, const AString & a_DisplayName, cObjective::eType a_Type)
|
||||
{
|
||||
cObjective Objective(a_Name, a_DisplayName, a_Type, m_World);
|
||||
|
||||
@ -471,7 +471,7 @@ cObjective * cScoreboard::GetObjectiveIn(eDisplaySlot a_Slot)
|
||||
|
||||
|
||||
|
||||
bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback)
|
||||
bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback & a_Callback)
|
||||
{
|
||||
cCSLock Lock(m_CSObjectives);
|
||||
|
||||
@ -493,7 +493,7 @@ bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallb
|
||||
|
||||
|
||||
|
||||
bool cScoreboard::ForEachObjective(cObjectiveCallback& a_Callback)
|
||||
bool cScoreboard::ForEachObjective(cObjectiveCallback & a_Callback)
|
||||
{
|
||||
cCSLock Lock(m_CSObjectives);
|
||||
|
||||
@ -512,7 +512,7 @@ bool cScoreboard::ForEachObjective(cObjectiveCallback& a_Callback)
|
||||
|
||||
|
||||
|
||||
bool cScoreboard::ForEachTeam(cTeamCallback& a_Callback)
|
||||
bool cScoreboard::ForEachTeam(cTeamCallback & a_Callback)
|
||||
{
|
||||
cCSLock Lock(m_CSTeams);
|
||||
|
||||
|
@ -262,19 +262,16 @@ public:
|
||||
cTeam * QueryPlayerTeam(const AString & a_Name); // WARNING: O(n logn)
|
||||
|
||||
/** Execute callback for each objective with the specified type
|
||||
Returns true if all objectives processed, false if the callback aborted by returning true.
|
||||
*/
|
||||
bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback);
|
||||
Returns true if all objectives processed, false if the callback aborted by returning true. */
|
||||
bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback & a_Callback);
|
||||
|
||||
/** Execute callback for each objective.
|
||||
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
|
||||
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
|
||||
|
||||
/** Execute callback for each team.
|
||||
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
|
||||
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
|
||||
|
||||
void SetDisplay(cObjective * a_Objective, eDisplaySlot a_Slot);
|
||||
|
||||
|
@ -75,7 +75,7 @@ extern int NoCaseCompare(const AString & s1, const AString & s2); // tolua_expo
|
||||
/** Case-insensitive string comparison that returns a rating of equal-ness between [0 - s1.length()]. */
|
||||
extern size_t RateCompareString(const AString & s1, const AString & s2);
|
||||
|
||||
/** Replaces *each* occurence of iNeedle in iHayStack with iReplaceWith */
|
||||
/** Replaces each occurence of iNeedle in iHayStack with iReplaceWith */
|
||||
extern void ReplaceString(AString & iHayStack, const AString & iNeedle, const AString & iReplaceWith); // tolua_export
|
||||
|
||||
/** Converts a stream of BE shorts into UTF-8 string; returns a_UTF8. */
|
||||
|
@ -64,8 +64,9 @@ private:
|
||||
int GetHitNormal( const Vector3f & start, const Vector3f & end, const Vector3i & a_BlockPos);
|
||||
|
||||
/// Signum function
|
||||
int SigNum( float a_Num);
|
||||
cWorld* m_World;
|
||||
int SigNum(float a_Num);
|
||||
|
||||
cWorld * m_World;
|
||||
|
||||
static const std::array<const Vector3f, 6> & m_NormalTable(void);
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
a_ChestCart->GetWorld()->BroadcastSoundEffect("random.chestopen", a_ChestCart->GetPosX(), a_ChestCart->GetPosY(), a_ChestCart->GetPosZ(), 1, 1);
|
||||
}
|
||||
|
||||
virtual void DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea* a_ClickedArea, bool a_ShouldApply) override
|
||||
virtual void DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply) override
|
||||
{
|
||||
cSlotAreas AreasInOrder;
|
||||
|
||||
|
@ -531,7 +531,7 @@ AString cWebAdmin::GetDefaultPage(void)
|
||||
|
||||
|
||||
|
||||
AString cWebAdmin::GetBaseURL( const AString& a_URL)
|
||||
AString cWebAdmin::GetBaseURL(const AString & a_URL)
|
||||
{
|
||||
return GetBaseURL(StringSplit(a_URL, "/"));
|
||||
}
|
||||
|
@ -1351,7 +1351,7 @@ bool cWorld::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBloc
|
||||
|
||||
|
||||
|
||||
bool cWorld::DoWithBeaconAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBeaconCallback& a_Callback)
|
||||
bool cWorld::DoWithBeaconAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBeaconCallback & a_Callback)
|
||||
{
|
||||
return m_ChunkMap->DoWithBeaconAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "Enchantments.h"
|
||||
#include "FastNBT.h"
|
||||
|
||||
void EnchantmentSerializer::WriteToNBTCompound(cEnchantments const& a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName)
|
||||
void EnchantmentSerializer::WriteToNBTCompound(const cEnchantments & a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName)
|
||||
{
|
||||
// Write the enchantments into the specified NBT writer
|
||||
// begin with the LIST tag of the specified name ("ench" or "StoredEnchantments")
|
||||
@ -25,7 +25,7 @@ void EnchantmentSerializer::WriteToNBTCompound(cEnchantments const& a_Enchantmen
|
||||
|
||||
|
||||
|
||||
void EnchantmentSerializer::ParseFromNBT(cEnchantments& a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx)
|
||||
void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx)
|
||||
{
|
||||
// Read the enchantments from the specified NBT list tag (ench or StoredEnchantments)
|
||||
|
||||
|
@ -9,9 +9,9 @@ namespace EnchantmentSerializer
|
||||
{
|
||||
|
||||
/// Writes the enchantments into the specified NBT writer; begins with the LIST tag of the specified name ("ench" or "StoredEnchantments")
|
||||
void WriteToNBTCompound(cEnchantments const& a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName);
|
||||
void WriteToNBTCompound(const cEnchantments & a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName);
|
||||
|
||||
/// Reads the enchantments from the specified NBT list tag (ench or StoredEnchantments)
|
||||
void ParseFromNBT(cEnchantments& a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx);
|
||||
void ParseFromNBT(cEnchantments & a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx);
|
||||
|
||||
};
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
|
||||
|
||||
cMapSerializer::cMapSerializer(const AString& a_WorldName, cMap * a_Map)
|
||||
: m_Map(a_Map)
|
||||
cMapSerializer::cMapSerializer(const AString & a_WorldName, cMap * a_Map):
|
||||
m_Map(a_Map)
|
||||
{
|
||||
AString DataPath;
|
||||
Printf(DataPath, "%s%cdata", a_WorldName.c_str(), cFile::PathSeparator);
|
||||
|
@ -26,7 +26,7 @@ class cMapSerializer
|
||||
{
|
||||
public:
|
||||
|
||||
cMapSerializer(const AString& a_WorldName, cMap * a_Map);
|
||||
cMapSerializer(const AString & a_WorldName, cMap * a_Map);
|
||||
|
||||
/** Try to load the map */
|
||||
bool Load(void);
|
||||
|
@ -14,13 +14,13 @@
|
||||
|
||||
|
||||
|
||||
cScoreboardSerializer::cScoreboardSerializer(const AString & a_WorldName, cScoreboard* a_ScoreBoard)
|
||||
: m_ScoreBoard(a_ScoreBoard)
|
||||
cScoreboardSerializer::cScoreboardSerializer(const AString & a_WorldName, cScoreboard * a_ScoreBoard):
|
||||
m_ScoreBoard(a_ScoreBoard)
|
||||
{
|
||||
AString DataPath;
|
||||
Printf(DataPath, "%s%cdata", a_WorldName.c_str(), cFile::PathSeparator);
|
||||
|
||||
m_Path = DataPath + "/scoreboard.dat";
|
||||
m_Path = DataPath + cFile::PathSeparator + "scoreboard.dat";
|
||||
|
||||
cFile::CreateFolder(FILE_IO_PREFIX + DataPath);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class cScoreboardSerializer
|
||||
{
|
||||
public:
|
||||
|
||||
cScoreboardSerializer(const AString & a_WorldName, cScoreboard* a_ScoreBoard);
|
||||
cScoreboardSerializer(const AString & a_WorldName, cScoreboard * a_ScoreBoard);
|
||||
|
||||
/// Try to load the scoreboard
|
||||
bool Load(void);
|
||||
@ -40,7 +40,7 @@ private:
|
||||
|
||||
bool LoadScoreboardFromNBT(const cParsedNBT & a_NBT);
|
||||
|
||||
cScoreboard* m_ScoreBoard;
|
||||
cScoreboard * m_ScoreBoard;
|
||||
|
||||
AString m_Path;
|
||||
|
||||
|
@ -43,7 +43,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
cStatManager* m_Manager;
|
||||
cStatManager * m_Manager;
|
||||
|
||||
AString m_Path;
|
||||
|
||||
|
@ -3148,7 +3148,7 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri
|
||||
}
|
||||
|
||||
// Store the header:
|
||||
ChunkSize = ((u_long)a_Data.size() + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size *up* to nearest 4KB sector, make it a sector number
|
||||
ChunkSize = ((u_long)a_Data.size() + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size up to nearest 4KB sector, make it a sector number
|
||||
if (ChunkSize > 255)
|
||||
{
|
||||
LOGWARNING("Cannot save chunk [%d, %d], the data is too large (%u KiB, maximum is 1024 KiB). Remove some entities and retry.",
|
||||
|
Loading…
Reference in New Issue
Block a user