Fixed compiler warning when iterating over a fixed array of items (ARRAYCOUNT).
This commit is contained in:
parent
b19d765666
commit
8610d45ef1
@ -290,7 +290,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
|
|||||||
{0, 1},
|
{0, 1},
|
||||||
{0, -1},
|
{0, -1},
|
||||||
} ;
|
} ;
|
||||||
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||||
{
|
{
|
||||||
int x = m_RelX + Coords[i].x;
|
int x = m_RelX + Coords[i].x;
|
||||||
int z = m_RelZ + Coords[i].z;
|
int z = m_RelZ + Coords[i].z;
|
||||||
@ -447,7 +447,7 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block
|
|||||||
{0, 1},
|
{0, 1},
|
||||||
{0, -1},
|
{0, -1},
|
||||||
} ;
|
} ;
|
||||||
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||||
{
|
{
|
||||||
int x = m_RelX + Coords[i].x;
|
int x = m_RelX + Coords[i].x;
|
||||||
int z = m_RelZ + Coords[i].z;
|
int z = m_RelZ + Coords[i].z;
|
||||||
|
@ -45,7 +45,7 @@ void cSignEntity::SetLines(const AString & a_Line1, const AString & a_Line2, con
|
|||||||
|
|
||||||
void cSignEntity::SetLine(int a_Index, const AString & a_Line)
|
void cSignEntity::SetLine(int a_Index, const AString & a_Line)
|
||||||
{
|
{
|
||||||
if ((a_Index < 0) || (a_Index >= ARRAYCOUNT(m_Line)))
|
if ((a_Index < 0) || (a_Index >= (int)ARRAYCOUNT(m_Line)))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: setting a non-existent line %d (value \"%s\"", __FUNCTION__, a_Index, a_Line.c_str());
|
LOGWARNING("%s: setting a non-existent line %d (value \"%s\"", __FUNCTION__, a_Index, a_Line.c_str());
|
||||||
return;
|
return;
|
||||||
@ -59,7 +59,7 @@ void cSignEntity::SetLine(int a_Index, const AString & a_Line)
|
|||||||
|
|
||||||
AString cSignEntity::GetLine(int a_Index) const
|
AString cSignEntity::GetLine(int a_Index) const
|
||||||
{
|
{
|
||||||
if ((a_Index < 0) || (a_Index >= ARRAYCOUNT(m_Line)))
|
if ((a_Index < 0) || (a_Index >= (int)ARRAYCOUNT(m_Line)))
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: requesting a non-existent line %d", __FUNCTION__, a_Index);
|
LOGWARNING("%s: requesting a non-existent line %d", __FUNCTION__, a_Index);
|
||||||
return "";
|
return "";
|
||||||
|
@ -353,7 +353,7 @@ EMCSBiome StringToBiome(const AString & a_BiomeString)
|
|||||||
{biMesaPlateauM, "MesaPlateauM"},
|
{biMesaPlateauM, "MesaPlateauM"},
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYCOUNT(BiomeMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(BiomeMap); i++)
|
||||||
{
|
{
|
||||||
if (NoCaseCompare(BiomeMap[i].m_String, a_BiomeString) == 0)
|
if (NoCaseCompare(BiomeMap[i].m_String, a_BiomeString) == 0)
|
||||||
{
|
{
|
||||||
@ -403,7 +403,7 @@ int StringToMobType(const AString & a_MobString)
|
|||||||
{cMonster::mtIronGolem, "IronGolem"},
|
{cMonster::mtIronGolem, "IronGolem"},
|
||||||
{cMonster::mtVillager, "Villager"},
|
{cMonster::mtVillager, "Villager"},
|
||||||
};
|
};
|
||||||
for (int i = 0; i < ARRAYCOUNT(MobMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(MobMap); i++)
|
||||||
{
|
{
|
||||||
if (NoCaseCompare(MobMap[i].m_String, a_MobString) == 0)
|
if (NoCaseCompare(MobMap[i].m_String, a_MobString) == 0)
|
||||||
{
|
{
|
||||||
@ -442,7 +442,7 @@ eDimension StringToDimension(const AString & a_DimensionString)
|
|||||||
{ dimEnd, "End"},
|
{ dimEnd, "End"},
|
||||||
{ dimEnd, "Sky"}, // Old name for End
|
{ dimEnd, "Sky"}, // Old name for End
|
||||||
} ;
|
} ;
|
||||||
for (int i = 0; i < ARRAYCOUNT(DimensionMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(DimensionMap); i++)
|
||||||
{
|
{
|
||||||
if (NoCaseCompare(DimensionMap[i].m_String, a_DimensionString) == 0)
|
if (NoCaseCompare(DimensionMap[i].m_String, a_DimensionString) == 0)
|
||||||
{
|
{
|
||||||
@ -549,7 +549,7 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString)
|
|||||||
{ dtFireContact, "dtInFire"},
|
{ dtFireContact, "dtInFire"},
|
||||||
{ dtAdmin, "dtPlugin"},
|
{ dtAdmin, "dtPlugin"},
|
||||||
} ;
|
} ;
|
||||||
for (int i = 0; i < ARRAYCOUNT(DamageTypeMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(DamageTypeMap); i++)
|
||||||
{
|
{
|
||||||
if (NoCaseCompare(DamageTypeMap[i].m_String, a_DamageTypeString) == 0)
|
if (NoCaseCompare(DamageTypeMap[i].m_String, a_DamageTypeString) == 0)
|
||||||
{
|
{
|
||||||
@ -594,14 +594,14 @@ public:
|
|||||||
memset(g_BlockIsTorchPlaceable, 0x00, sizeof(g_BlockIsTorchPlaceable));
|
memset(g_BlockIsTorchPlaceable, 0x00, sizeof(g_BlockIsTorchPlaceable));
|
||||||
|
|
||||||
// Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415
|
// Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415
|
||||||
for (int i = 0; i < ARRAYCOUNT(g_BlockIsSnowable); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(g_BlockIsSnowable); i++)
|
||||||
{
|
{
|
||||||
g_BlockIsSnowable[i] = true;
|
g_BlockIsSnowable[i] = true;
|
||||||
}
|
}
|
||||||
memset(g_BlockRequiresSpecialTool, 0x00, sizeof(g_BlockRequiresSpecialTool)); // Set all blocks to false
|
memset(g_BlockRequiresSpecialTool, 0x00, sizeof(g_BlockRequiresSpecialTool)); // Set all blocks to false
|
||||||
|
|
||||||
// Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415
|
// Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415
|
||||||
for (int i = 0; i < ARRAYCOUNT(g_BlockIsSolid); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(g_BlockIsSolid); i++)
|
||||||
{
|
{
|
||||||
g_BlockIsSolid[i] = true;
|
g_BlockIsSolid[i] = true;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
{ 0, -1},
|
{ 0, -1},
|
||||||
{ 0, 1},
|
{ 0, 1},
|
||||||
} ;
|
} ;
|
||||||
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||||
{
|
{
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
{-1, 0, 0},
|
{-1, 0, 0},
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYCOUNT(PortalCheck); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(PortalCheck); i++)
|
||||||
{
|
{
|
||||||
BLOCKTYPE Block;
|
BLOCKTYPE Block;
|
||||||
a_Chunk.UnboundedRelGetBlockType(a_RelX + PortalCheck[i].x, a_RelY + PortalCheck[i].y, a_RelZ + PortalCheck[i].z, Block);
|
a_Chunk.UnboundedRelGetBlockType(a_RelX + PortalCheck[i].x, a_RelY + PortalCheck[i].y, a_RelZ + PortalCheck[i].z, Block);
|
||||||
@ -86,7 +86,7 @@ public:
|
|||||||
{ 0, 0, 1},
|
{ 0, 0, 1},
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYCOUNT(PortalCheck); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(PortalCheck); i++)
|
||||||
{
|
{
|
||||||
BLOCKTYPE Block;
|
BLOCKTYPE Block;
|
||||||
a_Chunk.UnboundedRelGetBlockType(a_RelX + PortalCheck[i].x, a_RelY + PortalCheck[i].y, a_RelZ + PortalCheck[i].z, Block);
|
a_Chunk.UnboundedRelGetBlockType(a_RelX + PortalCheck[i].x, a_RelY + PortalCheck[i].y, a_RelZ + PortalCheck[i].z, Block);
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
{ 0, 1},
|
{ 0, 1},
|
||||||
} ;
|
} ;
|
||||||
a_RelY -= 1;
|
a_RelY -= 1;
|
||||||
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||||
{
|
{
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
{ 1, 0, 8}, // east, XP
|
{ 1, 0, 8}, // east, XP
|
||||||
} ;
|
} ;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||||
{
|
{
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
Vector3d(1.999, 0, 1.5), Vector3d(1.999, 4, 1.5), // Should intersect at 0.25, face 0 (YM)
|
Vector3d(1.999, 0, 1.5), Vector3d(1.999, 4, 1.5), // Should intersect at 0.25, face 0 (YM)
|
||||||
Vector3d(2.001, 0, 1.5), Vector3d(2.001, 4, 1.5), // Should not intersect
|
Vector3d(2.001, 0, 1.5), Vector3d(2.001, 4, 1.5), // Should not intersect
|
||||||
} ;
|
} ;
|
||||||
for (int i = 0; i < ARRAYCOUNT(LineDefs) / 2; i++)
|
for (size_t i = 0; i < ARRAYCOUNT(LineDefs) / 2; i++)
|
||||||
{
|
{
|
||||||
double LineCoeff;
|
double LineCoeff;
|
||||||
char Face;
|
char Face;
|
||||||
|
@ -2397,7 +2397,7 @@ cChunkMap::cChunkLayer::cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Pa
|
|||||||
|
|
||||||
cChunkMap::cChunkLayer::~cChunkLayer()
|
cChunkMap::cChunkLayer::~cChunkLayer()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Chunks); ++i)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); ++i)
|
||||||
{
|
{
|
||||||
delete 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
|
||||||
@ -2457,7 +2457,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 (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||||
{
|
{
|
||||||
// We do count every Mobs in the world. But we are assuming that every chunk not loaded by any client
|
// We do count every Mobs in the world. But we are assuming that every chunk not loaded by any client
|
||||||
// doesn't affect us. Normally they should not have mobs because every "too far" mobs despawn
|
// doesn't affect us. Normally they should not have mobs because every "too far" mobs despawn
|
||||||
@ -2476,7 +2476,7 @@ void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill)
|
|||||||
|
|
||||||
void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner& a_MobSpawner)
|
void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner& a_MobSpawner)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||||
{
|
{
|
||||||
// We only spawn close to players
|
// We only spawn close to players
|
||||||
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients())
|
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients())
|
||||||
@ -2490,7 +2490,7 @@ void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner& a_MobSpawner)
|
|||||||
|
|
||||||
void cChunkMap::cChunkLayer::Tick(float a_Dt)
|
void cChunkMap::cChunkLayer::Tick(float a_Dt)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||||
{
|
{
|
||||||
// Only tick chunks that are valid and have clients:
|
// Only tick chunks that are valid and have clients:
|
||||||
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients())
|
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients())
|
||||||
@ -2506,7 +2506,7 @@ void cChunkMap::cChunkLayer::Tick(float a_Dt)
|
|||||||
|
|
||||||
void cChunkMap::cChunkLayer::RemoveClient(cClientHandle * a_Client)
|
void cChunkMap::cChunkLayer::RemoveClient(cClientHandle * a_Client)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||||
{
|
{
|
||||||
if (m_Chunks[i] != NULL)
|
if (m_Chunks[i] != NULL)
|
||||||
{
|
{
|
||||||
@ -2522,7 +2522,7 @@ void cChunkMap::cChunkLayer::RemoveClient(cClientHandle * a_Client)
|
|||||||
bool cChunkMap::cChunkLayer::ForEachEntity(cEntityCallback & a_Callback)
|
bool cChunkMap::cChunkLayer::ForEachEntity(cEntityCallback & a_Callback)
|
||||||
{
|
{
|
||||||
// Calls the callback for each entity in the entire world; returns true if all entities processed, false if the callback aborted by returning true
|
// Calls the callback for each entity in the entire world; returns true if all entities processed, false if the callback aborted by returning true
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||||
{
|
{
|
||||||
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid())
|
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid())
|
||||||
{
|
{
|
||||||
@ -2542,7 +2542,7 @@ bool cChunkMap::cChunkLayer::ForEachEntity(cEntityCallback & a_Callback)
|
|||||||
bool cChunkMap::cChunkLayer::DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackReturn)
|
bool cChunkMap::cChunkLayer::DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackReturn)
|
||||||
{
|
{
|
||||||
// Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. Returns true if entity found.
|
// Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. Returns true if entity found.
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||||
{
|
{
|
||||||
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid())
|
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid())
|
||||||
{
|
{
|
||||||
@ -2561,7 +2561,7 @@ bool cChunkMap::cChunkLayer::DoWithEntityByID(int a_EntityID, cEntityCallback &
|
|||||||
|
|
||||||
bool cChunkMap::cChunkLayer::HasEntity(int a_EntityID)
|
bool cChunkMap::cChunkLayer::HasEntity(int a_EntityID)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||||
{
|
{
|
||||||
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid())
|
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid())
|
||||||
{
|
{
|
||||||
@ -2581,7 +2581,7 @@ bool cChunkMap::cChunkLayer::HasEntity(int a_EntityID)
|
|||||||
int cChunkMap::cChunkLayer::GetNumChunksLoaded(void) const
|
int cChunkMap::cChunkLayer::GetNumChunksLoaded(void) const
|
||||||
{
|
{
|
||||||
int NumChunks = 0;
|
int NumChunks = 0;
|
||||||
for ( int i = 0; i < ARRAYCOUNT(m_Chunks); ++i )
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); ++i)
|
||||||
{
|
{
|
||||||
if (m_Chunks[i] != NULL)
|
if (m_Chunks[i] != NULL)
|
||||||
{
|
{
|
||||||
@ -2599,7 +2599,7 @@ void cChunkMap::cChunkLayer::GetChunkStats(int & a_NumChunksValid, int & a_NumCh
|
|||||||
{
|
{
|
||||||
int NumValid = 0;
|
int NumValid = 0;
|
||||||
int NumDirty = 0;
|
int NumDirty = 0;
|
||||||
for ( int i = 0; i < ARRAYCOUNT(m_Chunks); ++i )
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); ++i)
|
||||||
{
|
{
|
||||||
if (m_Chunks[i] == NULL)
|
if (m_Chunks[i] == NULL)
|
||||||
{
|
{
|
||||||
@ -2622,7 +2622,7 @@ void cChunkMap::cChunkLayer::GetChunkStats(int & a_NumChunksValid, int & a_NumCh
|
|||||||
void cChunkMap::cChunkLayer::Save(void)
|
void cChunkMap::cChunkLayer::Save(void)
|
||||||
{
|
{
|
||||||
cWorld * World = m_Parent->GetWorld();
|
cWorld * World = m_Parent->GetWorld();
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Chunks); ++i)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); ++i)
|
||||||
{
|
{
|
||||||
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->IsDirty())
|
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->IsDirty())
|
||||||
{
|
{
|
||||||
@ -2637,7 +2637,7 @@ void cChunkMap::cChunkLayer::Save(void)
|
|||||||
|
|
||||||
void cChunkMap::cChunkLayer::UnloadUnusedChunks(void)
|
void cChunkMap::cChunkLayer::UnloadUnusedChunks(void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
(m_Chunks[i] != NULL) && // Is valid
|
(m_Chunks[i] != NULL) && // Is valid
|
||||||
|
@ -275,7 +275,7 @@ void cChunkSender::Entity(cEntity * a_Entity)
|
|||||||
|
|
||||||
void cChunkSender::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
|
void cChunkSender::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_BiomeMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_BiomeMap); i++)
|
||||||
{
|
{
|
||||||
if ((*a_BiomeMap)[i] < 255)
|
if ((*a_BiomeMap)[i] < 255)
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ int cEnchantments::StringToEnchantmentID(const AString & a_EnchantmentName)
|
|||||||
{ enchLuckOfTheSea, "LuckOfTheSea"},
|
{ enchLuckOfTheSea, "LuckOfTheSea"},
|
||||||
{ enchLure, "Lure"},
|
{ enchLure, "Lure"},
|
||||||
} ;
|
} ;
|
||||||
for (int i = 0; i < ARRAYCOUNT(EnchantmentNames); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(EnchantmentNames); i++)
|
||||||
{
|
{
|
||||||
if (NoCaseCompare(EnchantmentNames[i].m_Name, a_EnchantmentName) == 0)
|
if (NoCaseCompare(EnchantmentNames[i].m_Name, a_EnchantmentName) == 0)
|
||||||
{
|
{
|
||||||
|
@ -574,7 +574,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
bool IsNoAirSurrounding = true;
|
bool IsNoAirSurrounding = true;
|
||||||
for (int i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
|
||||||
{
|
{
|
||||||
if (!NextChunk->UnboundedRelGetBlockType(RelBlockX + gCrossCoords[i].x, BlockY, RelBlockZ + gCrossCoords[i].z, GotBlock))
|
if (!NextChunk->UnboundedRelGetBlockType(RelBlockX + gCrossCoords[i].x, BlockY, RelBlockZ + gCrossCoords[i].z, GotBlock))
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ cBiomeGen * cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & a
|
|||||||
|
|
||||||
void cBioGenConstant::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
|
void cBioGenConstant::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
|
||||||
{
|
{
|
||||||
a_BiomeMap[i] = m_Biome;
|
a_BiomeMap[i] = m_Biome;
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ void cBiomeGenList::InitializeBiomes(const AString & a_Biomes)
|
|||||||
biJungleHills,
|
biJungleHills,
|
||||||
} ;
|
} ;
|
||||||
m_Biomes.reserve(ARRAYCOUNT(Biomes));
|
m_Biomes.reserve(ARRAYCOUNT(Biomes));
|
||||||
for (int i = 0; i < ARRAYCOUNT(Biomes); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Biomes); i++)
|
||||||
{
|
{
|
||||||
m_Biomes.push_back(Biomes[i]);
|
m_Biomes.push_back(Biomes[i]);
|
||||||
}
|
}
|
||||||
@ -655,7 +655,7 @@ void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(int a_ChunkX, int a_Chunk
|
|||||||
LinearUpscale2DArrayInPlace(HumidityMap, 17, 17, 8, 8);
|
LinearUpscale2DArrayInPlace(HumidityMap, 17, 17, 8, 8);
|
||||||
|
|
||||||
// Re-map into integral values in [0 .. 255] range:
|
// Re-map into integral values in [0 .. 255] range:
|
||||||
for (int idx = 0; idx < ARRAYCOUNT(a_TemperatureMap); idx++)
|
for (size_t idx = 0; idx < ARRAYCOUNT(a_TemperatureMap); idx++)
|
||||||
{
|
{
|
||||||
a_TemperatureMap[idx] = std::max(0, std::min(255, (int)(128 + TemperatureMap[idx] * 128)));
|
a_TemperatureMap[idx] = std::max(0, std::min(255, (int)(128 + TemperatureMap[idx] * 128)));
|
||||||
a_HumidityMap[idx] = std::max(0, std::min(255, (int)(128 + HumidityMap[idx] * 128)));
|
a_HumidityMap[idx] = std::max(0, std::min(255, (int)(128 + HumidityMap[idx] * 128)));
|
||||||
|
@ -371,7 +371,7 @@ void cChunkDesc::ReadBlockArea(cBlockArea & a_Dest, int a_MinRelX, int a_MaxRelX
|
|||||||
HEIGHTTYPE cChunkDesc::GetMaxHeight(void) const
|
HEIGHTTYPE cChunkDesc::GetMaxHeight(void) const
|
||||||
{
|
{
|
||||||
HEIGHTTYPE MaxHeight = m_HeightMap[0];
|
HEIGHTTYPE MaxHeight = m_HeightMap[0];
|
||||||
for (unsigned int i = 1; i < ARRAYCOUNT(m_HeightMap); i++)
|
for (size_t i = 1; i < ARRAYCOUNT(m_HeightMap); i++)
|
||||||
{
|
{
|
||||||
if (m_HeightMap[i] > MaxHeight)
|
if (m_HeightMap[i] > MaxHeight)
|
||||||
{
|
{
|
||||||
@ -565,7 +565,7 @@ cBlockEntity * cChunkDesc::GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ)
|
|||||||
void cChunkDesc::CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas)
|
void cChunkDesc::CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas)
|
||||||
{
|
{
|
||||||
const NIBBLETYPE * AreaMetas = m_BlockArea.GetBlockMetas();
|
const NIBBLETYPE * AreaMetas = m_BlockArea.GetBlockMetas();
|
||||||
for (unsigned int i = 0; i < ARRAYCOUNT(a_DestMetas); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(a_DestMetas); i++)
|
||||||
{
|
{
|
||||||
a_DestMetas[i] = AreaMetas[2 * i] | (AreaMetas[2 * i + 1] << 4);
|
a_DestMetas[i] = AreaMetas[2 * i] | (AreaMetas[2 * i + 1] << 4);
|
||||||
}
|
}
|
||||||
|
@ -612,7 +612,7 @@ void cDistortedHeightmap::GetDistortAmpsAt(BiomeNeighbors & a_Neighbors, int a_R
|
|||||||
// For each biome type that has a nonzero count, calc its amps and add it:
|
// For each biome type that has a nonzero count, calc its amps and add it:
|
||||||
NOISE_DATATYPE AmpX = 0;
|
NOISE_DATATYPE AmpX = 0;
|
||||||
NOISE_DATATYPE AmpZ = 0;
|
NOISE_DATATYPE AmpZ = 0;
|
||||||
for (unsigned int i = 0; i < ARRAYCOUNT(BiomeCounts); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(BiomeCounts); i++)
|
||||||
{
|
{
|
||||||
if (BiomeCounts[i] <= 0)
|
if (BiomeCounts[i] <= 0)
|
||||||
{
|
{
|
||||||
|
@ -151,7 +151,7 @@ void cEndGen::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_
|
|||||||
{
|
{
|
||||||
if (IsChunkOutsideRange(a_ChunkX, a_ChunkZ))
|
if (IsChunkOutsideRange(a_ChunkX, a_ChunkZ))
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < ARRAYCOUNT(a_HeightMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(a_HeightMap); i++)
|
||||||
{
|
{
|
||||||
a_HeightMap[i] = 0;
|
a_HeightMap[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ void cFinishGenIce::GenFinish(cChunkDesc & a_ChunkDesc)
|
|||||||
int cFinishGenSingleBiomeSingleTopBlock::GetNumToGen(const cChunkDef::BiomeMap & a_BiomeMap)
|
int cFinishGenSingleBiomeSingleTopBlock::GetNumToGen(const cChunkDef::BiomeMap & a_BiomeMap)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
for (int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
|
||||||
{
|
{
|
||||||
if (a_BiomeMap[i] == m_Biome)
|
if (a_BiomeMap[i] == m_Biome)
|
||||||
{
|
{
|
||||||
@ -469,7 +469,7 @@ void cFinishGenPreSimulator::StationarizeFluid(
|
|||||||
{0, -1, 0}
|
{0, -1, 0}
|
||||||
} ;
|
} ;
|
||||||
BLOCKTYPE BlockToSet = a_StationaryFluid; // By default, don't simulate this block
|
BLOCKTYPE BlockToSet = a_StationaryFluid; // By default, don't simulate this block
|
||||||
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||||
{
|
{
|
||||||
if ((y == 0) && (Coords[i].y < 0))
|
if ((y == 0) && (Coords[i].y < 0))
|
||||||
{
|
{
|
||||||
@ -635,7 +635,7 @@ bool cFinishGenFluidSprings::TryPlaceSpring(cChunkDesc & a_ChunkDesc, int x, int
|
|||||||
{ 0, 0, 1},
|
{ 0, 0, 1},
|
||||||
} ;
|
} ;
|
||||||
int NumAirNeighbors = 0;
|
int NumAirNeighbors = 0;
|
||||||
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||||
{
|
{
|
||||||
switch (a_ChunkDesc.GetBlockType(x + Coords[i].x, y + Coords[i].y, z + Coords[i].z))
|
switch (a_ChunkDesc.GetBlockType(x + Coords[i].x, y + Coords[i].y, z + Coords[i].z))
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
void cHeiGenFlat::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap)
|
void cHeiGenFlat::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(a_HeightMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(a_HeightMap); i++)
|
||||||
{
|
{
|
||||||
a_HeightMap[i] = m_Height;
|
a_HeightMap[i] = m_Height;
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ NOISE_DATATYPE cHeiGenBiomal::GetHeightAt(int a_RelX, int a_RelZ, int a_ChunkX,
|
|||||||
NOISE_DATATYPE Height = 0;
|
NOISE_DATATYPE Height = 0;
|
||||||
int BlockX = a_ChunkX * cChunkDef::Width + a_RelX;
|
int BlockX = a_ChunkX * cChunkDef::Width + a_RelX;
|
||||||
int BlockZ = a_ChunkZ * cChunkDef::Width + a_RelZ;
|
int BlockZ = a_ChunkZ * cChunkDef::Width + a_RelZ;
|
||||||
for (int i = 0; i < ARRAYCOUNT(BiomeCounts); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(BiomeCounts); i++)
|
||||||
{
|
{
|
||||||
if (BiomeCounts[i] == 0)
|
if (BiomeCounts[i] == 0)
|
||||||
{
|
{
|
||||||
|
@ -1035,7 +1035,7 @@ void cMineShaftCrossing::AppendBranches(int a_RecursionLevel, cNoise & a_Noise)
|
|||||||
{ 5, 5, 2, dirXP},
|
{ 5, 5, 2, dirXP},
|
||||||
{ 2, 5, 5, dirZP},
|
{ 2, 5, 5, dirZP},
|
||||||
} ;
|
} ;
|
||||||
for (unsigned int i = 0; i < ARRAYCOUNT(Exits); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Exits); i++)
|
||||||
{
|
{
|
||||||
if (m_BoundingBox.p1.y + Exits[i].y >= m_BoundingBox.p2.y)
|
if (m_BoundingBox.p1.y + Exits[i].y >= m_BoundingBox.p2.y)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
void DoTest1(void)
|
void DoTest1(void)
|
||||||
{
|
{
|
||||||
float In[3 * 3 * 3];
|
float In[3 * 3 * 3];
|
||||||
for (int i = 0; i < ARRAYCOUNT(In); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(In); i++)
|
||||||
{
|
{
|
||||||
In[i] = (float)(i % 5);
|
In[i] = (float)(i % 5);
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ public:
|
|||||||
void DoTest2(void)
|
void DoTest2(void)
|
||||||
{
|
{
|
||||||
float In[3 * 3];
|
float In[3 * 3];
|
||||||
for (int i = 0; i < ARRAYCOUNT(In); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(In); i++)
|
||||||
{
|
{
|
||||||
In[i] = (float)(i % 5);
|
In[i] = (float)(i % 5);
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ void cNoise3DGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile)
|
|||||||
|
|
||||||
void cNoise3DGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
|
void cNoise3DGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
|
||||||
{
|
{
|
||||||
a_BiomeMap[i] = biExtremeHills;
|
a_BiomeMap[i] = biExtremeHills;
|
||||||
}
|
}
|
||||||
@ -236,7 +236,7 @@ void cNoise3DGenerator::GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DAT
|
|||||||
// Precalculate a "height" array:
|
// Precalculate a "height" array:
|
||||||
NOISE_DATATYPE Height[DIM_X * DIM_Z]; // Output for the cubic noise heightmap ("source")
|
NOISE_DATATYPE Height[DIM_X * DIM_Z]; // Output for the cubic noise heightmap ("source")
|
||||||
m_Cubic.Generate2D(Height, DIM_X, DIM_Z, StartX / 25, EndX / 25, StartZ / 25, EndZ / 25);
|
m_Cubic.Generate2D(Height, DIM_X, DIM_Z, StartX / 25, EndX / 25, StartZ / 25, EndZ / 25);
|
||||||
for (unsigned int i = 0; i < ARRAYCOUNT(Height); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Height); i++)
|
||||||
{
|
{
|
||||||
Height[i] = abs(Height[i]) * m_HeightAmplification + 1;
|
Height[i] = abs(Height[i]) * m_HeightAmplification + 1;
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ void cStructGenLakes::CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a
|
|||||||
cChunkDef::HeightMap HeightMap;
|
cChunkDef::HeightMap HeightMap;
|
||||||
m_HeiGen.GenHeightMap(a_ChunkX, a_ChunkZ, HeightMap);
|
m_HeiGen.GenHeightMap(a_ChunkX, a_ChunkZ, HeightMap);
|
||||||
HEIGHTTYPE MinHeight = HeightMap[0];
|
HEIGHTTYPE MinHeight = HeightMap[0];
|
||||||
for (int i = 1; i < ARRAYCOUNT(HeightMap); i++)
|
for (size_t i = 1; i < ARRAYCOUNT(HeightMap); i++)
|
||||||
{
|
{
|
||||||
if (HeightMap[i] < MinHeight)
|
if (HeightMap[i] < MinHeight)
|
||||||
{
|
{
|
||||||
@ -646,7 +646,7 @@ void cStructGenDirectOverhangs::GenStructures(cChunkDesc & a_ChunkDesc)
|
|||||||
bool cStructGenDirectOverhangs::HasWantedBiome(cChunkDesc & a_ChunkDesc) const
|
bool cStructGenDirectOverhangs::HasWantedBiome(cChunkDesc & a_ChunkDesc) const
|
||||||
{
|
{
|
||||||
cChunkDef::BiomeMap & Biomes = a_ChunkDesc.GetBiomeMap();
|
cChunkDef::BiomeMap & Biomes = a_ChunkDesc.GetBiomeMap();
|
||||||
for (int i = 0; i < ARRAYCOUNT(Biomes); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Biomes); i++)
|
||||||
{
|
{
|
||||||
switch (Biomes[i])
|
switch (Biomes[i])
|
||||||
{
|
{
|
||||||
@ -655,6 +655,10 @@ bool cStructGenDirectOverhangs::HasWantedBiome(cChunkDesc & a_ChunkDesc) const
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // for i
|
} // for i
|
||||||
return false;
|
return false;
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
void DoTest2(void)
|
void DoTest2(void)
|
||||||
{
|
{
|
||||||
float In[3 * 3 * 3];
|
float In[3 * 3 * 3];
|
||||||
for (int i = 0; i < ARRAYCOUNT(In); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(In); i++)
|
||||||
{
|
{
|
||||||
In[i] = (float)(i % 5);
|
In[i] = (float)(i % 5);
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ void cMonster::SetSightDistance(float sd)
|
|||||||
AString cMonster::MobTypeToString(cMonster::eType a_MobType)
|
AString cMonster::MobTypeToString(cMonster::eType a_MobType)
|
||||||
{
|
{
|
||||||
// Mob types aren't sorted, so we need to search linearly:
|
// Mob types aren't sorted, so we need to search linearly:
|
||||||
for (int i = 0; i < ARRAYCOUNT(g_MobTypeNames); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(g_MobTypeNames); i++)
|
||||||
{
|
{
|
||||||
if (g_MobTypeNames[i].m_Type == a_MobType)
|
if (g_MobTypeNames[i].m_Type == a_MobType)
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,7 @@ void cDelayedFluidSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_Chunk
|
|||||||
cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_SimSlotNum];
|
cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_SimSlotNum];
|
||||||
|
|
||||||
// Simulate all the blocks in the scheduled slot:
|
// Simulate all the blocks in the scheduled slot:
|
||||||
for (int i = 0; i < ARRAYCOUNT(Slot.m_Blocks); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Slot.m_Blocks); i++)
|
||||||
{
|
{
|
||||||
cCoordWithIntVector & Blocks = Slot.m_Blocks[i];
|
cCoordWithIntVector & Blocks = Slot.m_Blocks[i];
|
||||||
if (Blocks.empty())
|
if (Blocks.empty())
|
||||||
|
@ -241,7 +241,7 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in
|
|||||||
IsBlockBelowSolid = g_BlockIsSolid[BlockBelow];
|
IsBlockBelowSolid = g_BlockIsSolid[BlockBelow];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
|
||||||
{
|
{
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
@ -317,7 +317,7 @@ void cFireSimulator::TrySpreadFire(cChunk * a_Chunk, int a_RelX, int a_RelY, int
|
|||||||
|
|
||||||
void cFireSimulator::RemoveFuelNeighbors(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ)
|
void cFireSimulator::RemoveFuelNeighbors(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ARRAYCOUNT(gNeighborCoords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(gNeighborCoords); i++)
|
||||||
{
|
{
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
@ -358,7 +358,7 @@ bool cFireSimulator::CanStartFireInBlock(cChunk * a_NearChunk, int a_RelX, int a
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYCOUNT(gNeighborCoords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(gNeighborCoords); i++)
|
||||||
{
|
{
|
||||||
if (!a_NearChunk->UnboundedRelGetBlock(a_RelX + gNeighborCoords[i].x, a_RelY + gNeighborCoords[i].y, a_RelZ + gNeighborCoords[i].z, BlockType, BlockMeta))
|
if (!a_NearChunk->UnboundedRelGetBlock(a_RelX + gNeighborCoords[i].x, a_RelY + gNeighborCoords[i].y, a_RelZ + gNeighborCoords[i].z, BlockType, BlockMeta))
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ bool cFloodyFluidSimulator::CheckTributaries(cChunk * a_Chunk, int a_RelX, int a
|
|||||||
Vector3i( 0, 0, 1),
|
Vector3i( 0, 0, 1),
|
||||||
Vector3i( 0, 0, -1),
|
Vector3i( 0, 0, -1),
|
||||||
} ;
|
} ;
|
||||||
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||||
{
|
{
|
||||||
if (!a_Chunk->UnboundedRelGetBlock(a_RelX + Coords[i].x, a_RelY, a_RelZ + Coords[i].z, BlockType, BlockMeta))
|
if (!a_Chunk->UnboundedRelGetBlock(a_RelX + Coords[i].x, a_RelY, a_RelZ + Coords[i].z, BlockType, BlockMeta))
|
||||||
{
|
{
|
||||||
@ -309,7 +309,7 @@ bool cFloodyFluidSimulator::CheckNeighborsForSource(cChunk * a_Chunk, int a_RelX
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
int NumNeeded = m_NumNeighborsForSource;
|
int NumNeeded = m_NumNeighborsForSource;
|
||||||
for (int i = 0; i < ARRAYCOUNT(NeighborCoords); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(NeighborCoords); i++)
|
||||||
{
|
{
|
||||||
int x = a_RelX + NeighborCoords[i].x;
|
int x = a_RelX + NeighborCoords[i].x;
|
||||||
int y = a_RelY + NeighborCoords[i].y;
|
int y = a_RelY + NeighborCoords[i].y;
|
||||||
|
@ -432,7 +432,7 @@ bool cNBTChunkSerializer::LightIsValid(bool a_IsLightValid)
|
|||||||
void cNBTChunkSerializer::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
|
void cNBTChunkSerializer::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
|
||||||
{
|
{
|
||||||
memcpy(m_Biomes, a_BiomeMap, sizeof(m_Biomes));
|
memcpy(m_Biomes, a_BiomeMap, sizeof(m_Biomes));
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Biomes); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Biomes); i++)
|
||||||
{
|
{
|
||||||
if ((*a_BiomeMap)[i] < 255)
|
if ((*a_BiomeMap)[i] < 255)
|
||||||
{
|
{
|
||||||
|
@ -469,7 +469,7 @@ cChunkDef::BiomeMap * cWSSAnvil::LoadVanillaBiomeMapFromNBT(cChunkDef::BiomeMap
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
const unsigned char * VanillaBiomeData = (const unsigned char *)(a_NBT.GetData(a_TagIdx));
|
const unsigned char * VanillaBiomeData = (const unsigned char *)(a_NBT.GetData(a_TagIdx));
|
||||||
for (int i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++)
|
||||||
{
|
{
|
||||||
if ((VanillaBiomeData)[i] == 0xff)
|
if ((VanillaBiomeData)[i] == 0xff)
|
||||||
{
|
{
|
||||||
@ -497,7 +497,7 @@ cChunkDef::BiomeMap * cWSSAnvil::LoadBiomeMapFromNBT(cChunkDef::BiomeMap * a_Bio
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
const int * BiomeData = (const int *)(a_NBT.GetData(a_TagIdx));
|
const int * BiomeData = (const int *)(a_NBT.GetData(a_TagIdx));
|
||||||
for (int i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++)
|
||||||
{
|
{
|
||||||
(*a_BiomeMap)[i] = (EMCSBiome)(ntohl(BiomeData[i]));
|
(*a_BiomeMap)[i] = (EMCSBiome)(ntohl(BiomeData[i]));
|
||||||
if ((*a_BiomeMap)[i] == 0xff)
|
if ((*a_BiomeMap)[i] == 0xff)
|
||||||
@ -1538,7 +1538,7 @@ unsigned cWSSAnvil::cMCAFile::FindFreeLocation(int a_LocalX, int a_LocalZ, const
|
|||||||
|
|
||||||
// Doesn't fit, append to the end of file (we're wasting a lot of space, TODO: fix this later)
|
// Doesn't fit, append to the end of file (we're wasting a lot of space, TODO: fix this later)
|
||||||
unsigned MaxLocation = 2 << 8; // Minimum sector is #2 - after the headers
|
unsigned MaxLocation = 2 << 8; // Minimum sector is #2 - after the headers
|
||||||
for (int i = 0; i < ARRAYCOUNT(m_Header); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Header); i++)
|
||||||
{
|
{
|
||||||
ChunkLocation = ntohl(m_Header[i]);
|
ChunkLocation = ntohl(m_Header[i]);
|
||||||
ChunkLocation = ChunkLocation + ((ChunkLocation & 0xff) << 8); // Add the number of sectors used; don't care about the 4th byte
|
ChunkLocation = ChunkLocation + ((ChunkLocation & 0xff) << 8); // Add the number of sectors used; don't care about the 4th byte
|
||||||
|
Loading…
Reference in New Issue
Block a user