From 546fcfa3ec6828dba8ebedac449a96284bfd7e06 Mon Sep 17 00:00:00 2001 From: truelight Date: Thu, 30 Dec 2004 10:03:35 +0000 Subject: (svn r1301) -Codechange: _industries finally has FOR_ALL_INDUSTRIES too --- industry_cmd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'industry_cmd.c') diff --git a/industry_cmd.c b/industry_cmd.c index 1cf301282..2e57b59fc 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -1105,7 +1105,7 @@ void OnTick_Industry() if (_game_mode == GM_EDITOR) return; - for(i=_industries; i != endof(_industries); i++) { + FOR_ALL_INDUSTRIES(i) { if (i->xy != 0) ProduceIndustryGoods(i); } @@ -1233,7 +1233,7 @@ static Town *CheckMultipleIndustryInTown(uint tile, int type) if (_patches.multiple_industry_per_town) return t; - for(i=_industries; i != endof(_industries); i++) { + FOR_ALL_INDUSTRIES(i) { if (i->xy != 0 && i->type == (byte)type && i->town == t) { @@ -1366,7 +1366,7 @@ static bool CheckIfTooCloseToIndustry(uint tile, int type) if (_patches.same_industry_close && (spec->accepts_cargo[0] == 0xFF) ) return true; - for(i=_industries; i != endof(_industries); i++) { + FOR_ALL_INDUSTRIES(i) { // check if an industry that accepts the same goods is nearby if (i->xy != 0 && (GetTileDist1D(tile, i->xy) <= 14) && @@ -1391,7 +1391,7 @@ static Industry *AllocateIndustry() { Industry *i; - for(i=_industries; i != endof(_industries); i++) { + FOR_ALL_INDUSTRIES(i) { if (i->xy == 0) { int index = i - _industries; if (index > _total_industries) _total_industries = index; @@ -1807,7 +1807,7 @@ void IndustryMonthlyLoop() byte old_player = _current_player; _current_player = OWNER_NONE; - for(i=_industries; i != endof(_industries); i++) { + FOR_ALL_INDUSTRIES(i) { if (i->xy != 0) UpdateIndustryStatistics(i); } @@ -1887,9 +1887,10 @@ static const byte _industry_desc[] = { static void Save_INDY() { Industry *ind; - int i; + int i = 0; // Write the vehicles - for(ind=_industries,i=0; i!=lengthof(_industries); ind++,i++) { + FOR_ALL_INDUSTRIES(ind) { + i++; if (ind->xy != 0) { SlSetArrayIndex(i); SlObject(ind, _industry_desc); -- cgit v1.2.3-54-g00ecf