Fixed spaces around single-line comments.
There should be at least two spaces in front and one space after //-style comments.
This commit is contained in:
parent
993fd14ddf
commit
7fff12bfac
@ -171,7 +171,7 @@ enum ENUM_BLOCK_ID
|
||||
E_BLOCK_DROPPER = 158,
|
||||
E_BLOCK_STAINED_CLAY = 159,
|
||||
E_BLOCK_STAINED_GLASS_PANE = 160,
|
||||
E_BLOCK_NEW_LEAVES = 161, // Acacia and Dark Oak IDs in Minecraft 1.7.x
|
||||
E_BLOCK_NEW_LEAVES = 161, // Acacia and Dark Oak IDs in Minecraft 1.7.x
|
||||
E_BLOCK_NEW_LOG = 162,
|
||||
E_BLOCK_ACACIA_WOOD_STAIRS = 163,
|
||||
E_BLOCK_DARK_OAK_WOOD_STAIRS = 164,
|
||||
|
@ -81,7 +81,7 @@ protected:
|
||||
|
||||
/** Initializes the specified BlockInfo structures with block-specific values. */
|
||||
static void Initialize(cBlockInfoArray & a_BlockInfos);
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -448,7 +448,7 @@ void cChunk::CollectMobCensus(cMobCensus& toFill)
|
||||
Vector3d currentPosition;
|
||||
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
|
||||
{
|
||||
//LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
|
||||
// LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
|
||||
if ((*itr)->IsMob())
|
||||
{
|
||||
cMonster& Monster = (cMonster&)(**itr);
|
||||
@ -698,13 +698,13 @@ void cChunk::ProcessQueuedSetBlocks(void)
|
||||
{
|
||||
if (itr->m_Tick <= CurrTick)
|
||||
{
|
||||
if (itr->m_PreviousType != E_BLOCK_AIR) // PreviousType defaults to 0 if not specified
|
||||
if (itr->m_PreviousType != E_BLOCK_AIR) // PreviousType defaults to 0 if not specified
|
||||
{
|
||||
if (GetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ) == itr->m_PreviousType)
|
||||
{
|
||||
// Current world age is bigger than/equal to target world age - delay time reached AND
|
||||
// Previous block type was the same as current block type (to prevent duplication)
|
||||
SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); // SetMeta doesn't send to client
|
||||
SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); // SetMeta doesn't send to client
|
||||
itr = m_SetBlockQueue.erase(itr);
|
||||
LOGD("Successfully set queued block - previous and current types matched");
|
||||
}
|
||||
@ -810,7 +810,7 @@ void cChunk::TickBlocks(void)
|
||||
|
||||
if (m_BlockTickY > cChunkDef::GetHeight(m_HeightMap, m_BlockTickX, m_BlockTickZ))
|
||||
{
|
||||
continue; // It's all air up here
|
||||
continue; // It's all air up here
|
||||
}
|
||||
|
||||
cBlockHandler * Handler = BlockHandler(GetBlock(m_BlockTickX, m_BlockTickY, m_BlockTickZ));
|
||||
@ -1530,11 +1530,11 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
|
||||
|
||||
m_ChunkData.SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType);
|
||||
|
||||
if ( // Queue block to be sent only if ...
|
||||
a_SendToClients && // ... we are told to do so AND ...
|
||||
if ( // Queue block to be sent only if ...
|
||||
a_SendToClients && // ... we are told to do so AND ...
|
||||
(
|
||||
(OldBlockMeta != a_BlockMeta) || // ... the meta value is different OR ...
|
||||
!( // ... the old and new blocktypes AREN'T liquids (because client doesn't need to distinguish betwixt them); see below for specifics:
|
||||
(OldBlockMeta != a_BlockMeta) || // ... the meta value is different OR ...
|
||||
!( // ... the old and new blocktypes AREN'T liquids (because client doesn't need to distinguish betwixt them); see below for specifics:
|
||||
((OldBlockType == E_BLOCK_STATIONARY_WATER) && (a_BlockType == E_BLOCK_WATER)) || // Replacing stationary water with water
|
||||
((OldBlockType == E_BLOCK_WATER) && (a_BlockType == E_BLOCK_STATIONARY_WATER)) || // Replacing water with stationary water
|
||||
((OldBlockType == E_BLOCK_STATIONARY_LAVA) && (a_BlockType == E_BLOCK_LAVA)) || // Replacing stationary water with water
|
||||
@ -1727,7 +1727,7 @@ void cChunk::CollectPickupsByPlayer(cPlayer * a_Player)
|
||||
{
|
||||
if ((!(*itr)->IsPickup()) && (!(*itr)->IsProjectile()))
|
||||
{
|
||||
continue; // Only pickups and projectiles
|
||||
continue; // Only pickups and projectiles can be picked up
|
||||
}
|
||||
float DiffX = (float)((*itr)->GetPosX() - PosX );
|
||||
float DiffY = (float)((*itr)->GetPosY() - PosY );
|
||||
@ -2152,7 +2152,7 @@ bool cChunk::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallb
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (((*itr)->GetBlockType() != E_BLOCK_CHEST) && ((*itr)->GetBlockType() != E_BLOCK_TRAPPED_CHEST)) // Trapped chests use normal chests' handlers
|
||||
if (((*itr)->GetBlockType() != E_BLOCK_CHEST) && ((*itr)->GetBlockType() != E_BLOCK_TRAPPED_CHEST)) // Trapped chests use normal chests' handlers
|
||||
{
|
||||
// There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out
|
||||
return false;
|
||||
@ -2481,7 +2481,7 @@ BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
|
||||
)
|
||||
{
|
||||
ASSERT(!"GetBlock(x, y, z) out of bounds!");
|
||||
return 0; // Clip
|
||||
return 0; // Clip
|
||||
}
|
||||
|
||||
return m_ChunkData.GetBlock(a_RelX, a_RelY, a_RelZ);
|
||||
|
@ -274,7 +274,6 @@ public:
|
||||
|
||||
void UseBlockEntity(cPlayer * a_Player, int a_X, int a_Y, int a_Z); // [x, y, z] in world block coords
|
||||
|
||||
void CalculateLighting(); // Recalculate right now
|
||||
void CalculateHeightmap(const BLOCKTYPE * a_BlockTypes);
|
||||
|
||||
// Broadcast various packets to all clients of this chunk:
|
||||
|
@ -138,9 +138,9 @@ public:
|
||||
{
|
||||
#if AXIS_ORDER == AXIS_ORDER_XZY
|
||||
// For some reason, NOT using the Horner schema is faster. Weird.
|
||||
return x + (z * cChunkDef::Width) + (y * cChunkDef::Width * cChunkDef::Width); // 1.2 is XZY
|
||||
return x + (z * cChunkDef::Width) + (y * cChunkDef::Width * cChunkDef::Width); // 1.2 uses XZY
|
||||
#elif AXIS_ORDER == AXIS_ORDER_YZX
|
||||
return y + (z * cChunkDef::Width) + (x * cChunkDef::Height * cChunkDef::Width); // 1.1 is YZX
|
||||
return y + (z * cChunkDef::Width) + (x * cChunkDef::Height * cChunkDef::Width); // 1.1 uses YZX
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "Entities/Pickup.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <cstdlib> // abs
|
||||
#include <cstdlib> // abs
|
||||
#endif
|
||||
|
||||
#include "zlib/zlib.h"
|
||||
@ -33,14 +33,15 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cChunkMap:
|
||||
|
||||
cChunkMap::cChunkMap(cWorld * a_World )
|
||||
: m_World( a_World ),
|
||||
cChunkMap::cChunkMap(cWorld * a_World) :
|
||||
m_World(a_World),
|
||||
m_Pool(
|
||||
new cListAllocationPool<cChunkData::sChunkSection, 1600>(
|
||||
std::auto_ptr<cAllocationPool<cChunkData::sChunkSection>::cStarvationCallbacks>(
|
||||
new cStarvationCallbacks())
|
||||
new cStarvationCallbacks()
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
@ -1873,15 +1874,15 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
|
||||
|
||||
default:
|
||||
{
|
||||
if (m_World->GetTickRandomNumber(100) <= 25) // 25% chance of pickups
|
||||
if (m_World->GetTickRandomNumber(100) <= 25) // 25% chance of pickups
|
||||
{
|
||||
cItems Drops;
|
||||
cBlockHandler * Handler = BlockHandler(Block);
|
||||
|
||||
Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc.
|
||||
Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc.
|
||||
m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z);
|
||||
}
|
||||
else if ((m_World->GetTNTShrapnelLevel() > slNone) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
|
||||
else if ((m_World->GetTNTShrapnelLevel() > slNone) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
|
||||
{
|
||||
if (!cBlockInfo::FullyOccupiesVoxel(Block))
|
||||
{
|
||||
@ -1921,7 +1922,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
|
||||
{
|
||||
if (a_Entity->IsPickup())
|
||||
{
|
||||
if (((cPickup *)a_Entity)->GetAge() < 20) // If pickup age is smaller than one second, it is invincible (so we don't kill pickups that were just spawned)
|
||||
if (((cPickup *)a_Entity)->GetAge() < 20) // If pickup age is smaller than one second, it is invincible (so we don't kill pickups that were just spawned)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1930,7 +1931,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
|
||||
Vector3d EntityPos = a_Entity->GetPosition();
|
||||
cBoundingBox bbEntity(EntityPos, a_Entity->GetWidth() / 2, a_Entity->GetHeight());
|
||||
|
||||
if (!m_bbTNT.IsInside(bbEntity)) // IsInside actually acts like DoesSurround
|
||||
if (!m_bbTNT.IsInside(bbEntity)) // IsInside actually acts like DoesSurround
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1953,7 +1954,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
|
||||
else if (FinalDamage < 0)
|
||||
FinalDamage = 0;
|
||||
|
||||
if (!a_Entity->IsTNT() && !a_Entity->IsFallingBlock()) // Don't apply damage to other TNT entities and falling blocks, they should be invincible
|
||||
if (!a_Entity->IsTNT() && !a_Entity->IsFallingBlock()) // Don't apply damage to other TNT entities and falling blocks, they should be invincible
|
||||
{
|
||||
a_Entity->TakeDamage(dtExplosion, NULL, (int)FinalDamage, 0);
|
||||
}
|
||||
@ -2733,7 +2734,7 @@ cChunkMap::cChunkLayer::~cChunkLayer()
|
||||
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); ++i)
|
||||
{
|
||||
delete m_Chunks[i];
|
||||
m_Chunks[i] = NULL; // // Must zero out, because further chunk deletions query the chunkmap for entities and that would touch deleted data
|
||||
m_Chunks[i] = NULL; // Must zero out, because further chunk deletions query the chunkmap for entities and that would touch deleted data
|
||||
} // for i - m_Chunks[]
|
||||
}
|
||||
|
||||
|
@ -589,7 +589,7 @@ void cClientHandle::HandleCreativeInventory(short a_SlotNum, const cItem & a_Hel
|
||||
|
||||
void cClientHandle::HandlePlayerAbilities(bool a_CanFly, bool a_IsFlying, float FlyingSpeed, float WalkingSpeed)
|
||||
{
|
||||
UNUSED(FlyingSpeed); // Ignore the client values for these
|
||||
UNUSED(FlyingSpeed); // Ignore the client values for these
|
||||
UNUSED(WalkingSpeed);
|
||||
|
||||
m_Player->SetCanFly(a_CanFly);
|
||||
@ -668,7 +668,7 @@ void cClientHandle::HandlePluginMessage(const AString & a_Channel, const AString
|
||||
if (HasPluginChannel(a_Channel))
|
||||
{
|
||||
SendPluginMessage("UNREGISTER", a_Channel);
|
||||
return; // Can't register again if already taken - kinda defeats the point of plugin messaging!
|
||||
return; // Can't register again if already taken - kinda defeats the point of plugin messaging!
|
||||
}
|
||||
|
||||
RegisterPluginChannels(BreakApartPluginChannels(a_Message));
|
||||
@ -842,7 +842,7 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB
|
||||
}
|
||||
|
||||
if (
|
||||
((a_Status == DIG_STATUS_STARTED) || (a_Status == DIG_STATUS_FINISHED)) && // Only do a radius check for block destruction - things like pickup tossing send coordinates that are to be ignored
|
||||
((a_Status == DIG_STATUS_STARTED) || (a_Status == DIG_STATUS_FINISHED)) && // Only do a radius check for block destruction - things like pickup tossing send coordinates that are to be ignored
|
||||
((Diff(m_Player->GetPosX(), (double)a_BlockX) > 6) ||
|
||||
(Diff(m_Player->GetPosY(), (double)a_BlockY) > 6) ||
|
||||
(Diff(m_Player->GetPosZ(), (double)a_BlockZ) > 6))
|
||||
@ -926,7 +926,7 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB
|
||||
// A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
|
||||
return;
|
||||
}
|
||||
m_Player->TossEquippedItem(64); // Toss entire slot - if there aren't enough items, the maximum will be ejected
|
||||
m_Player->TossEquippedItem(64); // Toss entire slot - if there aren't enough items, the maximum will be ejected
|
||||
return;
|
||||
}
|
||||
|
||||
@ -989,7 +989,7 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc
|
||||
int pY = a_BlockY;
|
||||
int pZ = a_BlockZ;
|
||||
|
||||
AddFaceDirection(pX, pY, pZ, a_BlockFace); // Get the block in front of the clicked coordinates (m_bInverse defaulted to false)
|
||||
AddFaceDirection(pX, pY, pZ, a_BlockFace); // Get the block in front of the clicked coordinates (m_bInverse defaulted to false)
|
||||
cBlockHandler * Handler = cBlockInfo::GetHandler(m_Player->GetWorld()->GetBlock(pX, pY, pZ));
|
||||
|
||||
if (Handler->IsClickedThrough())
|
||||
@ -1083,7 +1083,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
|
||||
|
||||
void cClientHandle::FinishDigAnimation()
|
||||
{
|
||||
if (!m_HasStartedDigging) // Hasn't received the DIG_STARTED packet
|
||||
if (!m_HasStartedDigging) // Hasn't received the DIG_STARTED packet
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1441,23 +1441,25 @@ void cClientHandle::HandleAnimation(char a_Animation)
|
||||
// Because the animation ID sent to servers by clients are different to those sent back, we need this
|
||||
switch (a_Animation)
|
||||
{
|
||||
case 0: // No animation - wiki.vg doesn't say that client has something specific for it, so I suppose it will just become -1
|
||||
case 0: // No animation - wiki.vg doesn't say that client has something specific for it, so I suppose it will just become -1
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
a_Animation--; // Offset by -1
|
||||
a_Animation--; // Offset by -1
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
{
|
||||
a_Animation -= 2; // Offset by -2
|
||||
a_Animation -= 2; // Offset by -2
|
||||
break;
|
||||
}
|
||||
default: // Anything else is the same
|
||||
default: // Anything else is the same
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, a_Animation, this);
|
||||
@ -2473,7 +2475,7 @@ void cClientHandle::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType,
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) // VehicleSubType is specific to Minecarts
|
||||
void cClientHandle::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) // VehicleSubType is specific to Minecarts
|
||||
{
|
||||
m_Protocol->SendSpawnVehicle(a_Vehicle, a_VehicleType, a_VehicleSubType);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle);
|
||||
void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType);
|
||||
void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage);
|
||||
void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export
|
||||
void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export
|
||||
void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes);
|
||||
void SendChat (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
|
||||
void SendChat (const cCompositeChat & a_Message);
|
||||
@ -271,15 +271,14 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
/** Handles the block placing packet when it is a real block placement (not block-using, item-using or eating) */
|
||||
void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler);
|
||||
|
||||
/** The type used for storing the names of registered plugin channels. */
|
||||
typedef std::set<AString> cChannels;
|
||||
|
||||
int m_ViewDistance; // Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 )
|
||||
/** Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 ) */
|
||||
int m_ViewDistance;
|
||||
|
||||
static const int GENERATEDISTANCE = 2; // Server generates this many chunks AHEAD of player sight. 2 is the minimum, since foliage is generated 1 step behind chunk terrain generation
|
||||
/** Server generates this many chunks AHEAD of player sight. */
|
||||
static const int GENERATEDISTANCE = 2;
|
||||
|
||||
AString m_IPString;
|
||||
|
||||
@ -317,7 +316,7 @@ private:
|
||||
int m_PingID;
|
||||
long long m_PingStartTime;
|
||||
long long m_LastPingTime;
|
||||
static const unsigned short PING_TIME_MS = 1000; //minecraft sends 1 per 20 ticks (1 second or every 1000 ms)
|
||||
static const unsigned short PING_TIME_MS = 1000; // Vanilla sends 1 per 20 ticks (1 second or every 1000 ms)
|
||||
|
||||
// Values required for block dig animation
|
||||
int m_BlockDigAnimStage; // Current stage of the animation; -1 if not digging
|
||||
@ -374,6 +373,9 @@ private:
|
||||
cChannels m_PluginChannels;
|
||||
|
||||
|
||||
/** Handles the block placing packet when it is a real block placement (not block-using, item-using or eating) */
|
||||
void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler);
|
||||
|
||||
/** Returns true if the rate block interactions is within a reasonable limit (bot protection) */
|
||||
bool CheckBlockInteractionsRate(void);
|
||||
|
||||
|
@ -838,7 +838,7 @@ void cCraftingRecipes::HandleFireworks(const cItem * a_CraftingGrid, cCraftingRe
|
||||
case E_ITEM_GOLD_NUGGET: a_Recipe->m_Result.m_FireworkItem.m_Type = 2; break;
|
||||
case E_ITEM_FEATHER: a_Recipe->m_Result.m_FireworkItem.m_Type = 4; break;
|
||||
case E_ITEM_HEAD: a_Recipe->m_Result.m_FireworkItem.m_Type = 3; break;
|
||||
default: LOG("Unexpected item in firework star recipe, was the crafting file's fireworks section changed?"); break; // ermahgerd BARD ardmins
|
||||
default: LOG("Unexpected item in firework star recipe, was the crafting file's fireworks section changed?"); break; // ermahgerd BARD ardmins
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ typedef std::vector<int> cSlotNums;
|
||||
/// Experience Orb setup
|
||||
enum
|
||||
{
|
||||
//open to suggestion on naming convention here :)
|
||||
// Open to suggestion on naming convention here :)
|
||||
MAX_EXPERIENCE_ORB_SIZE = 2000
|
||||
} ;
|
||||
|
||||
|
@ -107,7 +107,7 @@ void cFurnaceRecipe::AddFuelFromLine(const AString & a_Line, int a_LineNum)
|
||||
{
|
||||
// Fuel
|
||||
int IItemID = 0, IItemCount = 0, IItemHealth = 0, IBurnTime = 0;
|
||||
AString::size_type BeginPos = 1; // Begin at one after exclamation mark (bang)
|
||||
AString::size_type BeginPos = 1; // Begin at one after exclamation mark (bang)
|
||||
|
||||
if (
|
||||
!ReadMandatoryNumber(BeginPos, ":", a_Line, a_LineNum, IItemID) || // Read item ID
|
||||
@ -133,7 +133,7 @@ void cFurnaceRecipe::AddRecipeFromLine(const AString & a_Line, int a_LineNum)
|
||||
{
|
||||
int IItemID = 0, IItemCount = 0, IItemHealth = 0, IBurnTime = 0;
|
||||
int OItemID = 0, OItemCount = 0, OItemHealth = 0;
|
||||
AString::size_type BeginPos = 0; // Begin at start of line
|
||||
AString::size_type BeginPos = 0; // Begin at start of line
|
||||
|
||||
if (
|
||||
!ReadMandatoryNumber(BeginPos, ":", a_Line, a_LineNum, IItemID) || // Read item ID
|
||||
@ -193,7 +193,7 @@ bool cFurnaceRecipe::ReadMandatoryNumber(AString::size_type & a_Begin, const ASt
|
||||
}
|
||||
a_Value = atoi(a_Text.substr(a_Begin, End - a_Begin).c_str());
|
||||
|
||||
a_Begin = End + 1; // Jump over delimiter
|
||||
a_Begin = End + 1; // Jump over delimiter
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ bool cFurnaceRecipe::ReadOptionalNumbers(AString::size_type & a_Begin, const ASt
|
||||
}
|
||||
a_ValueTwo = atoi(a_Text.substr(Begin, End - Begin).c_str());
|
||||
|
||||
a_Begin = End + 1; // Jump over delimiter
|
||||
a_Begin = End + 1; // Jump over delimiter
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -14,18 +14,18 @@
|
||||
#pragma warning(disable:4481)
|
||||
|
||||
// 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:
|
||||
#pragma warning(3 : 4127) // Conditional expression is constant
|
||||
#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 : 4310) // Cast truncates constant value
|
||||
#pragma warning(3 : 4389) // Signed/unsigned mismatch
|
||||
#pragma warning(3 : 4505) // Unreferenced local function has been removed
|
||||
#pragma warning(3 : 4701) // Potentially unitialized local variable used
|
||||
#pragma warning(3 : 4702) // Unreachable code
|
||||
#pragma warning(3 : 4706) // Assignment within conditional expression
|
||||
#pragma warning(3 : 4127) // Conditional expression is constant
|
||||
#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 : 4310) // Cast truncates constant value
|
||||
#pragma warning(3 : 4389) // Signed/unsigned mismatch
|
||||
#pragma warning(3 : 4505) // Unreferenced local function has been removed
|
||||
#pragma warning(3 : 4701) // Potentially unitialized local variable used
|
||||
#pragma warning(3 : 4702) // Unreachable code
|
||||
#pragma warning(3 : 4706) // Assignment within conditional expression
|
||||
|
||||
// Disabling this warning, because we know what we're doing when we're doing this:
|
||||
#pragma warning(disable: 4355) // 'this' used in initializer list
|
||||
@ -34,7 +34,7 @@
|
||||
#pragma warning(disable: 4512) // 'class': assignment operator could not be generated - reported for each class that has a reference-type member
|
||||
|
||||
// 2014_01_06 xoft: Disabled this warning because MSVC is stupid and reports it in obviously wrong places
|
||||
// #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data
|
||||
// #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data
|
||||
|
||||
#define OBSOLETE __declspec(deprecated)
|
||||
|
||||
|
@ -145,7 +145,7 @@ bool cGroupManager::LoadGroups()
|
||||
AString KeyName = IniFile.GetKeyName(i);
|
||||
cGroup * Group = GetGroup(KeyName.c_str());
|
||||
|
||||
Group->ClearPermission(); // Needed in case the groups are reloaded.
|
||||
Group->ClearPermission(); // Needed in case the groups are reloaded.
|
||||
|
||||
LOGD("Loading group %s", KeyName.c_str());
|
||||
|
||||
|
@ -493,7 +493,7 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
|
||||
if( NumFree >= a_Item.m_ItemCount )
|
||||
{
|
||||
|
||||
//printf("1. Adding %i items ( free: %i )\n", a_Item.m_ItemCount, NumFree );
|
||||
// printf("1. Adding %i items ( free: %i )\n", a_Item.m_ItemCount, NumFree );
|
||||
m_Slots[i + a_Offset].m_ItemCount += a_Item.m_ItemCount;
|
||||
a_Item.m_ItemCount = 0;
|
||||
a_bChangedSlots[i + a_Offset] = true;
|
||||
@ -501,7 +501,7 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("2. Adding %i items\n", NumFree );
|
||||
// printf("2. Adding %i items\n", NumFree );
|
||||
m_Slots[i + a_Offset].m_ItemCount += (char)NumFree;
|
||||
a_Item.m_ItemCount -= (char)NumFree;
|
||||
a_bChangedSlots[i + a_Offset] = true;
|
||||
|
@ -130,9 +130,9 @@ void cLog::Log(const char * a_Format, va_list argList)
|
||||
|
||||
// Print to console:
|
||||
#if defined(ANDROID_NDK)
|
||||
//__android_log_vprint(ANDROID_LOG_ERROR,"MCServer", a_Format, argList);
|
||||
// __android_log_vprint(ANDROID_LOG_ERROR,"MCServer", a_Format, argList);
|
||||
__android_log_print(ANDROID_LOG_ERROR, "MCServer", "%s", Line.c_str() );
|
||||
//CallJavaFunction_Void_String(g_JavaThread, "AddToLog", Line );
|
||||
// CallJavaFunction_Void_String(g_JavaThread, "AddToLog", Line );
|
||||
#else
|
||||
printf("%s", Line.c_str());
|
||||
#endif
|
||||
|
@ -256,7 +256,7 @@ private:
|
||||
|
||||
friend class cMapSerializer;
|
||||
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -43,14 +43,14 @@ public:
|
||||
Returns true if the map was found and the callback called, false if map not found.
|
||||
Callback return value is 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.
|
||||
Returns true if all maps processed, false if the callback aborted by returning true.
|
||||
*/
|
||||
bool ForEachMap(cMapCallback & a_Callback);
|
||||
|
||||
size_t GetNumMaps(void) const; // tolua_export
|
||||
size_t GetNumMaps(void) const; // tolua_export
|
||||
|
||||
/** Loads the map data from the disk */
|
||||
void LoadMapData(void);
|
||||
@ -69,7 +69,7 @@ private:
|
||||
|
||||
cWorld * m_World;
|
||||
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
|
||||
#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
|
||||
#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
|
||||
#include <math.h>
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ void cMobCensus::CollectMob(cMonster & a_Monster, cChunk & a_Chunk, double a_Dis
|
||||
|
||||
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
|
||||
// MG TODO : code the correct count
|
||||
if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily))
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include "BlockID.h"
|
||||
#include "Mobs/Monster.h" //this is a side-effect of keeping Mobfamily inside Monster class. I'd prefer to keep both (Mobfamily and Monster) inside a "Monster" namespace MG TODO : do it
|
||||
#include "Mobs/Monster.h" // This is a side-effect of keeping Mobfamily inside Monster class. I'd prefer to keep both (Mobfamily and Monster) inside a "Monster" namespace MG TODO : do it
|
||||
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ cMobProximityCounter::sIterablePair cMobProximityCounter::getMobWithinThosesDist
|
||||
{
|
||||
if ((a_DistanceMin == 1) || (itr->first > a_DistanceMin))
|
||||
{
|
||||
toReturn.m_Begin = itr; // this is the first one with distance > a_DistanceMin;
|
||||
toReturn.m_Begin = itr; // This is the first one with distance > a_DistanceMin;
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ cMobProximityCounter::sIterablePair cMobProximityCounter::getMobWithinThosesDist
|
||||
{
|
||||
if ((a_DistanceMax != 1) && (itr->first > a_DistanceMax))
|
||||
{
|
||||
toReturn.m_End = itr; // this is just after the last one with distance < a_DistanceMax
|
||||
toReturn.m_End = itr; // This is just after the last one with distance < a_DistanceMax
|
||||
// Note : if we are not going through this, it's ok, toReturn.m_End will be end();
|
||||
break;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "ChunkDef.h"
|
||||
#include "Chunk.h"
|
||||
#include "FastRandom.h"
|
||||
#include "Mobs/Monster.h" //this is a side-effect of keeping Mobfamily inside Monster class. I'd prefer to keep both (Mobfamily and Monster) inside a "Monster" namespace MG TODO : do it
|
||||
#include "Mobs/Monster.h" // This is a side-effect of keeping Mobfamily inside Monster class. I'd prefer to keep both (Mobfamily and Monster) inside a "Monster" namespace MG TODO : do it
|
||||
|
||||
|
||||
|
||||
|
@ -105,7 +105,7 @@ void cRoot::Start(void)
|
||||
#ifdef _WIN32
|
||||
HWND hwnd = GetConsoleWindow();
|
||||
HMENU hmenu = GetSystemMenu(hwnd, FALSE);
|
||||
EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); // Disable close button when starting up; it causes problems with our CTRL-CLOSE handling
|
||||
EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); // Disable close button when starting up; it causes problems with our CTRL-CLOSE handling
|
||||
#endif
|
||||
|
||||
cDeadlockDetect dd;
|
||||
@ -202,7 +202,7 @@ void cRoot::Start(void)
|
||||
|
||||
LOG("Startup complete, took %lld ms!", finishmseconds);
|
||||
#ifdef _WIN32
|
||||
EnableMenuItem(hmenu, SC_CLOSE, MF_ENABLED); // Re-enable close button
|
||||
EnableMenuItem(hmenu, SC_CLOSE, MF_ENABLED); // Re-enable close button
|
||||
#endif
|
||||
|
||||
while (!m_bStop && !m_bRestart && !g_TERMINATE_EVENT_RAISED) // These are modified by external threads
|
||||
@ -607,7 +607,7 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
|
||||
m_BestRating = Rating;
|
||||
++m_NumMatches;
|
||||
}
|
||||
if (Rating == m_NameLength) // Perfect match
|
||||
if (Rating == m_NameLength) // Perfect match
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ private:
|
||||
friend class cScoreboardSerializer;
|
||||
|
||||
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
@ -197,7 +197,7 @@ private:
|
||||
friend class cScoreboardSerializer;
|
||||
|
||||
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
@ -301,7 +301,7 @@ private:
|
||||
friend class cScoreboardSerializer;
|
||||
|
||||
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -202,7 +202,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
|
||||
m_PlayerCount = 0;
|
||||
m_PlayerCountDiff = 0;
|
||||
|
||||
m_FaviconData = Base64Encode(cFile::ReadWholeFile(FILE_IO_PREFIX + AString("favicon.png"))); // Will return empty string if file nonexistant; client doesn't mind
|
||||
m_FaviconData = Base64Encode(cFile::ReadWholeFile(FILE_IO_PREFIX + AString("favicon.png"))); // Will return empty string if file nonexistant; client doesn't mind
|
||||
|
||||
if (m_bIsConnected)
|
||||
{
|
||||
@ -213,7 +213,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
|
||||
LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS);
|
||||
LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS);
|
||||
|
||||
if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever
|
||||
if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever
|
||||
{
|
||||
LOGERROR("WSAStartup() != 0");
|
||||
return false;
|
||||
@ -409,7 +409,7 @@ void cServer::TickClients(float a_Dt)
|
||||
for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr)
|
||||
{
|
||||
delete *itr;
|
||||
} // for itr - RemoveClients[]
|
||||
} // for itr - RemoveClients[]
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,7 +133,7 @@ public: // tolua_export
|
||||
|
||||
private:
|
||||
|
||||
friend class cRoot; // so cRoot can create and destroy cServer
|
||||
friend class cRoot; // so cRoot can create and destroy cServer
|
||||
|
||||
/** When NotifyClientWrite() is called, it is queued for this thread to process (to avoid deadlocks between cSocketThreads, cClientHandle and cChunkMap) */
|
||||
class cNotifyWriteThread :
|
||||
@ -194,7 +194,7 @@ private:
|
||||
|
||||
int m_ClientViewDistance; // The default view distance for clients; settable in Settings.ini
|
||||
|
||||
bool m_bIsConnected; // true - connected false - not connected
|
||||
bool m_bIsConnected; // true - connected false - not connected
|
||||
|
||||
bool m_bRestarting;
|
||||
|
||||
@ -244,7 +244,7 @@ private:
|
||||
|
||||
// cListenThread::cCallback overrides:
|
||||
virtual void OnConnectionAccepted(cSocket & a_Socket) override;
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -118,7 +118,7 @@ private:
|
||||
|
||||
|
||||
/* Signed (?) integral value. */
|
||||
typedef int StatValue; // tolua_export
|
||||
typedef int StatValue; // tolua_export
|
||||
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ private:
|
||||
// TODO 10-05-2014 xdot: Use, mine, craft statistics
|
||||
|
||||
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "Entities/Entity.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <stdlib.h> // abs()
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
|
||||
@ -247,7 +247,7 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int
|
||||
// return 1 = hit, other is not hit
|
||||
int LinesCross(float x0,float y0,float x1,float y1,float x2,float y2,float x3,float y3)
|
||||
{
|
||||
//float linx, liny;
|
||||
// float linx, liny;
|
||||
|
||||
float d=(x1-x0)*(y3-y2)-(y1-y0)*(x3-x2);
|
||||
if (abs(d)<0.001) {return 0;}
|
||||
@ -257,8 +257,8 @@ int LinesCross(float x0,float y0,float x1,float y1,float x2,float y2,float x3,fl
|
||||
float CD=((y0-y2)*(x1-x0)-(x0-x2)*(y1-y0))/d;
|
||||
if (CD>=0.0 && CD<=1.0)
|
||||
{
|
||||
//linx=x0+AB*(x1-x0);
|
||||
//liny=y0+AB*(y1-y0);
|
||||
// linx=x0+AB*(x1-x0);
|
||||
// liny=y0+AB*(y1-y0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,7 @@ int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f
|
||||
if (sI < 0 || sI > 1)
|
||||
return 0; // no intersection
|
||||
|
||||
//Vector3f I ( a_Ray->GetOrigin() + sI * u );//S.P0 + sI * u; // compute segment intersect point
|
||||
// Vector3f I ( a_Ray->GetOrigin() + sI * u );//S.P0 + sI * u; // compute segment intersect point
|
||||
RealHit = a_Origin + u * sI;
|
||||
return 1;
|
||||
}
|
||||
@ -310,8 +310,8 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
|
||||
Vector3f Look = (end - start);
|
||||
Look.Normalize();
|
||||
|
||||
float dot = Look.Dot( Vector3f(-1, 0, 0) ); // first face normal is x -1
|
||||
if(dot < 0)
|
||||
float dot = Look.Dot( Vector3f(-1, 0, 0) ); // first face normal is x -1
|
||||
if (dot < 0)
|
||||
{
|
||||
int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x, BlockPos.y, BlockPos.x, BlockPos.y + 1 );
|
||||
if(Lines == 1)
|
||||
@ -324,7 +324,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
|
||||
}
|
||||
}
|
||||
}
|
||||
dot = Look.Dot( Vector3f(0, 0, -1) ); // second face normal is z -1
|
||||
dot = Look.Dot( Vector3f(0, 0, -1) ); // second face normal is z -1
|
||||
if(dot < 0)
|
||||
{
|
||||
int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z, BlockPos.y, BlockPos.z, BlockPos.y + 1 );
|
||||
@ -338,7 +338,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
|
||||
}
|
||||
}
|
||||
}
|
||||
dot = Look.Dot( Vector3f(1, 0, 0) ); // third face normal is x 1
|
||||
dot = Look.Dot( Vector3f(1, 0, 0) ); // third face normal is x 1
|
||||
if(dot < 0)
|
||||
{
|
||||
int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x + 1, BlockPos.y, BlockPos.x + 1, BlockPos.y + 1 );
|
||||
@ -352,7 +352,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
|
||||
}
|
||||
}
|
||||
}
|
||||
dot = Look.Dot( Vector3f(0, 0, 1) ); // fourth face normal is z 1
|
||||
dot = Look.Dot( Vector3f(0, 0, 1) ); // fourth face normal is z 1
|
||||
if(dot < 0)
|
||||
{
|
||||
int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z + 1, BlockPos.y, BlockPos.z + 1, BlockPos.y + 1 );
|
||||
@ -366,7 +366,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
|
||||
}
|
||||
}
|
||||
}
|
||||
dot = Look.Dot( Vector3f(0, 1, 0) ); // fifth face normal is y 1
|
||||
dot = Look.Dot( Vector3f(0, 1, 0) ); // fifth face normal is y 1
|
||||
if(dot < 0)
|
||||
{
|
||||
int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y + 1, BlockPos.x, BlockPos.y + 1, BlockPos.x + 1 );
|
||||
@ -380,7 +380,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
|
||||
}
|
||||
}
|
||||
}
|
||||
dot = Look.Dot( Vector3f(0, -1, 0) ); // sixth face normal is y -1
|
||||
dot = Look.Dot( Vector3f(0, -1, 0) ); // sixth face normal is y -1
|
||||
if(dot < 0)
|
||||
{
|
||||
int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y, BlockPos.x, BlockPos.y, BlockPos.x + 1 );
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
|
||||
#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
|
||||
#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
|
||||
#include <math.h>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
@ -391,7 +391,7 @@ AString cWebAdmin::GetDefaultPage(void)
|
||||
Content += "<h4>Players:</h4><ul>";
|
||||
|
||||
cPlayerAccum PlayerAccum;
|
||||
cWorld * World = cRoot::Get()->GetDefaultWorld(); // TODO - Create a list of worlds and players
|
||||
cWorld * World = cRoot::Get()->GetDefaultWorld(); // TODO - Create a list of worlds and players
|
||||
if( World != NULL )
|
||||
{
|
||||
World->ForEachPlayer(PlayerAccum);
|
||||
|
@ -60,11 +60,11 @@ struct HTTPRequest
|
||||
StringStringMap Params; // >> EXPORTED IN MANUALBINDINGS <<
|
||||
|
||||
/** Parameters posted as a part of a form - either in the URL (GET method) or in the body (POST method) */
|
||||
StringStringMap PostParams; // >> EXPORTED IN MANUALBINDINGS <<
|
||||
StringStringMap PostParams; // >> EXPORTED IN MANUALBINDINGS <<
|
||||
|
||||
/** Same as PostParams */
|
||||
FormDataMap FormData; // >> EXPORTED IN MANUALBINDINGS <<
|
||||
} ; // tolua_export
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
void RemovePlugin(cWebPlugin * a_Plugin);
|
||||
|
||||
// TODO: Convert this to the auto-locking callback mechanism used for looping players in worlds and such
|
||||
PluginList GetPlugins() const { return m_Plugins; } // >> EXPORTED IN MANUALBINDINGS <<
|
||||
PluginList GetPlugins() const { return m_Plugins; } // >> EXPORTED IN MANUALBINDINGS <<
|
||||
|
||||
// tolua_begin
|
||||
|
||||
@ -218,7 +218,7 @@ protected:
|
||||
virtual void OnRequestBegun (cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override;
|
||||
virtual void OnRequestBody (cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, size_t a_Size) override;
|
||||
virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override;
|
||||
} ; // tolua_export
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -375,17 +375,15 @@ void cWorld::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
|
||||
void cWorld::InitializeSpawn(void)
|
||||
{
|
||||
if (!m_IsSpawnExplicitlySet) // Check if spawn position was already explicitly set or not
|
||||
if (!m_IsSpawnExplicitlySet)
|
||||
{
|
||||
GenerateRandomSpawn(); // Generate random solid-land coordinate and then write it to the world configuration
|
||||
|
||||
// Spawn position wasn't already explicitly set, enerate random solid-land coordinate and then write it to the world configuration:
|
||||
GenerateRandomSpawn();
|
||||
cIniFile IniFile;
|
||||
IniFile.ReadFile(m_IniFileName);
|
||||
|
||||
IniFile.SetValueF("SpawnPosition", "X", m_SpawnX);
|
||||
IniFile.SetValueF("SpawnPosition", "Y", m_SpawnY);
|
||||
IniFile.SetValueF("SpawnPosition", "Z", m_SpawnZ);
|
||||
|
||||
IniFile.WriteFile(m_IniFileName);
|
||||
}
|
||||
|
||||
@ -648,7 +646,7 @@ void cWorld::GenerateRandomSpawn(void)
|
||||
|
||||
while (IsBlockWaterOrIce(GetBlock((int)m_SpawnX, GetHeight((int)m_SpawnX, (int)m_SpawnZ), (int)m_SpawnZ)))
|
||||
{
|
||||
if ((GetTickRandomNumber(4) % 2) == 0) // Randomise whether to increment X or Z coords
|
||||
if ((GetTickRandomNumber(4) % 2) == 0) // Randomise whether to increment X or Z coords
|
||||
{
|
||||
m_SpawnX += cChunkDef::Width;
|
||||
}
|
||||
@ -658,7 +656,7 @@ void cWorld::GenerateRandomSpawn(void)
|
||||
}
|
||||
}
|
||||
|
||||
m_SpawnY = (double)GetHeight((int)m_SpawnX, (int)m_SpawnZ) + 1.6f; // 1.6f to accomodate player height
|
||||
m_SpawnY = (double)GetHeight((int)m_SpawnX, (int)m_SpawnZ) + 1.6f; // 1.6f to accomodate player height
|
||||
|
||||
LOGD("Generated random spawnpoint %i %i %i", (int)m_SpawnX, (int)m_SpawnY, (int)m_SpawnZ);
|
||||
}
|
||||
@ -770,12 +768,12 @@ void cWorld::Tick(float a_Dt, int a_LastTickDurationMSec)
|
||||
|
||||
m_ChunkMap->FastSetQueuedBlocks();
|
||||
|
||||
if (m_WorldAge - m_LastSave > 60 * 5 * 20) // Save each 5 minutes
|
||||
if (m_WorldAge - m_LastSave > 60 * 5 * 20) // Save each 5 minutes
|
||||
{
|
||||
SaveAllChunks();
|
||||
}
|
||||
|
||||
if (m_WorldAge - m_LastUnload > 10 * 20) // Unload every 10 seconds
|
||||
if (m_WorldAge - m_LastUnload > 10 * 20) // Unload every 10 seconds
|
||||
{
|
||||
UnloadUnusedChunks();
|
||||
}
|
||||
@ -861,8 +859,8 @@ void cWorld::TickMobs(float a_Dt)
|
||||
SpawnMobFinalize(*itr2);
|
||||
}
|
||||
}
|
||||
} // for i - AllFamilies[]
|
||||
} // if (Spawning enabled)
|
||||
} // for i - AllFamilies[]
|
||||
} // if (Spawning enabled)
|
||||
|
||||
// move close mobs
|
||||
cMobProximityCounter::sIterablePair allCloseEnoughToMoveMobs = MobCensus.GetProximityCounter().getMobWithinThosesDistances(-1, 64 * 16);// MG TODO : deal with this magic number (the 16 is the size of a block)
|
||||
@ -972,7 +970,7 @@ void cWorld::TickClients(float a_Dt)
|
||||
for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr)
|
||||
{
|
||||
delete *itr;
|
||||
} // for itr - RemoveClients[]
|
||||
} // for itr - RemoveClients[]
|
||||
}
|
||||
|
||||
|
||||
@ -3026,18 +3024,18 @@ void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Resul
|
||||
cCSLock Lock(m_CSPlayers);
|
||||
for (cPlayerList::iterator itr = m_Players.begin(), end = m_Players.end(); itr != end; ++itr)
|
||||
{
|
||||
size_t LastSpace = a_Text.find_last_of(" "); // Find the position of the last space
|
||||
size_t LastSpace = a_Text.find_last_of(" "); // Find the position of the last space
|
||||
|
||||
AString LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); // Find the last word
|
||||
AString LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); // Find the last word
|
||||
AString PlayerName ((*itr)->GetName());
|
||||
size_t Found = PlayerName.find(LastWord); // Try to find last word in playername
|
||||
size_t Found = PlayerName.find(LastWord); // Try to find last word in playername
|
||||
|
||||
if (Found == AString::npos)
|
||||
{
|
||||
continue; // No match
|
||||
continue; // No match
|
||||
}
|
||||
|
||||
a_Results.push_back(PlayerName); // Match!
|
||||
a_Results.push_back(PlayerName); // Match!
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,14 +218,14 @@ public:
|
||||
void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
||||
virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) override;
|
||||
void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL); // tolua_export
|
||||
void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL); // tolua_export
|
||||
void BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);
|
||||
void BroadcastScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode);
|
||||
void BroadcastDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display);
|
||||
void BroadcastSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL); // tolua_export
|
||||
void BroadcastSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL); // tolua_export
|
||||
void BroadcastSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL); // tolua_export
|
||||
void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastTeleportEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
|
||||
@ -859,7 +859,7 @@ private:
|
||||
Int64 m_LastTimeUpdate; // The tick in which the last time update has been sent.
|
||||
Int64 m_LastUnload; // The last WorldAge (in ticks) in which unloading was triggerred
|
||||
Int64 m_LastSave; // The last WorldAge (in ticks) in which save-all was triggerred
|
||||
std::map<cMonster::eFamily,Int64> m_LastSpawnMonster; // The last WorldAge (in ticks) in which a monster was spawned (for each megatype of monster) // MG TODO : find a way to optimize without creating unmaintenability (if mob IDs are becoming unrowed)
|
||||
std::map<cMonster::eFamily,Int64> m_LastSpawnMonster; // The last WorldAge (in ticks) in which a monster was spawned (for each megatype of monster) // MG TODO : find a way to optimize without creating unmaintenability (if mob IDs are becoming unrowed)
|
||||
|
||||
NIBBLETYPE m_SkyDarkness;
|
||||
|
||||
@ -1011,7 +1011,7 @@ private:
|
||||
/** Adds the players queued in the m_PlayersToAdd queue into the m_Players list.
|
||||
Assumes it is called from the Tick thread. */
|
||||
void AddQueuedPlayers(void);
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
18
src/main.cpp
18
src/main.cpp
@ -3,17 +3,17 @@
|
||||
|
||||
#include "Root.h"
|
||||
|
||||
#include <exception> //std::exception
|
||||
#include <csignal> //std::signal
|
||||
#include <stdlib.h> //exit()
|
||||
#include <exception>
|
||||
#include <csignal>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <dbghelp.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
// Here, we have some ALL CAPS variables, to give the impression that this is deeeep, gritty programming :P
|
||||
bool g_TERMINATE_EVENT_RAISED = false; // If something has told the server to stop; checked periodically in cRoot
|
||||
bool g_SERVER_TERMINATED = false; // Set to true when the server terminates, so our CTRL handler can then tell Windows to close the console
|
||||
bool g_TERMINATE_EVENT_RAISED = false; // If something has told the server to stop; checked periodically in cRoot
|
||||
bool g_SERVER_TERMINATED = false; // Set to true when the server terminates, so our CTRL handler can then tell Windows to close the console
|
||||
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ void NonCtrlHandler(int a_Signal)
|
||||
case SIGINT:
|
||||
case SIGTERM:
|
||||
{
|
||||
std::signal(a_Signal, SIG_IGN); // Server is shutting down, wait for it...
|
||||
std::signal(a_Signal, SIG_IGN); // Server is shutting down, wait for it...
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
@ -158,9 +158,9 @@ BOOL CtrlHandler(DWORD fdwCtrlType)
|
||||
g_TERMINATE_EVENT_RAISED = true;
|
||||
LOGD("Terminate event raised from the Windows CtrlHandler");
|
||||
|
||||
if (fdwCtrlType == CTRL_CLOSE_EVENT) // Console window closed via 'x' button, Windows will try to close immediately, therefore...
|
||||
if (fdwCtrlType == CTRL_CLOSE_EVENT) // Console window closed via 'x' button, Windows will try to close immediately, therefore...
|
||||
{
|
||||
while (!g_SERVER_TERMINATED) { cSleep::MilliSleep(100); } // Delay as much as possible to try to get the server to shut down cleanly
|
||||
while (!g_SERVER_TERMINATED) { cSleep::MilliSleep(100); } // Delay as much as possible to try to get the server to shut down cleanly
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -233,7 +233,7 @@ int main( int argc, char **argv )
|
||||
std::signal(SIGABRT, NonCtrlHandler);
|
||||
#ifdef SIGABRT_COMPAT
|
||||
std::signal(SIGABRT_COMPAT, NonCtrlHandler);
|
||||
#endif // SIGABRT_COMPAT
|
||||
#endif // SIGABRT_COMPAT
|
||||
#endif
|
||||
|
||||
// DEBUG: test the dumpfile creation:
|
||||
|
Loading…
Reference in New Issue
Block a user