aboutsummaryrefslogtreecommitdiff
path: root/taipan.c
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-07 21:09:07 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-07 21:09:07 -0500
commit84134563dabb19560c43ebab38dd4cace83c3608 (patch)
tree8fd1f4eb633cc59ba55071758bcf4dd3d6bd6758 /taipan.c
parent3505ea037d50c3d3fc52b57037f0020072b6a75e (diff)
downloadtaipan-84134563dabb19560c43ebab38dd4cace83c3608.tar.gz
save another 58 bytes, now at 4684 free
Diffstat (limited to 'taipan.c')
-rw-r--r--taipan.c67
1 files changed, 49 insertions, 18 deletions
diff --git a/taipan.c b/taipan.c
index 9cc1916..0789431 100644
--- a/taipan.c
+++ b/taipan.c
@@ -247,6 +247,8 @@ void cprint_taipan_bang(void);
void cprint_taipan_bangbang(void);
void cprint_taipan_period(void);
void cprint_taipan_prompt(void);
+void cprint_elder_brother_wu(void);
+void cprint_li_yuen(void);
unsigned char firmpos;
@@ -412,16 +414,34 @@ void cprint_taipan_period(void) {
cputc('.');
}
+void cprint_question_space(void) {
+ cputs("? ");
+}
+
void cprint_taipan_prompt(void) {
comma_space();
cprint_taipan();
- cputs("? ");
+ cprint_question_space();
}
void do_you_wish(void) {
cputs("do you wish ");
}
+void cprint_elder_brother_wu(void) {
+ cputs("Elder Brother Wu ");
+}
+
+/* This one only saves space when Li Yuen occurs at the start
+ of a string, not in the middle */
+void cprint_li_yuen(void) {
+ cputs("Li Yuen");
+}
+
+void cprint_Do_you_want(void) {
+ cputs("Do you want ");
+}
+
#ifdef BIGNUM
bignum(big1T) = BIG_1T;
bignum(big1B) = BIG_1B;
@@ -1346,7 +1366,8 @@ void cash_or_guns(void)
int choice = 0;
clrscr();
- cputs("Do you want to start . . .\r\n\n");
+ cprint_Do_you_want();
+ cputs("to start . . .\r\n\n");
cputs(" 1) With cash (and a debt)\r\n\n");
// cputs(" -- or --\r\n\n");
cspaces(16);
@@ -2075,7 +2096,7 @@ void quit(void)
cputs(location[choice]);
if(choice != 7) comma_space();
}
- cputs(" ? ");
+ cprint_question_space();
/*
cputs("1) Hong Kong, 2) Shanghai, 3) Nagasaki,\r\n"
@@ -2085,7 +2106,7 @@ void quit(void)
for (;;)
{
- gotoxy(13, 21);
+ gotoxy(12, 21);
clrtobot();
choice = numgetc() - '0';
@@ -2138,7 +2159,8 @@ void quit(void)
at_sea();
captains_report();
- cputs("Li Yuen's fleet drove them off!");
+ cprint_li_yuen();
+ cputs("'s fleet drove them off!");
timed_getch();
}
@@ -2146,8 +2168,8 @@ void quit(void)
if (((result == 0) && (randi()%(4 + (8 * li))) == 0) || (result == 2))
{
clear_msg_window();
- // cputs("Li Yuen's pirates, Taipan!!\r\n");
- cputs("Li Yuen's pirates");
+ cprint_li_yuen();
+ cputs("'s pirates");
cprint_taipan_bangbang();
// cputs("\r\n");
crlf();
@@ -2170,10 +2192,9 @@ void quit(void)
num_ships = randi()%((capacity / 5) + guns) + 5;
cprintulong(num_ships);
+ /* "ships" will always be plural (at least 5 of them) */
cputs(" ships of Li Yuen's pirate\r\nfleet");
cprint_taipan_bangbang();
- // cputs(" ships of Li Yuen's pirate\r\n");
- // cputs("fleet, Taipan!!\r\n");
under_attack_sound();
timed_getch();
@@ -2370,7 +2391,8 @@ void li_yuen_extortion(void) {
if(!amount) return; /* asking for 0 is dumb */
compradores_report();
- cputs("Li Yuen asks ");
+ cprint_li_yuen();
+ cputs("asks ");
cprintfancy(amount);
cputs(" in donation\r\nto the temple of Tin Hau, the Sea\r\nGoddess. Will you pay? ");
choice = yngetc(0);
@@ -2388,7 +2410,9 @@ void li_yuen_extortion(void) {
timed_getch();
- cputs("Do you want Elder Brother Wu to make up\r\nthe difference for you? ");
+ cprint_Do_you_want();
+ cprint_elder_brother_wu();
+ cputs("to make up\r\nthe difference for you? ");
choice = yngetc(0);;
clear_msg_window();
@@ -2400,14 +2424,17 @@ void li_yuen_extortion(void) {
cash = 0;
li = 1;
- cputs("Elder Brother has given Li Yuen the\r\n"
+ cprint_elder_brother_wu();
+ cputs("has given Li Yuen the\r\n"
"difference between what he wanted and\r\n"
"your cash on hand and added the same\r\n"
"amount to your debt.\r\n");
} else {
cash = 0;
- cputs("Very well. Elder Brother Wu will not pay\r\n"
+ cputs("Very well. ");
+ cprint_elder_brother_wu();
+ cputs("will not pay\r\n"
"Li Yuen the difference. I would be very\r\n"
"wary of pirates if I were you");
cprint_taipan_period();
@@ -2722,7 +2749,7 @@ int port_choices(void) {
cputs("Quit trading");
if(retire_ok) cputs(", or Retire");
- cputs("? ");
+ cprint_question_space();
for(;;) {
choice = lcgetc();
@@ -3064,7 +3091,8 @@ int main(void) {
"into your heart, he says:\r\n");
timed_getch();
compradores_report();
- cputs("Elder Brother Wu regrets to inform you\r\n"
+ cprint_elder_brother_wu();
+ cputs("regrets to inform you\r\n"
"that your account has been terminated\r\n"
"with extreme prejudice.");
timed_getch();
@@ -3082,7 +3110,8 @@ int main(void) {
int braves = randi()%100 + 50;
compradores_report();
- cputs("Elder Brother Wu has sent ");
+ cprint_elder_brother_wu();
+ cputs("has sent ");
cprintulong(braves);
cputs(" braves\r\nto escort you to the Wu mansion");
cprint_taipan_period();
@@ -3091,7 +3120,8 @@ int main(void) {
timed_getch();
clear_msg_window();
- cputs("Elder Brother Wu reminds you of the\r\n"
+ cprint_elder_brother_wu();
+ cputs("reminds you of the\r\n"
"Confucian ideal of personal worthiness,\r\n"
"and how this applies to paying one's\r\ndebts.\r\n");
@@ -3178,7 +3208,8 @@ int main(void) {
if((port != 1) && (li == 0) && (!one_chance_in(4))) {
compradores_report();
- cputs("Li Yuen has sent a Lieutenant,\r\n"
+ cprint_li_yuen();
+ cputs("has sent a Lieutenant,\r\n"
"Taipan. He says his admiral wishes\r\n"
"to see you in Hong Kong, posthaste!\r\n");
bad_joss_sound();