diff options
author | B. Watson <yalhcru@gmail.com> | 2021-04-14 04:24:45 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2021-04-14 04:24:45 -0400 |
commit | 3a5074edcf8c19825f509c4a19407dad1a0e659b (patch) | |
tree | 7f2850aebbe28ccafe751398fb4a16f41103b347 | |
parent | d77dd55c91a846830d405bb05e6f7a4609aad345 (diff) | |
download | taipan-3a5074edcf8c19825f509c4a19407dad1a0e659b.tar.gz |
Allow player to abort "where do you wish to go" (costs 30 bytes)
-rw-r--r-- | NOTES.txt | 8 | ||||
-rw-r--r-- | taipan.c | 98 |
2 files changed, 57 insertions, 49 deletions
@@ -39,9 +39,11 @@ Deliberate differences between the Apple II and Atari ports: 5. Added a way to change the background color and text brightness. Only 4 brightness levels, but all 16 Atari hues are available. -6. The "do you wish me to go to:" prompt shows the ports' number in - inverse video, except for the port you're currently at (to let you - know that's an invalid choice). +6. The "do you wish me to go to:" prompt is different: + - It shows the ports' numbers in inverse video, except for the port + you're currently at (to let you know that's an invalid choice). + - You can press Enter to abort, in case you hit Q by accident. This + just returns you to the port status screen. 7. Prompts that only accept one character no longer require pressing Enter. Gameplay is more streamlined this way. Apple and Linux are inconsistent: @@ -2289,13 +2289,8 @@ void transfer(void) { return; } -void quit(void) -{ -#ifdef BIGNUM - bignum(banktmp); -#endif - unsigned char result = 0, choice, sunk; - int damagepct; +unsigned char choose_port(void) { + unsigned char choice; compradores_report(); cprint_taipan_comma(); @@ -2333,11 +2328,20 @@ void quit(void) print_msg(M_already_here); cprint_taipan_period(); good_joss_timed_getch(); - } else if((choice >= 1) && (choice <= 7)) { - port = choice; - break; - } + } else if(choice <= 7) { + return choice; + } else { /* backspace, enter, etc */ + return 0; + } } +} + +void quit(void) { +#ifdef BIGNUM + bignum(banktmp); +#endif + unsigned char result = 0, sunk; + int damagepct; at_sea(); captains_report(); @@ -3396,8 +3400,6 @@ int main(void) { set_prices(); for (;;) { - choice = 0; - port_stats(); if(wu_assassin) { @@ -3569,41 +3571,45 @@ int main(void) { under_attack_timed_getch(); } - for(;;) { - while(choice != 'q') { - switch (choice = port_choices()) { - case 'b': - buy(); - break; - - case 's': - sell(); - break; - - case 'v': - visit_bank(); - break; - - case 't': - transfer(); - break; - - case 'r': - retire(); - } + for(;;) { + static unsigned char new_port; + new_port = 0; + while(!new_port) { + switch (choice = port_choices()) { + case 'b': + buy(); + break; + + case 's': + sell(); + break; + + case 'v': + visit_bank(); + break; + + case 't': + transfer(); + break; + + case 'q': + if(hold < 0) + overload(); + else + new_port = choose_port(); + break; + + case 'r': + retire(); + } - port_stats(); - } + port_stats(); + } - choice = 0; - if (hold >= 0) - { - quit(); - break; - } else { - overload(); - } - } + port = new_port; + quit(); + break; + } } return 0; |