summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-01-14 18:38:40 +0000
committerpeter1138 <peter1138@openttd.org>2007-01-14 18:38:40 +0000
commitb4dbfe5e599cf1557968890c74d7f10b05926b4a (patch)
tree4897e33be879a0834fafa10d7743d6d9f0997d6a
parent5b191118175a4b09209444408a77cb561569abd0 (diff)
downloadopenttd-b4dbfe5e599cf1557968890c74d7f10b05926b4a.tar.xz
(svn r8120) -Fix (r8055): Station cargo waiting value clamp should be signed not unsigned. This resulted in cargo magically appearing...
-rw-r--r--src/station_cmd.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index ea89c45f9..e0e508923 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2524,8 +2524,8 @@ static void UpdateStationRating(Station *st)
// if rating is <= 127 and there are any items waiting, maybe remove some goods.
if (rating <= 127 && waiting != 0) {
uint32 r = Random();
- if ( (uint)rating <= (r & 0x7F) ) {
- waiting = max(waiting - ((r >> 8)&3) - 1, 0U);
+ if (rating <= (int)GB(r, 0, 7)) {
+ waiting = max(waiting - (int)GB(r, 8, 2) - 1, 0);
waiting_changed = true;
}
}