[General] Use pre-incrementation in for loops

This commit is contained in:
momo5502 2016-12-22 01:32:07 +01:00
parent 56ba9d0ed6
commit 64e76c905e
4 changed files with 15 additions and 15 deletions

View File

@ -399,7 +399,7 @@ namespace Components
dwSize += GetLengthSid(psidArray[0]);
dwSize += sizeof(ACCESS_DENIED_ACE) - sizeof(DWORD);
for (UINT i = 1; i < _countof(psidArray); i++)
for (UINT i = 1; i < _countof(psidArray); ++i)
{
// DWORD is the SidStart field, which is not used for absolute format
dwSize += GetLengthSid(psidArray[i]);

View File

@ -134,15 +134,15 @@ namespace Components
// Fix shader const stuff
if (type == Game::XAssetType::ASSET_TYPE_TECHSET && Zones::Version() >= 359)
{
for (int i = 0; i < 48; i++)
for (int i = 0; i < 48; ++i)
{
if (asset.techniqueSet->techniques[i])
{
for (int j = 0; j < asset.techniqueSet->techniques[i]->numPasses; j++)
for (int j = 0; j < asset.techniqueSet->techniques[i]->numPasses; ++j)
{
Game::MaterialPass* pass = &asset.techniqueSet->techniques[i]->passes[j];
for (int k = 0; k < (pass->argCount1 + pass->argCount2 + pass->argCount3); k++)
for (int k = 0; k < (pass->argCount1 + pass->argCount2 + pass->argCount3); ++k)
{
if (pass->argumentDef[k].type == D3DSHADER_PARAM_REGISTER_TYPE::D3DSPR_CONSTINT)
{

View File

@ -416,7 +416,7 @@ namespace Assets
buffer->pushBlock(Game::XFILE_BLOCK_RUNTIME);
for (int i = 0; i < 2; i++)
for (int i = 0; i < 2; ++i)
{
if (asset->dynEntPoseList[i])
{
@ -429,7 +429,7 @@ namespace Assets
}
}
for (int i = 0; i < 2; i++)
for (int i = 0; i < 2; ++i)
{
if (asset->dynEntClientList[i])
{
@ -441,7 +441,7 @@ namespace Assets
}
}
for (int i = 0; i < 2; i++)
for (int i = 0; i < 2; ++i)
{
if (asset->dynEntCollList[i])
{
@ -466,7 +466,7 @@ namespace Assets
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, m->name);
}
for (int j = 0; j < 2; j++)
for (int j = 0; j < 2; ++j)
{
Game::DynEntityDef* def = asset->dynEntDefList[j];

View File

@ -306,7 +306,7 @@ namespace Components
map.append(fmt::sprintf("mtllib %s.mtl\n\n", world->baseName));
Logger::Print("Writing vertices...\n");
for (unsigned int i = 0; i < world->worldDraw.vertexCount; i++)
for (unsigned int i = 0; i < world->worldDraw.vertexCount; ++i)
{
float x = world->worldDraw.vd.vertices[i].xyz[1];
float y = world->worldDraw.vd.vertices[i].xyz[2];
@ -318,7 +318,7 @@ namespace Components
map.append("\n");
Logger::Print("Writing texture coordinates...\n");
for (unsigned int i = 0; i < world->worldDraw.vertexCount; i++)
for (unsigned int i = 0; i < world->worldDraw.vertexCount; ++i)
{
map.append(fmt::sprintf("vt %.6f %.6f\n", world->worldDraw.vd.vertices[i].texCoord[0], -world->worldDraw.vd.vertices[i].texCoord[1]));
}
@ -327,11 +327,11 @@ namespace Components
int materialCount = 0;
Game::Material** materials = allocator.allocateArray<Game::Material*>(world->dpvs.staticSurfaceCount);
for (unsigned int i = 0; i < world->dpvs.staticSurfaceCount; i++)
for (unsigned int i = 0; i < world->dpvs.staticSurfaceCount; ++i)
{
bool isNewMat = true;
for (int j = 0; j < materialCount; j++)
for (int j = 0; j < materialCount; ++j)
{
if (world->dpvs.surfaces[i].material == materials[j])
{
@ -350,7 +350,7 @@ namespace Components
mtl.append(fmt::sprintf("# Material Count: %d\n", materialCount));
Logger::Print("Exporting materials and faces...\n");
for (int m = 0; m < materialCount; m++)
for (int m = 0; m < materialCount; ++m)
{
std::string name = materials[m]->name;
@ -386,14 +386,14 @@ namespace Components
mtl.append(fmt::sprintf("map_Ka textures/%s.png\n", image->name));
mtl.append(fmt::sprintf("map_Kd textures/%s.png\n", image->name));
for (unsigned int i = 0; i < world->dpvs.staticSurfaceCount; i++)
for (unsigned int i = 0; i < world->dpvs.staticSurfaceCount; ++i)
{
if (world->dpvs.surfaces[i].material != materials[m])
continue;
int vertOffset = world->dpvs.surfaces[i].tris.firstVertex + 1;//+1 cus obj starts at 1
int indexOffset = world->dpvs.surfaces[i].tris.baseIndex;
for (unsigned short j = 0; j < world->dpvs.surfaces[i].tris.triCount; j++)
for (unsigned short j = 0; j < world->dpvs.surfaces[i].tris.triCount; ++j)
{
int a = world->worldDraw.indices[indexOffset + j * 3 + 0] + vertOffset;
int b = world->worldDraw.indices[indexOffset + j * 3 + 1] + vertOffset;