1
0
Fork 0

Fixed compiler warning when iterating over a fixed array of items (ARRAYCOUNT).

This commit is contained in:
madmaxoft 2013-12-20 16:01:34 +01:00
parent b19d765666
commit 8610d45ef1
28 changed files with 66 additions and 62 deletions

View File

@ -290,7 +290,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
{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 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},
} ;
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 z = m_RelZ + Coords[i].z;

View File

@ -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)
{
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());
return;
@ -59,7 +59,7 @@ void cSignEntity::SetLine(int a_Index, const AString & a_Line)
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);
return "";

View File

@ -353,7 +353,7 @@ EMCSBiome StringToBiome(const AString & a_BiomeString)
{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)
{
@ -403,7 +403,7 @@ int StringToMobType(const AString & a_MobString)
{cMonster::mtIronGolem, "IronGolem"},
{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)
{
@ -442,7 +442,7 @@ eDimension StringToDimension(const AString & a_DimensionString)
{ dimEnd, "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)
{
@ -549,7 +549,7 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString)
{ dtFireContact, "dtInFire"},
{ 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)
{
@ -594,14 +594,14 @@ public:
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
for (int i = 0; i < ARRAYCOUNT(g_BlockIsSnowable); i++)
for (size_t i = 0; i < ARRAYCOUNT(g_BlockIsSnowable); i++)
{
g_BlockIsSnowable[i] = true;
}
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
for (int i = 0; i < ARRAYCOUNT(g_BlockIsSolid); i++)
for (size_t i = 0; i < ARRAYCOUNT(g_BlockIsSolid); i++)
{
g_BlockIsSolid[i] = true;
}

View File

@ -48,7 +48,7 @@ public:
{ 0, -1},
{ 0, 1},
} ;
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
{
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;

View File

@ -61,7 +61,7 @@ public:
{-1, 0, 0},
} ;
for (int i = 0; i < ARRAYCOUNT(PortalCheck); i++)
for (size_t i = 0; i < ARRAYCOUNT(PortalCheck); i++)
{
BLOCKTYPE 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},
} ;
for (int i = 0; i < ARRAYCOUNT(PortalCheck); i++)
for (size_t i = 0; i < ARRAYCOUNT(PortalCheck); i++)
{
BLOCKTYPE Block;
a_Chunk.UnboundedRelGetBlockType(a_RelX + PortalCheck[i].x, a_RelY + PortalCheck[i].y, a_RelZ + PortalCheck[i].z, Block);

View File

@ -47,7 +47,7 @@ public:
{ 0, 1},
} ;
a_RelY -= 1;
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
{
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;

View File

@ -89,7 +89,7 @@ public:
{ 1, 0, 8}, // east, XP
} ;
int res = 0;
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
{
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;

View File

@ -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(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;
char Face;

View File

@ -2397,7 +2397,7 @@ cChunkMap::cChunkLayer::cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Pa
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];
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)
{
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
// 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)
{
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
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)
{
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:
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)
{
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
{
if (m_Chunks[i] != NULL)
{
@ -2522,7 +2522,7 @@ void cChunkMap::cChunkLayer::RemoveClient(cClientHandle * a_Client)
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
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())
{
@ -2542,7 +2542,7 @@ bool cChunkMap::cChunkLayer::ForEachEntity(cEntityCallback & a_Callback)
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.
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())
{
@ -2561,7 +2561,7 @@ bool cChunkMap::cChunkLayer::DoWithEntityByID(int a_EntityID, cEntityCallback &
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())
{
@ -2581,7 +2581,7 @@ bool cChunkMap::cChunkLayer::HasEntity(int a_EntityID)
int cChunkMap::cChunkLayer::GetNumChunksLoaded(void) const
{
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)
{
@ -2599,7 +2599,7 @@ void cChunkMap::cChunkLayer::GetChunkStats(int & a_NumChunksValid, int & a_NumCh
{
int NumValid = 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)
{
@ -2622,7 +2622,7 @@ void cChunkMap::cChunkLayer::GetChunkStats(int & a_NumChunksValid, int & a_NumCh
void cChunkMap::cChunkLayer::Save(void)
{
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())
{
@ -2637,7 +2637,7 @@ void cChunkMap::cChunkLayer::Save(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 (
(m_Chunks[i] != NULL) && // Is valid

View File

@ -275,7 +275,7 @@ void cChunkSender::Entity(cEntity * a_Entity)
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)
{

View File

@ -181,7 +181,7 @@ int cEnchantments::StringToEnchantmentID(const AString & a_EnchantmentName)
{ enchLuckOfTheSea, "LuckOfTheSea"},
{ 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)
{

View File

@ -574,7 +574,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
} ;
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))
{

View File

@ -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)
{
for (int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
for (size_t i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
{
a_BiomeMap[i] = m_Biome;
}
@ -277,7 +277,7 @@ void cBiomeGenList::InitializeBiomes(const AString & a_Biomes)
biJungleHills,
} ;
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]);
}
@ -655,7 +655,7 @@ void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(int a_ChunkX, int a_Chunk
LinearUpscale2DArrayInPlace(HumidityMap, 17, 17, 8, 8);
// 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_HumidityMap[idx] = std::max(0, std::min(255, (int)(128 + HumidityMap[idx] * 128)));

View File

@ -371,7 +371,7 @@ void cChunkDesc::ReadBlockArea(cBlockArea & a_Dest, int a_MinRelX, int a_MaxRelX
HEIGHTTYPE cChunkDesc::GetMaxHeight(void) const
{
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)
{
@ -565,7 +565,7 @@ cBlockEntity * cChunkDesc::GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ)
void cChunkDesc::CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas)
{
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);
}

View File

@ -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:
NOISE_DATATYPE AmpX = 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)
{

View File

@ -151,7 +151,7 @@ void cEndGen::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_
{
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;
}

View File

@ -271,7 +271,7 @@ void cFinishGenIce::GenFinish(cChunkDesc & a_ChunkDesc)
int cFinishGenSingleBiomeSingleTopBlock::GetNumToGen(const cChunkDef::BiomeMap & a_BiomeMap)
{
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)
{
@ -469,7 +469,7 @@ void cFinishGenPreSimulator::StationarizeFluid(
{0, -1, 0}
} ;
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))
{
@ -635,7 +635,7 @@ bool cFinishGenFluidSprings::TryPlaceSpring(cChunkDesc & a_ChunkDesc, int x, int
{ 0, 0, 1},
} ;
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))
{

View File

@ -18,7 +18,7 @@
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;
}
@ -421,7 +421,7 @@ NOISE_DATATYPE cHeiGenBiomal::GetHeightAt(int a_RelX, int a_RelZ, int a_ChunkX,
NOISE_DATATYPE Height = 0;
int BlockX = a_ChunkX * cChunkDef::Width + a_RelX;
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)
{

View File

@ -1035,7 +1035,7 @@ void cMineShaftCrossing::AppendBranches(int a_RecursionLevel, cNoise & a_Noise)
{ 5, 5, 2, dirXP},
{ 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)
{

View File

@ -30,7 +30,7 @@ public:
void DoTest1(void)
{
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);
}
@ -44,7 +44,7 @@ public:
void DoTest2(void)
{
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);
}
@ -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)
{
for (unsigned int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
for (size_t i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
{
a_BiomeMap[i] = biExtremeHills;
}
@ -236,7 +236,7 @@ void cNoise3DGenerator::GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DAT
// Precalculate a "height" array:
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);
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;
}

View File

@ -467,7 +467,7 @@ void cStructGenLakes::CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a
cChunkDef::HeightMap HeightMap;
m_HeiGen.GenHeightMap(a_ChunkX, a_ChunkZ, HeightMap);
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)
{
@ -646,7 +646,7 @@ void cStructGenDirectOverhangs::GenStructures(cChunkDesc & a_ChunkDesc)
bool cStructGenDirectOverhangs::HasWantedBiome(cChunkDesc & a_ChunkDesc) const
{
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])
{
@ -655,6 +655,10 @@ bool cStructGenDirectOverhangs::HasWantedBiome(cChunkDesc & a_ChunkDesc) const
{
return true;
}
default:
{
break;
}
}
} // for i
return false;

View File

@ -39,7 +39,7 @@ public:
void DoTest2(void)
{
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);
}

View File

@ -571,7 +571,7 @@ void cMonster::SetSightDistance(float sd)
AString cMonster::MobTypeToString(cMonster::eType a_MobType)
{
// 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)
{

View File

@ -137,7 +137,7 @@ void cDelayedFluidSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_Chunk
cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_SimSlotNum];
// 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];
if (Blocks.empty())

View File

@ -241,7 +241,7 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in
IsBlockBelowSolid = g_BlockIsSolid[BlockBelow];
}
for (int i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
{
BLOCKTYPE BlockType;
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)
{
for (int i = 0; i < ARRAYCOUNT(gNeighborCoords); i++)
for (size_t i = 0; i < ARRAYCOUNT(gNeighborCoords); i++)
{
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
@ -358,7 +358,7 @@ bool cFireSimulator::CanStartFireInBlock(cChunk * a_NearChunk, int a_RelX, int a
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))
{

View File

@ -143,7 +143,7 @@ bool cFloodyFluidSimulator::CheckTributaries(cChunk * a_Chunk, int a_RelX, int a
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))
{
@ -309,7 +309,7 @@ bool cFloodyFluidSimulator::CheckNeighborsForSource(cChunk * a_Chunk, int a_RelX
} ;
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 y = a_RelY + NeighborCoords[i].y;

View File

@ -432,7 +432,7 @@ bool cNBTChunkSerializer::LightIsValid(bool a_IsLightValid)
void cNBTChunkSerializer::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap)
{
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)
{

View File

@ -469,7 +469,7 @@ cChunkDef::BiomeMap * cWSSAnvil::LoadVanillaBiomeMapFromNBT(cChunkDef::BiomeMap
return NULL;
}
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)
{
@ -497,7 +497,7 @@ cChunkDef::BiomeMap * cWSSAnvil::LoadBiomeMapFromNBT(cChunkDef::BiomeMap * a_Bio
return NULL;
}
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]));
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)
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 = ChunkLocation + ((ChunkLocation & 0xff) << 8); // Add the number of sectors used; don't care about the 4th byte