aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--taipan.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/taipan.c b/taipan.c
index 7b0396f..884af0e 100644
--- a/taipan.c
+++ b/taipan.c
@@ -1310,9 +1310,13 @@ char sea_battle(char id, int num_ships) {
time = get_time();
s0 = num_ships;
- booty = (time / 4 * 1000 * num_ships) + randi()%1000 + 250;
- if(would_overflow(cash, booty)) {
- booty = 0L;
+ /* This calculation was different in the Apple and Linux ports. I went
+ with the Apple version. */
+ booty = randclamp((long)(time / 4L * 1000L * num_ships)) + (long)(randi()%1000 + 250);
+
+ /* Not ideal, but better than 'booty = 0L' I think. */
+ while(would_overflow(cash, booty)) {
+ booty >>= 1;
}
clear_ships_on_screen();