diff options
author | B. Watson <yalhcru@gmail.com> | 2021-05-30 12:59:22 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2021-05-30 12:59:22 -0400 |
commit | fd0f91a029361e4bd6406bc89f1d117747f880c4 (patch) | |
tree | ec4d083933c41f9153e25c1f198c00dfd4980af2 | |
parent | 0f32f20974ea45ac63cb219dcd0a2f9b0205fd45 (diff) | |
download | taipan-fd0f91a029361e4bd6406bc89f1d117747f880c4.tar.gz |
Fix booty calculation so it works like the Apple version (costs 27 bytes)
-rw-r--r-- | taipan.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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(); |