equal
deleted
inserted
replaced
2409 waiting = max((int)waiting - (int)GB(r, 8, 2) - 1, 0); |
2409 waiting = max((int)waiting - (int)GB(r, 8, 2) - 1, 0); |
2410 waiting_changed = true; |
2410 waiting_changed = true; |
2411 } |
2411 } |
2412 } |
2412 } |
2413 |
2413 |
|
2414 /* At some point we really must cap the cargo. Previously this |
|
2415 * was a strict 4095, but now we'll have a less strict, but |
|
2416 * increasingly agressive truncation of the amount of cargo. */ |
|
2417 static const uint WAITING_CARGO_THRESHOLD = 1 << 12; |
|
2418 static const uint WAITING_CARGO_CUT_FACTOR = 1 << 6; |
|
2419 static const uint MAX_WAITING_CARGO = 1 << 15; |
|
2420 |
|
2421 if (waiting > WAITING_CARGO_THRESHOLD) { |
|
2422 uint difference = waiting - WAITING_CARGO_THRESHOLD; |
|
2423 waiting -= (difference / WAITING_CARGO_CUT_FACTOR); |
|
2424 |
|
2425 waiting = min(waiting, MAX_WAITING_CARGO); |
|
2426 waiting_changed = true; |
|
2427 } |
|
2428 |
2414 if (waiting_changed) ge->cargo.Truncate(waiting); |
2429 if (waiting_changed) ge->cargo.Truncate(waiting); |
2415 } |
2430 } |
2416 } |
2431 } |
2417 } while (++ge != endof(st->goods)); |
2432 } while (++ge != endof(st->goods)); |
2418 |
2433 |