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;
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ void cLuaWindow::Destroy(void)
|
||||
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)
|
||||
{
|
||||
|
@ -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,7 +2593,7 @@ 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);
|
||||
HTTPRequest * self = reinterpret_cast<HTTPRequest *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||
std::map<std::string, HTTPFormData> & FormData = self->FormData;
|
||||
|
||||
lua_newtable(tolua_S);
|
||||
|
@ -166,10 +166,18 @@ local g_ViolationPatterns =
|
||||
-- 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-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 &"},
|
||||
}
|
||||
|
||||
|
||||
|
@ -477,21 +477,21 @@ 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)
|
||||
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());
|
||||
}
|
||||
|
@ -2719,9 +2719,9 @@ void cChunkMap::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
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
|
||||
}
|
||||
|
||||
@ -2733,9 +2733,9 @@ void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill)
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ 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 */
|
||||
/** 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 */
|
||||
@ -434,6 +434,7 @@ private:
|
||||
|
||||
/** Collect a mob census, of all mobs, their megatype, their chunk and their distance o closest player */
|
||||
void CollectMobCensus(cMobCensus & a_ToFill);
|
||||
|
||||
/** Try to Spawn Monsters inside all Chunks */
|
||||
void SpawnMobs(cMobSpawner & a_MobSpawner);
|
||||
|
||||
|
@ -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,7 +138,7 @@ 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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ 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 ...
|
||||
/// 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)
|
||||
|
@ -6,6 +6,10 @@
|
||||
#include "Entities/Entity.h"
|
||||
#include "Chunk.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cMobProximityCounter::CollectMob(cEntity & a_Monster, cChunk & a_Chunk, double a_Distance)
|
||||
{
|
||||
// LOGD("Collecting monster %s, with distance %f", a_Monster->GetClass(), a_Distance);
|
||||
|
@ -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);
|
||||
|
@ -262,18 +262,15 @@ 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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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. */
|
||||
|
@ -65,6 +65,7 @@ private:
|
||||
|
||||
/// Signum function
|
||||
int SigNum(float a_Num);
|
||||
|
||||
cWorld * m_World;
|
||||
|
||||
static const std::array<const Vector3f, 6> & m_NormalTable(void);
|
||||
|
@ -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")
|
||||
|
@ -9,7 +9,7 @@ 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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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