diff options
author | belugas <belugas@openttd.org> | 2006-04-26 17:01:27 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2006-04-26 17:01:27 +0000 |
commit | 8d622e04f8b98f530e030a6de3b282aebc4a49f5 (patch) | |
tree | ce87ebfffc0dda195267aa989535455f2cd756be /industry_cmd.c | |
parent | 8443f43d1f7fc6191d9ff0944ccf7bc3f79a1210 (diff) | |
download | openttd-8d622e04f8b98f530e030a6de3b282aebc4a49f5.tar.xz |
(svn r4578) CodeChange : Cleanup of industry_cmd (Step-2).
Removing the _industry_min_cargo[] in favor of IndustrySpec.minimal_cargo,
IndustrySpec.a,b,c are now conflicting[], add an enum for IndustrySpec.checkproc
Work of tfc_team
Diffstat (limited to 'industry_cmd.c')
-rw-r--r-- | industry_cmd.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index 7d34f08c4..f88db79d7 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -444,22 +444,14 @@ static int32 ClearTile_Industry(TileIndex tile, byte flags) return 0; } - -static const byte _industry_min_cargo[] = { - 5, 5, 5, 30, 5, 5, 5, 5, - 5, 5, 5, 5, 2, 5, 5, 5, - 5, 5, 5, 15, 15, 5, 5, 5, - 5, 5, 30, 5, 30, 5, 5, 5, - 5, 5, 5, 5, 5, -}; - static void TransportIndustryGoods(TileIndex tile) { Industry *i = GetIndustryByTile(tile); + const IndustrySpec *spec = GetIndustrySpecification(i->type); uint cw, am; cw = min(i->cargo_waiting[0], 255); - if (cw > _industry_min_cargo[i->type]/* && i->produced_cargo[0] != 0xFF*/) { + if (cw > spec->minimal_cargo/* && i->produced_cargo[0] != 0xFF*/) { i->cargo_waiting[0] -= cw; /* fluctuating economy? */ @@ -482,7 +474,7 @@ static void TransportIndustryGoods(TileIndex tile) } cw = min(i->cargo_waiting[1], 255); - if (cw > _industry_min_cargo[i->type]) { + if (cw > spec->minimal_cargo) { i->cargo_waiting[1] -= cw; if (_economy.fluct <= 0) cw = (cw + 1) / 2; @@ -1214,7 +1206,7 @@ static bool CheckNewIndustry_BubbleGen(TileIndex tile, IndustryType type) } typedef bool CheckNewIndustryProc(TileIndex tile, IndustryType type); -static CheckNewIndustryProc * const _check_new_industry_procs[] = { +static CheckNewIndustryProc * const _check_new_industry_procs[CHECK_END] = { CheckNewIndustry_NULL, CheckNewIndustry_Forest, CheckNewIndustry_Oil, @@ -1383,7 +1375,7 @@ static bool CheckIfTooCloseToIndustry(TileIndex tile, int type) // check "not close to" field. if (i->xy != 0 && - (i->type == spec->a || i->type == spec->b || i->type == spec->c) && + (i->type == spec->conflicting[0] || i->type == spec->conflicting[1] || i->type == spec->conflicting[2]) && DistanceMax(tile, i->xy) <= 14) { _error_message = STR_INDUSTRY_TOO_CLOSE; return false; |