aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NOTES.txt8
-rw-r--r--taipan.c98
2 files changed, 57 insertions, 49 deletions
diff --git a/NOTES.txt b/NOTES.txt
index 813836f..a8586d2 100644
--- a/NOTES.txt
+++ b/NOTES.txt
@@ -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:
diff --git a/taipan.c b/taipan.c
index 25f0855..99e7581 100644
--- a/taipan.c
+++ b/taipan.c
@@ -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;