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
commitbfa618ef89acccb22e78b9007099e57cbb220de0 (patch)
tree4897e33be879a0834fafa10d7743d6d9f0997d6a
parent54b88bc8e6b3688b9bf9d1da0afa2e25d828e772 (diff)
downloadopenttd-bfa618ef89acccb22e78b9007099e57cbb220de0.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;
}
}