summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-05-10 15:42:59 +0000
committerfrosch <frosch@openttd.org>2009-05-10 15:42:59 +0000
commit552f10bb09667a7c36724092d290808c2c9e51b4 (patch)
treebea69c92d2e37a1a34b1d9f9c73d4209c3e050e4
parentbdf0b9491de344b8b71aabbdc4d23b5f8f3d3725 (diff)
downloadopenttd-552f10bb09667a7c36724092d290808c2c9e51b4.tar.xz
(svn r16268) -Fix (r9876): When callback 2E returns an amount of 0, do not transport 1 unit to the station.
-rw-r--r--src/station_cmd.cpp3
-rw-r--r--src/town_cmd.cpp2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 9289fa39a..23ac09e7b 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2973,6 +2973,9 @@ void FindStationsAroundTiles(TileIndex tile, int w_prod, int h_prod, StationList
uint MoveGoodsToStation(TileIndex tile, int w, int h, CargoID type, uint amount)
{
+ /* Return if nothing to do. Also the rounding below fails for 0. */
+ if (amount == 0) return 0;
+
Station *st1 = NULL; // Station with best rating
Station *st2 = NULL; // Second best station
uint best_rating1 = 0; // rating of st1
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 9b46343db..200f650a7 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -455,6 +455,8 @@ static void TileLoop_Town(TileIndex tile)
if (cargo == CT_INVALID) continue;
uint amt = GB(callback, 0, 8);
+ if (amt == 0) continue;
+
uint moved = MoveGoodsToStation(tile, 1, 1, cargo, amt);
const CargoSpec *cs = GetCargo(cargo);