changeset 11874:1091625b3d21 draft

(svn r16268) -Fix (r9876): When callback 2E returns an amount of 0, do not transport 1 unit to the station.
author frosch <frosch@openttd.org>
date Sun, 10 May 2009 15:42:59 +0000
parents ed0cb1f1acbf
children 86fca539ec7a
files src/station_cmd.cpp src/town_cmd.cpp
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2973,6 +2973,9 @@
 
 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
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -455,6 +455,8 @@
 			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);