diff options
author | glx <glx@openttd.org> | 2008-02-25 16:30:12 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2008-02-25 16:30:12 +0000 |
commit | 4a4be744b67e0435e6c57583cf7bcd3dd79bd321 (patch) | |
tree | 0199c66ebc6adc3885a21abcd36de9d4b703aa32 /src | |
parent | e41df385d7a5aa6b650d08ab14eb7d2c494064f5 (diff) | |
download | openttd-4a4be744b67e0435e6c57583cf7bcd3dd79bd321.tar.xz |
(svn r12258) -Fix: GetProductionAroundTiles() may fail if only the second production slot exists
Diffstat (limited to 'src')
-rw-r--r-- | src/station_cmd.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 995064f5b..c7c0ec537 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -474,11 +474,8 @@ void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile, CargoID cargos[2] = { CT_INVALID, CT_INVALID }; gpc(tile, cargos); - if (cargos[0] != CT_INVALID) { - produced[cargos[0]]++; - if (cargos[1] != CT_INVALID) { - produced[cargos[1]]++; - } + for (uint i = 0; i < lengthof(cargos); ++i) { + if (cargos[i] != CT_INVALID) produced[cargos[i]]++; } } } |