mirror of https://github.com/OpenTTD/OpenTTD
(svn r3190) Turn some loops into canonical for loop form
parent
66d44766a7
commit
3bf8d2ccbb
|
@ -1765,8 +1765,7 @@ static void AiStateBuildDefaultRailBlocks(Player *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// do the following 8 times
|
// do the following 8 times
|
||||||
i = 8;
|
for (i = 0; i < 8; i++) {
|
||||||
do {
|
|
||||||
// check if we can build the default track
|
// check if we can build the default track
|
||||||
aib = &p->ai.src;
|
aib = &p->ai.src;
|
||||||
j = p->ai.num_build_rec;
|
j = p->ai.num_build_rec;
|
||||||
|
@ -1808,7 +1807,7 @@ static void AiStateBuildDefaultRailBlocks(Player *p)
|
||||||
assert(r != CMD_ERROR);
|
assert(r != CMD_ERROR);
|
||||||
}
|
}
|
||||||
} while (++aib,--j);
|
} while (++aib,--j);
|
||||||
} while (--i);
|
}
|
||||||
|
|
||||||
// check if we're done with all of them
|
// check if we're done with all of them
|
||||||
aib = &p->ai.src;
|
aib = &p->ai.src;
|
||||||
|
|
|
@ -904,9 +904,9 @@ static void Disaster7_Init(void)
|
||||||
{
|
{
|
||||||
int index = GB(Random(), 0, 4);
|
int index = GB(Random(), 0, 4);
|
||||||
Industry *i;
|
Industry *i;
|
||||||
int maxloop = 15;
|
uint m;
|
||||||
|
|
||||||
do {
|
for (m = 0; m < 15; m++) {
|
||||||
FOR_ALL_INDUSTRIES(i) {
|
FOR_ALL_INDUSTRIES(i) {
|
||||||
if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) {
|
if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) {
|
||||||
|
|
||||||
|
@ -917,17 +917,17 @@ static void Disaster7_Init(void)
|
||||||
{
|
{
|
||||||
TileIndex tile = i->xy;
|
TileIndex tile = i->xy;
|
||||||
TileIndexDiff step = TileOffsByDir(GB(Random(), 0, 2));
|
TileIndexDiff step = TileOffsByDir(GB(Random(), 0, 2));
|
||||||
|
uint n;
|
||||||
|
|
||||||
int count = 30;
|
for (n = 0; n < 30; i++) {
|
||||||
do {
|
|
||||||
DisasterClearSquare(tile);
|
DisasterClearSquare(tile);
|
||||||
tile = TILE_MASK(tile + step);
|
tile = TILE_MASK(tile + step);
|
||||||
} while (--count);
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (--maxloop != 0);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DisasterInitProc * const _disaster_initprocs[] = {
|
static DisasterInitProc * const _disaster_initprocs[] = {
|
||||||
|
|
|
@ -1277,13 +1277,10 @@ void ShowNewgrf(void)
|
||||||
|
|
||||||
{ // little helper function to calculate _grffile_count
|
{ // little helper function to calculate _grffile_count
|
||||||
// should be REMOVED once _grffile_count is calculated at loading
|
// should be REMOVED once _grffile_count is calculated at loading
|
||||||
const GRFFile* c = _first_grffile;
|
const GRFFile* c;
|
||||||
|
|
||||||
_grffile_count = 0;
|
_grffile_count = 0;
|
||||||
while (c != NULL) {
|
for (c = _first_grffile; c != NULL; c = c->next) _grffile_count++;
|
||||||
_grffile_count++;
|
|
||||||
c = c->next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
w->vscroll.cap = 12;
|
w->vscroll.cap = 12;
|
||||||
|
|
Loading…
Reference in New Issue