aboutsummaryrefslogtreecommitdiff
path: root/taipan.c
diff options
context:
space:
mode:
Diffstat (limited to 'taipan.c')
-rw-r--r--taipan.c98
1 files changed, 52 insertions, 46 deletions
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;