aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--taipan.c87
1 files changed, 46 insertions, 41 deletions
diff --git a/taipan.c b/taipan.c
index 039db7e..fc346ff 100644
--- a/taipan.c
+++ b/taipan.c
@@ -259,11 +259,25 @@ char *item[] = { "Opium", "Silk", "Arms", "General Cargo" };
char *location[] = { "At sea", "Hong Kong", "Shanghai", "Nagasaki",
"Saigon", "Manila", "Singapore", "Batavia" };
+/*
char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+ */
+char *months = "Jan\0Feb\0Mar\0Apr\0May\0Jun\0Jul\0Aug\0Sep\0Oct\0Nov\0Dec\0";
+
+char *st[] = {
+ "\xc3\xf2\xe9\xf4\xe9\xe3\xe1\xec", // inverse "Critical"
+ "\xa0\xa0\xd0\xef\xef\xf2", // inverse " Poor"
+ " Fair",
+ " Good",
+ " Prime",
+ "Perfect"
+};
+/*
char *st[] = { "Critical", " Poor", " Fair",
" Good", " Prime", "Perfect" };
+ */
#ifdef BIGNUM
bignum(bank) = BIG_0;
@@ -1434,14 +1448,12 @@ void port_stats(void)
#endif
/* dynamic stuff: */
- // cursor(0);
gotoxy(firmpos, 0);
cputs("Firm: ");
cputs(firm);
cputs(", Hong Kong");
gotoxy(21, 4);
- // in_use = hkw_[0] + hkw_[1] + hkw_[2] + hkw_[3];
in_use = warehouse_in_use();
cblank(5);
cprintulong(in_use);
@@ -1450,6 +1462,13 @@ void port_stats(void)
cblank(5);
cprintulong(10000 - in_use);
+ for(i = 0; i < 4; ++i) {
+ gotoxy(12, i + 3);
+ cblank(5);
+ cprintulong(hkw_[i]);
+ }
+
+ /*
gotoxy(12, 3);
cblank(5);
cprintulong(hkw_[0]);
@@ -1465,9 +1484,10 @@ void port_stats(void)
gotoxy(12, 6);
cblank(5);
cprintulong(hkw_[3]);
+ */
gotoxy(7, 8);
- if (hold >= 0) {
+ if(hold >= 0) {
cblank(8);
cprintulong(hold);
} else {
@@ -1480,6 +1500,13 @@ void port_stats(void)
cblank(5);
cprintulong(guns);
+ for(i = 0; i < 4; ++i) {
+ gotoxy(12, i + 9);
+ cblank(9);
+ cprintulong(hold_[i]);
+ }
+
+ /*
gotoxy(12, 9);
cblank(9);
cprintulong(hold_[0]);
@@ -1495,10 +1522,11 @@ void port_stats(void)
gotoxy(12, 12);
cblank(9);
cprintulong(hold_[3]);
+ */
gotoxy(32, 3);
revers(1);
- cputs(months[month - 1]);
+ cputs(months + 4 * (month - 1));
revers(0);
cspace();
cprintulong(year);
@@ -1517,11 +1545,11 @@ void port_stats(void)
gotoxy(29, 12);
clrtoeol();
i = status / 20;
- if(i < 2) revers(1);
+ // if(i < 2) revers(1);
cputs(st[i]);
cputc(':');
cprintulong(status);
- revers(0);
+ // revers(0);
gotoxy(6, 14);
cblank(14);
@@ -2692,7 +2720,6 @@ int port_choices(void) {
void name_firm(void) {
unsigned char input, firmlen = 0;
- // cursor(0);
clrscr();
chlinexy(1, 7, 38);
@@ -2709,7 +2736,6 @@ void name_firm(void) {
gotoxy(2, 11);
cputs("What will you name your");
gotoxy(6, 13);
- // cursor(1);
cputs("Firm:");
chlinexy(12, 14, 22);
@@ -2732,26 +2758,25 @@ void name_firm(void) {
}
}
- // cursor(0);
firm[firmlen] = '\0';
firmpos = 12 - firmlen / 2;
return;
}
-void what_do_you_wish_me_to(void) {
+char what_do_you_wish_me_to(char buy_or_sell) {
+ gotoxy(0, 22);
+ clrtobot();
cputs("What do you wish me to ");
+ cputs(buy_or_sell ? "buy" : "sell");
+ cprint_taipan_prompt();
+ return get_item(0);
}
void buy(void) {
- int choice = 0;
+ int choice;
unsigned long afford, amount;
- gotoxy(0, 22);
- clrtobot();
- what_do_you_wish_me_to();
- cputs("buy");
- cprint_taipan_prompt();
- choice = get_item(0);
+ choice = what_do_you_wish_me_to(1);
for (;;) {
gotoxy(31, 21);
@@ -2769,7 +2794,6 @@ void buy(void) {
revers(1);
cputs(" afford ");
gotoxy(31, 23);
- // cputs(" ");
cspaces(9);
gotoxy(31, 23);
@@ -2801,15 +2825,10 @@ void buy(void) {
}
void sell(void) {
- int choice = 0;
+ int choice;
unsigned long amount;
- gotoxy(0, 22);
- clrtobot();
- what_do_you_wish_me_to();
- cputs("sell");
- cprint_taipan_prompt();
- choice = get_item(0);
+ choice = what_do_you_wish_me_to(0);
for (;;) {
gotoxy(0, 22);
@@ -2821,8 +2840,7 @@ void sell(void) {
amount = get_num();
- if (amount == UINT32_MAX)
- {
+ if (amount == UINT32_MAX) {
amount = hold_[choice];
}
@@ -2831,8 +2849,7 @@ void sell(void) {
continue;
}
- if (hold_[choice] >= amount)
- {
+ if (hold_[choice] >= amount) {
hold_[choice] -= amount;
break;
}
@@ -2911,18 +2928,6 @@ void visit_bank(void)
ulong_to_big(cash, bigcash);
big_sub(biglimit, big_max_ulong, bigcash);
- /*
- cputs("\rcash ");
- cprintfancy_big(bigcash);
- agetc();
- cputs("\ramt ");
- cprintfancy_big(bigamt);
- agetc();
- cputs("\rlimit ");
- cprintfancy_big(biglimit);
- agetc();
- */
-
if(big_cmp(bigamt, biglimit) >= 0) {
too_much_cash();
continue;