1
0
Fork 0

Fixed tabs used for alignment.

This commit is contained in:
madmaxoft 2014-07-17 23:15:53 +02:00
parent d0cc9aedb3
commit c03161f75d
29 changed files with 115 additions and 99 deletions

View File

@ -33,8 +33,8 @@ public:
if ((BlockBeforePlacement == E_BLOCK_SNOW) && (MetaBeforePlacement < 7))
{
// Only increment if:
// A snow block was already there (not first time placement) AND
// Height is smaller than 7, the maximum possible height
// - A snow block was already there (not first time placement) AND
// - Height is smaller than 7, the maximum possible height
MetaBeforePlacement++;
}

View File

@ -345,7 +345,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
switch (KnockbackLevel)
{
case 1: AdditionalSpeed.Set(5, 0.3, 5); break;
case 2: AdditionalSpeed.Set(8, 0.3, 8); break;
case 2: AdditionalSpeed.Set(8, 0.3, 8); break;
default: break;
}
AddSpeed(a_TDI.Knockback + AdditionalSpeed);

View File

@ -485,7 +485,7 @@ protected:
/// Whether the entity is capable of taking fire or lava damage.
bool m_IsFireproof;
/// Time, in ticks, since the last damage dealt by being on fire. Valid only if on fire (IsOnFire())
int m_TicksSinceLastBurnDamage;

View File

@ -6,7 +6,7 @@
cExpOrb::cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward)
: cEntity(etExpOrb, a_X, a_Y, a_Z, 0.98, 0.98)
: cEntity(etExpOrb, a_X, a_Y, a_Z, 0.98, 0.98)
, m_Reward(a_Reward)
, m_Timer(0.f)
{
@ -19,7 +19,7 @@ cExpOrb::cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward)
cExpOrb::cExpOrb(const Vector3d & a_Pos, int a_Reward)
: cEntity(etExpOrb, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.98)
: cEntity(etExpOrb, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.98)
, m_Reward(a_Reward)
, m_Timer(0.f)
{

View File

@ -10,7 +10,7 @@
cHangingEntity::cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z)
: cEntity(a_EntityType, a_X, a_Y, a_Z, 0.8, 0.8)
: cEntity(a_EntityType, a_X, a_Y, a_Z, 0.8, 0.8)
, m_BlockFace(a_BlockFace)
{
SetMaxHealth(1);

View File

@ -10,7 +10,7 @@
cItemFrame::cItemFrame(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z)
: cHangingEntity(etItemFrame, a_BlockFace, a_X, a_Y, a_Z)
: cHangingEntity(etItemFrame, a_BlockFace, a_X, a_Y, a_Z)
, m_Item(E_BLOCK_AIR)
, m_Rotation(0)
{

View File

@ -85,7 +85,7 @@ protected:
cPickup::cPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_Item, bool IsPlayerCreated, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */)
: cEntity(etPickup, a_PosX, a_PosY, a_PosZ, 0.2, 0.2)
: cEntity(etPickup, a_PosX, a_PosY, a_PosZ, 0.2, 0.2)
, m_Timer(0.f)
, m_Item(a_Item)
, m_bCollected(false)

View File

@ -32,7 +32,7 @@ public:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
bool CollectedBy(cPlayer * a_Dest); // tolua_export
bool CollectedBy(cPlayer * a_Dest); // tolua_export
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;

View File

@ -1347,7 +1347,7 @@ void cPlayer::SetVisible(bool a_bVisible)
if (!a_bVisible && m_bVisible)
{
m_bVisible = false;
m_World->BroadcastDestroyEntity(*this, m_ClientHandle); // Destroy on all clients
m_World->BroadcastDestroyEntity(*this, m_ClientHandle); // Destroy on all clients
}
}
@ -1455,7 +1455,7 @@ bool cPlayer::IsInGroup( const AString & a_Group )
void cPlayer::ResolvePermissions()
{
m_ResolvedPermissions.clear(); // Start with an empty map yo~
m_ResolvedPermissions.clear(); // Start with an empty map
// Copy all player specific permissions into the resolved permissions map
for( PermissionMap::iterator itr = m_Permissions.begin(); itr != m_Permissions.end(); ++itr )
@ -1483,7 +1483,7 @@ void cPlayer::ResolveGroups()
m_ResolvedGroups.clear();
// Get a complete resolved list of all groups the player is in
std::map< cGroup*, bool > AllGroups; // Use a map, because it's faster than iterating through a list to find duplicates
std::map< cGroup*, bool > AllGroups; // Use a map, because it's faster than iterating through a list to find duplicates
GroupList ToIterate;
for( GroupList::iterator GroupItr = m_Groups.begin(); GroupItr != m_Groups.end(); ++GroupItr )
{
@ -1501,7 +1501,7 @@ void cPlayer::ResolveGroups()
else
{
AllGroups[ CurrentGroup ] = true;
m_ResolvedGroups.push_back( CurrentGroup ); // Add group to resolved list
m_ResolvedGroups.push_back( CurrentGroup ); // Add group to resolved list
const cGroup::GroupList & Inherits = CurrentGroup->GetInherits();
for( cGroup::GroupList::const_iterator itr = Inherits.begin(); itr != Inherits.end(); ++itr )
{

View File

@ -119,11 +119,11 @@ public:
void SetTouchGround( bool a_bTouchGround );
inline void SetStance( const double a_Stance ) { m_Stance = a_Stance; }
double GetEyeHeight(void) const; // tolua_export
Vector3d GetEyePosition(void) const; // tolua_export
double GetEyeHeight(void) const; // tolua_export
Vector3d GetEyePosition(void) const; // tolua_export
inline bool IsOnGround(void) const {return m_bTouchGround; } // tolua_export
inline double GetStance(void) const { return GetPosY() + 1.62; } // tolua_export // TODO: Proper stance when crouching etc.
inline cInventory & GetInventory(void) { return m_Inventory; } // tolua_export
inline cInventory & GetInventory(void) { return m_Inventory; } // tolua_export
inline const cInventory & GetInventory(void) const { return m_Inventory; }
/** Gets the contents of the player's associated enderchest */
@ -239,15 +239,15 @@ public:
typedef std::list< std::string > StringList;
/** Adds a player to existing group or creates a new group when it doesn't exist */
void AddToGroup( const AString & a_GroupName ); // tolua_export
void AddToGroup( const AString & a_GroupName ); // tolua_export
/** Removes a player from the group, resolves permissions and group inheritance (case sensitive) */
void RemoveFromGroup( const AString & a_GroupName ); // tolua_export
void RemoveFromGroup( const AString & a_GroupName ); // tolua_export
bool HasPermission( const AString & a_Permission ); // tolua_export
const GroupList & GetGroups() { return m_Groups; } // >> EXPORTED IN MANUALBINDINGS <<
StringList GetResolvedPermissions(); // >> EXPORTED IN MANUALBINDINGS <<
bool IsInGroup( const AString & a_Group ); // tolua_export
bool HasPermission( const AString & a_Permission ); // tolua_export
const GroupList & GetGroups() { return m_Groups; } // >> EXPORTED IN MANUALBINDINGS <<
StringList GetResolvedPermissions(); // >> EXPORTED IN MANUALBINDINGS <<
bool IsInGroup( const AString & a_Group ); // tolua_export
// tolua_begin
@ -326,10 +326,10 @@ public:
virtual void Killed(cEntity * a_Victim) override;
void Respawn(void); // tolua_export
void Respawn(void); // tolua_export
void SetVisible( bool a_bVisible ); // tolua_export
bool IsVisible(void) const { return m_bVisible; } // tolua_export
void SetVisible( bool a_bVisible ); // tolua_export
bool IsVisible(void) const { return m_bVisible; } // tolua_export
/** Moves the player to the specified world.
Returns true if successful, false on failure (world not found). */
@ -345,7 +345,7 @@ public:
Returns true on success, false on failure. */
bool LoadFromFile(const AString & a_FileName);
void LoadPermissionsFromDisk(void); // tolua_export
void LoadPermissionsFromDisk(void); // tolua_export
const AString & GetLoadedWorldName() { return m_LoadedWorldName; }

View File

@ -555,14 +555,14 @@ AString cCaveTunnel::ExportAsSVG(int a_Color, int a_OffsetX, int a_OffsetZ) cons
{
AString SVG;
SVG.reserve(m_Points.size() * 20 + 200);
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#%06x;stroke-width:1px;\"\nd=\"", a_Color);
char Prefix = 'M'; // The first point needs "M" prefix, all the others need "L"
for (cCaveDefPoints::const_iterator itr = m_Points.begin(); itr != m_Points.end(); ++itr)
{
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#%06x;stroke-width:1px;\"\nd=\"", a_Color);
char Prefix = 'M'; // The first point needs "M" prefix, all the others need "L"
for (cCaveDefPoints::const_iterator itr = m_Points.begin(); itr != m_Points.end(); ++itr)
{
AppendPrintf(SVG, "%c %d,%d ", Prefix, a_OffsetX + itr->m_BlockX, a_OffsetZ + itr->m_BlockZ);
Prefix = 'L';
}
SVG.append("\"/>\n");
}
SVG.append("\"/>\n");
return SVG;
}
#endif // _DEBUG

View File

@ -228,10 +228,10 @@ void cChunkGenerator::Execute(void)
continue;
}
cChunkCoords coords = m_Queue.front(); // Get next coord from queue
m_Queue.erase( m_Queue.begin() ); // Remove coordinate from queue
cChunkCoords coords = m_Queue.front(); // Get next coord from queue
m_Queue.erase( m_Queue.begin() ); // Remove coordinate from queue
bool SkipEnabled = (m_Queue.size() > QUEUE_SKIP_LIMIT);
Lock.Unlock(); // Unlock ASAP
Lock.Unlock(); // Unlock ASAP
m_evtRemoved.Set();
// Display perf info once in a while:

View File

@ -199,7 +199,7 @@ protected:
// cFinishGen override:
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
/// Tries to place a spring at the specified coords, checks neighbors. Returns true if successful
/// Tries to place a spring at the specified coords, checks neighbors. Returns true if successful
bool TryPlaceSpring(cChunkDesc & a_ChunkDesc, int x, int y, int z);
} ;

View File

@ -283,25 +283,25 @@ void cStructGenRavines::cRavine::FinishLinear(void)
AString cStructGenRavines::cRavine::ExportAsSVG(int a_Color, int a_OffsetX, int a_OffsetZ) const
{
AString SVG;
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#%06x;stroke-width:1px;\"\nd=\"", a_Color);
char Prefix = 'M'; // The first point needs "M" prefix, all the others need "L"
for (cRavDefPoints::const_iterator itr = m_Points.begin(); itr != m_Points.end(); ++itr)
{
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#%06x;stroke-width:1px;\"\nd=\"", a_Color);
char Prefix = 'M'; // The first point needs "M" prefix, all the others need "L"
for (cRavDefPoints::const_iterator itr = m_Points.begin(); itr != m_Points.end(); ++itr)
{
AppendPrintf(SVG, "%c %d,%d ", Prefix, a_OffsetX + itr->m_BlockX, a_OffsetZ + itr->m_BlockZ);
Prefix = 'L';
}
SVG.append("\"/>\n");
// Base point highlight:
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#ff0000;stroke-width:1px;\"\nd=\"M %d,%d L %d,%d\"/>\n",
}
SVG.append("\"/>\n");
// Base point highlight:
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#ff0000;stroke-width:1px;\"\nd=\"M %d,%d L %d,%d\"/>\n",
a_OffsetX + m_OriginX - 5, a_OffsetZ + m_OriginZ, a_OffsetX + m_OriginX + 5, a_OffsetZ + m_OriginZ
);
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#ff0000;stroke-width:1px;\"\nd=\"M %d,%d L %d,%d\"/>\n",
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#ff0000;stroke-width:1px;\"\nd=\"M %d,%d L %d,%d\"/>\n",
a_OffsetX + m_OriginX, a_OffsetZ + m_OriginZ - 5, a_OffsetX + m_OriginX, a_OffsetZ + m_OriginZ + 5
);
// A gray line from the base point to the first point of the ravine, for identification:
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#cfcfcf;stroke-width:1px;\"\nd=\"M %d,%d L %d,%d\"/>\n",
AppendPrintf(SVG, "<path style=\"fill:none;stroke:#cfcfcf;stroke-width:1px;\"\nd=\"M %d,%d L %d,%d\"/>\n",
a_OffsetX + m_OriginX, a_OffsetZ + m_OriginZ, a_OffsetX + m_Points.front().m_BlockX, a_OffsetZ + m_Points.front().m_BlockZ
);

View File

@ -95,7 +95,7 @@ public:
return ((const cPrefab &)a_NewPiece).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
}
} ;
};

View File

@ -63,7 +63,7 @@ class cSweepEntityCallback :
{
public:
cSweepEntityCallback(Vector3d a_PlayerPos) :
m_PlayerPos(a_PlayerPos)
m_PlayerPos(a_PlayerPos)
{
}

View File

@ -459,13 +459,13 @@ bool cItemHandler::IsTool()
{
// TODO: Rewrite this to list all tools specifically
return
(m_ItemType >= 256 && m_ItemType <= 259)
|| (m_ItemType == 261)
|| (m_ItemType >= 267 && m_ItemType <= 279)
|| (m_ItemType >= 283 && m_ItemType <= 286)
|| (m_ItemType >= 290 && m_ItemType <= 294)
|| (m_ItemType == 325)
|| (m_ItemType == 346);
((m_ItemType >= 256) && (m_ItemType <= 259)) ||
(m_ItemType == 261) ||
((m_ItemType >= 267) && (m_ItemType <= 279)) ||
((m_ItemType >= 283) && (m_ItemType <= 286)) ||
((m_ItemType >= 290) && (m_ItemType <= 294)) ||
(m_ItemType == 325) ||
(m_ItemType == 346);
}

View File

@ -325,7 +325,7 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
AddSpeedZ(Distance.z);
if (m_EMState == ESCAPING)
{ // Runs Faster when escaping :D otherwise they just walk away
{ // Runs Faster when escaping :D otherwise they just walk away
SetSpeedX (GetSpeedX() * 2.f);
SetSpeedZ (GetSpeedZ() * 2.f);
}

View File

@ -44,48 +44,64 @@ cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /*
#endif
}
cSemaphore::~cSemaphore()
{
#ifdef _WIN32
CloseHandle( m_Handle );
#else
if( m_bNamed )
{
if( sem_close( (sem_t*)m_Handle ) != 0 )
{
LOG("ERROR: Could not close cSemaphore. (%i)", errno);
}
}
else
{
sem_destroy( (sem_t*)m_Handle );
delete (sem_t*)m_Handle;
}
if( m_bNamed )
{
if( sem_close( (sem_t*)m_Handle ) != 0 )
{
LOG("ERROR: Could not close cSemaphore. (%i)", errno);
}
}
else
{
sem_destroy( (sem_t*)m_Handle );
delete (sem_t*)m_Handle;
}
m_Handle = 0;
#endif
}
void cSemaphore::Wait()
{
#ifndef _WIN32
if( sem_wait( (sem_t*)m_Handle ) != 0)
{
LOG("ERROR: Could not wait for cSemaphore. (%i)", errno);
}
if( sem_wait( (sem_t*)m_Handle ) != 0)
{
LOG("ERROR: Could not wait for cSemaphore. (%i)", errno);
}
#else
WaitForSingleObject( m_Handle, INFINITE);
#endif
}
void cSemaphore::Signal()
{
#ifndef _WIN32
if( sem_post( (sem_t*)m_Handle ) != 0 )
{
LOG("ERROR: Could not signal cSemaphore. (%i)", errno);
LOG("ERROR: Could not signal cSemaphore. (%i)", errno);
}
#else
ReleaseSemaphore( m_Handle, 1, NULL );
#endif
}

View File

@ -14,6 +14,6 @@ void cSleep::MilliSleep( unsigned int a_MilliSeconds )
#ifdef _WIN32
Sleep(a_MilliSeconds); // Don't tick too much
#else
usleep(a_MilliSeconds*1000);
usleep(a_MilliSeconds*1000);
#endif
}

View File

@ -91,7 +91,7 @@ void cThread::Start( bool a_bWaitOnDelete /* = true */ )
LOGERROR("ERROR: Could not create thread!");
#else
DWORD ThreadID = 0;
HANDLE hThread = CreateThread( 0 // security
HANDLE hThread = CreateThread(NULL // security
,0 // stack size
, (LPTHREAD_START_ROUTINE) MyThread // function name
,this // parameters

View File

@ -760,7 +760,7 @@ void cProtocol125::SendPlayerMoveLook(void)
);
*/
WriteByte (PACKET_PLAYER_MOVE_LOOK);
WriteByte(PACKET_PLAYER_MOVE_LOOK);
cPlayer * Player = m_Client->GetPlayer();
WriteDouble(Player->GetPosX());
WriteDouble(Player->GetStance() + 0.03); // Add a small amount so that the player doesn't start inside a block
@ -1005,10 +1005,10 @@ void cProtocol125::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp
void cProtocol125::SendStatistics(const cStatManager & a_Manager)
{
/* NOTE:
* Versions prior to minecraft 1.7 use an incremental statistic sync
* method. The current setup does not allow us to implement that, because
* of performance considerations.
*/
Versions prior to minecraft 1.7 use an incremental statistic sync
method. The current setup does not allow us to implement that, because
of performance considerations.
*/
#if 0
for (unsigned int i = 0; i < (unsigned int)statCount; ++i)
{
@ -1121,7 +1121,7 @@ void cProtocol125::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_Bloc
cCSLock Lock(m_CSPacket);
WriteByte(PACKET_USE_BED);
WriteInt (a_Entity.GetUniqueID());
WriteByte(0); // Unknown byte only 0 has been observed
WriteByte(0); // Unknown byte only 0 has been observed
WriteInt (a_BlockX);
WriteByte((Byte)a_BlockY);
WriteInt (a_BlockZ);
@ -1344,11 +1344,11 @@ int cProtocol125::ParseArmAnim(void)
int cProtocol125::ParseBlockDig(void)
{
HANDLE_PACKET_READ(ReadChar, char, Status);
HANDLE_PACKET_READ(ReadChar, char, Status);
HANDLE_PACKET_READ(ReadBEInt, int, PosX);
HANDLE_PACKET_READ(ReadByte, Byte, PosY);
HANDLE_PACKET_READ(ReadByte, Byte, PosY);
HANDLE_PACKET_READ(ReadBEInt, int, PosZ);
HANDLE_PACKET_READ(ReadChar, char, BlockFace);
HANDLE_PACKET_READ(ReadChar, char, BlockFace);
m_Client->HandleLeftClick(PosX, PosY, PosZ, static_cast<eBlockFace>(BlockFace), Status);
return PARSE_OK;
}

View File

@ -2707,9 +2707,10 @@ void cProtocol172::cPacketizer::WriteEntityMetadata(const cEntity & a_Entity)
// The following expression makes Minecarts shake more with less health or higher damage taken
// It gets half the maximum health, and takes it away from the current health minus the half health:
/* Health: 5 | 3 - (5 - 3) = 1 (shake power)
Health: 3 | 3 - (3 - 3) = 3
Health: 1 | 3 - (1 - 3) = 5
/*
Health: 5 | 3 - (5 - 3) = 1 (shake power)
Health: 3 | 3 - (3 - 3) = 3
Health: 1 | 3 - (1 - 3) = 5
*/
WriteInt((((a_Entity.GetMaxHealth() / 2) - (a_Entity.GetHealth() - (a_Entity.GetMaxHealth() / 2))) * ((const cMinecart &)a_Entity).LastDamage()) * 4);
WriteByte(0x52);

View File

@ -70,7 +70,7 @@ protected:
/*
Slots:
| 0 | 1 | ... | m_AddSlotNum | m_SimSlotNum | ... | m_TickDelay - 1 |
adding blocks here ^ | ^ simulating here
| adding blocks here ^ | ^ simulating here
*/
/// Called from SimulateChunk() to simulate each block in one slot of blocks. Descendants override this method to provide custom simulation.

View File

@ -137,7 +137,7 @@ Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a
return Y_MINUS;
*/
NIBBLETYPE LowestPoint = m_World.GetBlockMeta(a_X, a_Y, a_Z); // Current Block Meta so only lower points will be counted
NIBBLETYPE LowestPoint = m_World.GetBlockMeta(a_X, a_Y, a_Z); // Current Block Meta so only lower points will be counted
int X = 0, Z = 0; // Lowest Pos will be stored here
if (IsAllowedBlock(m_World.GetBlock(a_X, a_Y + 1, a_Z)) && a_Over) // check for upper block to flow because this also affects the flowing direction

View File

@ -739,7 +739,7 @@ void cIncrementalRedstoneSimulator::HandleRedstoneRepeater(int a_RelBlockX, int
// Create a variable holding my meta to avoid multiple lookups.
NIBBLETYPE a_Meta = m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
bool IsOn = (a_MyState == E_BLOCK_REDSTONE_REPEATER_ON);
if (!IsRepeaterLocked(a_RelBlockX, a_RelBlockY, a_RelBlockZ, a_Meta)) // If we're locked, change nothing. Otherwise:
{
bool IsSelfPowered = IsRepeaterPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, a_Meta);

View File

@ -294,7 +294,7 @@ private:
case E_BLOCK_WOODEN_PRESSURE_PLATE:
case E_BLOCK_PISTON:
{
return true;
return true;
}
default: return false;
}

View File

@ -135,7 +135,7 @@ class cSlotAreaHotBar :
typedef cSlotAreaInventoryBase super;
public:
cSlotAreaHotBar(cWindow & a_ParentWindow) :
cSlotAreaHotBar(cWindow & a_ParentWindow) :
cSlotAreaInventoryBase(cInventory::invHotbarCount, cInventory::invHotbarOffset, a_ParentWindow)
{
}
@ -150,7 +150,7 @@ class cSlotAreaArmor :
public cSlotAreaInventoryBase
{
public:
cSlotAreaArmor(cWindow & a_ParentWindow) :
cSlotAreaArmor(cWindow & a_ParentWindow) :
cSlotAreaInventoryBase(cInventory::invArmorCount, cInventory::invArmorOffset, a_ParentWindow)
{
}

View File

@ -52,10 +52,9 @@ private:
/** Utility class used to serialize item ID counts.
*
* In order to perform bounds checking (while loading),
* the last registered ID of each item is serialized to an NBT file.
*/
In order to perform bounds checking (while loading),
the last registered ID of each item is serialized to an NBT file.
*/
class cIDCountSerializer
{
public: