diff --git a/src/exch.c b/src/exch.c index a7ff594..3f7c7c5 100644 --- a/src/exch.c +++ b/src/exch.c @@ -75,9 +75,9 @@ void exchange_stock (void) werase(curwin); box(curwin, 0, 0); - center(curwin, 1, ATTR_WINDOW_TITLE, " Interstellar Stock Exchange "); - center2(curwin, 2, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, "Player: ", - "%s", player[current_player].name); + center(curwin, 1, ATTR_TITLE, " Interstellar Stock Exchange "); + center2(curwin, 2, ATTR_NORMAL, ATTR_HIGHLIGHT, "Player: ", "%s", + player[current_player].name); all_off_map = true; for (i = 0; i < MAX_COMPANIES; i++) { @@ -88,7 +88,7 @@ void exchange_stock (void) } if (all_off_map) { - center(curwin, 8, ATTR_NORMAL_WINDOW, "No companies on the map"); + center(curwin, 8, ATTR_NORMAL, "No companies on the map"); } else { char *buf = malloc(BUFSIZE); if (buf == NULL) { @@ -99,17 +99,17 @@ void exchange_stock (void) snprintf(buf, BUFSIZE, "share (%s)", localeconv_info.currency_symbol); - wattrset(curwin, ATTR_WINDOW_SUBTITLE); + wattrset(curwin, ATTR_SUBTITLE); mvwprintw(curwin, 4, 2, " %-22s %12s %10s %10s %10s ", "", "Price per", "", "Shares", "Shares"); mvwprintw(curwin, 5, 2, " %-22s %12s %10s %10s %10s ", "Company", buf, "Return (%)", "issued", "left"); - wattrset(curwin, ATTR_NORMAL_WINDOW); + wattrset(curwin, ATTR_NORMAL); for (line = 6, i = 0; i < MAX_COMPANIES; i++) { if (company[i].on_map) { - mvwaddch(curwin, line, 2, PRINTABLE_MAP_VAL(COMPANY_TO_MAP(i)) | - ATTR_MAP_CHOICE); + mvwaddch(curwin, line, 2, PRINTABLE_MAP_VAL(COMPANY_TO_MAP(i)) + | ATTR_CHOICE); l_strfmon(buf, BUFSIZE, "%!12n", company[i].share_price); mvwprintw(curwin, line, 4, "%-22s %12s %10.2f %'10ld %'10ld ", company[i].name, buf, company[i].share_return @@ -128,28 +128,28 @@ void exchange_stock (void) newtxwin(6, WIN_COLS, 18, WCENTER(WIN_COLS), true, ATTR_NORMAL_WINDOW); wmove(curwin, 3, 2); - attrpr(curwin, ATTR_KEYCODE_STR, "<1>"); + attrpr(curwin, ATTR_KEYCODE, "<1>"); waddstr(curwin, " Display stock portfolio"); wmove(curwin, 4, 2); - attrpr(curwin, ATTR_KEYCODE_STR, "<2>"); + attrpr(curwin, ATTR_KEYCODE, "<2>"); waddstr(curwin, " Display galaxy map"); wmove(curwin, 3, 40); - attrpr(curwin, ATTR_KEYCODE_STR, "<3>"); + attrpr(curwin, ATTR_KEYCODE, "<3>"); waddstr(curwin, " Visit the Trading Bank"); wmove(curwin, 4, 40); - attrpr(curwin, ATTR_KEYCODE_STR, "<4>"); + attrpr(curwin, ATTR_KEYCODE, "<4>"); waddstr(curwin, " Exit the Stock Exchange"); mvwaddstr(curwin, 1, 18, "Enter selection "); waddstr(curwin, "["); - attrpr(curwin, ATTR_HIGHLIGHT_STR, "Company letter"); + attrpr(curwin, ATTR_HIGHLIGHT, "Company letter"); waddstr(curwin, "/"); - attrpr(curwin, ATTR_KEYCODE_STR, "1"); + attrpr(curwin, ATTR_KEYCODE, "1"); waddstr(curwin, "-"); - attrpr(curwin, ATTR_KEYCODE_STR, "4"); + attrpr(curwin, ATTR_KEYCODE, "4"); waddstr(curwin, "]: "); curs_set(CURS_ON); @@ -254,22 +254,22 @@ void visit_bank (void) newtxwin(10, WIN_COLS - 4, 5, WCENTER(WIN_COLS - 4), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " Interstellar Trading Bank "); + center(curwin, 1, ATTR_TITLE, " Interstellar Trading Bank "); l_strfmon(buf, BUFSIZE, "%18n", player[current_player].cash); - center2(curwin, 3, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, - "Current cash: ", " %s ", buf); + center2(curwin, 3, ATTR_NORMAL, ATTR_HIGHLIGHT, "Current cash: ", + " %s ", buf); l_strfmon(buf, BUFSIZE, "%18n", player[current_player].debt); - center2(curwin, 4, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, - "Current debt: ", " %s ", buf); + center2(curwin, 4, ATTR_NORMAL, ATTR_HIGHLIGHT, "Current debt: ", + " %s ", buf); - center2(curwin, 5, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, - "Interest rate: ", " %17.2f%% ", interest_rate * 100.0); + center2(curwin, 5, ATTR_NORMAL, ATTR_HIGHLIGHT, "Interest rate: ", + " %17.2f%% ", interest_rate * 100.0); l_strfmon(buf, BUFSIZE, "%18n", credit_limit); - center2(curwin, 7, ATTR_HIGHLIGHT_STR, ATTR_WINDOW_TITLE, - "Credit limit: ", " %s ", buf); + center2(curwin, 7, ATTR_HIGHLIGHT, ATTR_TITLE, "Credit limit: ", + " %s ", buf); wrefresh(curwin); @@ -277,18 +277,15 @@ void visit_bank (void) newtxwin(7, WIN_COLS - 4, 15, WCENTER(WIN_COLS - 4), true, ATTR_NORMAL_WINDOW); - center2(curwin, 3, ATTR_KEYCODE_STR, ATTR_NORMAL_WINDOW, - "<1>", " Borrow money "); - center2(curwin, 4, ATTR_KEYCODE_STR, ATTR_NORMAL_WINDOW, - "<2>", " Repay debt "); - center2(curwin, 5, ATTR_KEYCODE_STR, ATTR_NORMAL_WINDOW, - "<3>", " Exit from the Bank"); + center2(curwin, 3, ATTR_KEYCODE, ATTR_NORMAL, "<1>", " Borrow money "); + center2(curwin, 4, ATTR_KEYCODE, ATTR_NORMAL, "<2>", " Repay debt "); + center2(curwin, 5, ATTR_KEYCODE, ATTR_NORMAL, "<3>", " Exit from the Bank"); mvwaddstr(curwin, 1, 24, "Enter selection "); waddstr(curwin, "["); - attrpr(curwin, ATTR_KEYCODE_STR, "1"); + attrpr(curwin, ATTR_KEYCODE, "1"); waddstr(curwin, "-"); - attrpr(curwin, ATTR_KEYCODE_STR, "3"); + attrpr(curwin, ATTR_KEYCODE, "3"); waddstr(curwin, "]: "); curs_set(CURS_ON); @@ -327,10 +324,10 @@ void visit_bank (void) newtxwin(7, 50, 8, WCENTER(50), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " Insufficient Credit Limit "); - center(curwin, 3, ATTR_ERROR_STR, + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "The Bank will not lend you any more money"); - wait_for_key(curwin, 5, ATTR_WAITERROR_STR); + wait_for_key(curwin, 5, ATTR_ERROR_WAITFORKEY); deltxwin(); } else { int x, y, n; @@ -376,21 +373,20 @@ void visit_bank (void) if (player[current_player].debt == 0.0) { newtxwin(7, 50, 8, WCENTER(50), true, ATTR_ERROR_WINDOW); - wbkgd(curwin, ATTR_ERROR_WINDOW); - box(curwin, 0, 0); - center(curwin, 1, ATTR_ERROR_TITLE, " No Debt "); - center(curwin, 3, ATTR_ERROR_STR, "You have no debt to repay"); + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, + "You have no debt to repay"); - wait_for_key(curwin, 5, ATTR_WAITERROR_STR); + wait_for_key(curwin, 5, ATTR_ERROR_WAITFORKEY); deltxwin(); } else if (player[current_player].cash == 0.0) { newtxwin(7, 60, 8, WCENTER(60), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " No Cash "); - center(curwin, 3, ATTR_ERROR_STR, "You have no cash with which to repay the debt!"); + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, + "You have no cash with which to repay the debt!"); - wait_for_key(curwin, 5, ATTR_WAITERROR_STR); + wait_for_key(curwin, 5, ATTR_ERROR_WAITFORKEY); deltxwin(); } else { int x, y, n; @@ -487,35 +483,35 @@ void trade_shares (int num, bool *bid_used) newtxwin(9, WIN_COLS - 4, 5, WCENTER(WIN_COLS - 4), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " Stock Transaction in %s ", + center(curwin, 1, ATTR_TITLE, " Stock Transaction in %s ", company[num].name); mvwaddstr(curwin, 3, 2, "Shares issued: "); - attrpr(curwin, ATTR_HIGHLIGHT_STR, "%'12ld", company[num].stock_issued); + attrpr(curwin, ATTR_HIGHLIGHT, "%'12ld", company[num].stock_issued); mvwaddstr(curwin, 4, 2, "Shares left: "); - attrpr(curwin, ATTR_HIGHLIGHT_STR, "%'12ld", + attrpr(curwin, ATTR_HIGHLIGHT, "%'12ld", company[num].max_stock - company[num].stock_issued); mvwaddstr(curwin, 5, 2, "Price per share: "); l_strfmon(buf, BUFSIZE, "%12n", company[num].share_price); - attrpr(curwin, ATTR_HIGHLIGHT_STR, "%12s", buf); + attrpr(curwin, ATTR_HIGHLIGHT, "%12s", buf); mvwaddstr(curwin, 6, 2, "Return: "); - attrpr(curwin, ATTR_HIGHLIGHT_STR, "%11.2f%%", + attrpr(curwin, ATTR_HIGHLIGHT, "%11.2f%%", company[num].share_return * 100.0); mvwaddstr(curwin, 3, 38, "Current holdings: "); - attrpr(curwin, ATTR_HIGHLIGHT_STR, " %'16ld ", + attrpr(curwin, ATTR_HIGHLIGHT, " %'16ld ", player[current_player].stock_owned[num]); mvwaddstr(curwin, 4, 38, "Percentage owned: "); - attrpr(curwin, ATTR_HIGHLIGHT_STR, " %'15.2f%% ", ownership * 100.0); + attrpr(curwin, ATTR_HIGHLIGHT, " %'15.2f%% ", ownership * 100.0); wmove(curwin, 6, 38); - attrpr(curwin, ATTR_HIGHLIGHT_STR, "Current cash: "); + attrpr(curwin, ATTR_HIGHLIGHT, "Current cash: "); l_strfmon(buf, BUFSIZE, "%16n", player[current_player].cash); - attrpr(curwin, ATTR_WINDOW_TITLE, " %16s ", buf); + attrpr(curwin, ATTR_TITLE, " %16s ", buf); wrefresh(curwin); @@ -524,26 +520,26 @@ void trade_shares (int num, bool *bid_used) ATTR_NORMAL_WINDOW); wmove(curwin, 3, 2); - attrpr(curwin, ATTR_KEYCODE_STR, "<1>"); + attrpr(curwin, ATTR_KEYCODE, "<1>"); waddstr(curwin, " Buy stock from company"); wmove(curwin, 4, 2); - attrpr(curwin, ATTR_KEYCODE_STR, "<2>"); + attrpr(curwin, ATTR_KEYCODE, "<2>"); waddstr(curwin, " Sell stock back to company"); wmove(curwin, 3, 38); - attrpr(curwin, ATTR_KEYCODE_STR, "<3>"); + attrpr(curwin, ATTR_KEYCODE, "<3>"); waddstr(curwin, " Bid company to issue more shares"); wmove(curwin, 4, 38); - attrpr(curwin, ATTR_KEYCODE_STR, "<4>"); + attrpr(curwin, ATTR_KEYCODE, "<4>"); waddstr(curwin, " Exit to the Stock Exchange"); mvwaddstr(curwin, 1, 24, "Enter selection "); waddstr(curwin, "["); - attrpr(curwin, ATTR_KEYCODE_STR, "1"); + attrpr(curwin, ATTR_KEYCODE, "1"); waddstr(curwin, "-"); - attrpr(curwin, ATTR_KEYCODE_STR, "4"); + attrpr(curwin, ATTR_KEYCODE, "4"); waddstr(curwin, "]: "); curs_set(CURS_ON); @@ -585,20 +581,20 @@ void trade_shares (int num, bool *bid_used) newtxwin(7, 50, 8, WCENTER(50), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " No Shares Available "); - center(curwin, 3, ATTR_ERROR_STR, + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "No more shares are available for purchase"); - wait_for_key(curwin, 5, ATTR_WAITERROR_STR); + wait_for_key(curwin, 5, ATTR_ERROR_WAITFORKEY); deltxwin(); } else if (maxshares <= 0) { newtxwin(7, 50, 8, WCENTER(50), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " Insufficient Cash "); - center(curwin, 3, ATTR_ERROR_STR, + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "Not enough cash to purchase shares"); - wait_for_key(curwin, 5, ATTR_WAITERROR_STR); + wait_for_key(curwin, 5, ATTR_ERROR_WAITFORKEY); deltxwin(); } else { @@ -609,9 +605,8 @@ void trade_shares (int num, bool *bid_used) werase(curwin); box(curwin, 0, 0); - center3(curwin, 2, ATTR_NORMAL_WINDOW, ATTR_NORMAL_WINDOW, - ATTR_HIGHLIGHT_STR, "You can purchase up to ", " shares.", - "%'ld", maxshares); + center3(curwin, 2, ATTR_NORMAL, ATTR_NORMAL, ATTR_HIGHLIGHT, + "You can purchase up to ", " shares.", "%'ld", maxshares); mvwprintw(curwin, 4, 10, "How many shares do you wish to purchase? "); x = getcurx(curwin); @@ -634,10 +629,10 @@ void trade_shares (int num, bool *bid_used) newtxwin(7, 50, 8, WCENTER(50), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " No Shares "); - center(curwin, 3, ATTR_ERROR_STR, + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "You do not have any shares to sell"); - wait_for_key(curwin, 5, ATTR_WAITERROR_STR); + wait_for_key(curwin, 5, ATTR_ERROR_WAITFORKEY); deltxwin(); } else { @@ -645,9 +640,8 @@ void trade_shares (int num, bool *bid_used) werase(curwin); box(curwin, 0, 0); - center3(curwin, 2, ATTR_NORMAL_WINDOW, ATTR_NORMAL_WINDOW, - ATTR_HIGHLIGHT_STR, "You can sell up to ", " shares.", - "%'ld", maxshares); + center3(curwin, 2, ATTR_NORMAL, ATTR_NORMAL, ATTR_HIGHLIGHT, + "You can sell up to ", " shares.", "%'ld", maxshares); mvwprintw(curwin, 4, 10, "How many shares do you wish to sell? "); x = getcurx(curwin); @@ -677,20 +671,21 @@ void trade_shares (int num, bool *bid_used) newtxwin(8, 50, 8, WCENTER(50), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " No Shares Issued "); - center(curwin, 3, ATTR_ERROR_STR, "%s", company[num].name); - center(curwin, 4, ATTR_ERROR_STR, "has refused to issue more shares"); + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "%s", company[num].name); + center(curwin, 4, ATTR_ERROR_HIGHLIGHT, + "has refused to issue more shares"); - wait_for_key(curwin, 6, ATTR_WAITERROR_STR); + wait_for_key(curwin, 6, ATTR_ERROR_WAITFORKEY); deltxwin(); } else { newtxwin(8, 50, 8, WCENTER(50), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " Shares Issued "); - center(curwin, 3, ATTR_HIGHLIGHT_STR, "%s", company[num].name); - center(curwin, 4, ATTR_HIGHLIGHT_STR, "has issued %'ld more shares", + center(curwin, 1, ATTR_TITLE, " Shares Issued "); + center(curwin, 3, ATTR_HIGHLIGHT, "%s", company[num].name); + center(curwin, 4, ATTR_HIGHLIGHT, "has issued %'ld more shares", maxshares); - wait_for_key(curwin, 6, ATTR_WAITNORMAL_STR); + wait_for_key(curwin, 6, ATTR_WAITFORKEY); deltxwin(); } break; diff --git a/src/fileio.c b/src/fileio.c index 939cad0..b837cea 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -174,10 +174,10 @@ bool load_game (int num) newtxwin(7, 40, 9, WCENTER(40), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " Game Not Found "); - center(curwin, 3, ATTR_ERROR_STR, + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "Game %d has not been saved to disk", num); - wait_for_key(curwin, 5, ATTR_WAITERROR_STR); + wait_for_key(curwin, 5, ATTR_ERROR_WAITFORKEY); deltxwin(); } else { // Some other file error @@ -186,12 +186,12 @@ bool load_game (int num) newtxwin(9, 70, 9, WCENTER(70), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " Game Not Loaded "); - center(curwin, 3, ATTR_ERROR_STR, + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "Game %d could not be loaded from disk", num); - center(curwin, 5, ATTR_ERROR_WINDOW, "File %s: %s", filename, + center(curwin, 5, ATTR_ERROR_NORMAL, "File %s: %s", filename, strerror(saved_errno)); - wait_for_key(curwin, 7, ATTR_WAITERROR_STR); + wait_for_key(curwin, 7, ATTR_ERROR_WAITFORKEY); deltxwin(); } @@ -342,12 +342,12 @@ bool save_game (int num) newtxwin(9, 70, 7, WCENTER(70), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " Game Not Saved "); - center(curwin, 3, ATTR_ERROR_STR, + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "Game %d could not be saved to disk", num); - center(curwin, 5, ATTR_ERROR_WINDOW, "Directory %s: %s", + center(curwin, 5, ATTR_ERROR_NORMAL, "Directory %s: %s", data_dir, strerror(saved_errno)); - wait_for_key(curwin, 7, ATTR_WAITERROR_STR); + wait_for_key(curwin, 7, ATTR_ERROR_WAITFORKEY); deltxwin(); free(buf); @@ -367,12 +367,12 @@ bool save_game (int num) newtxwin(9, 70, 7, WCENTER(70), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " Game Not Saved "); - center(curwin, 3, ATTR_ERROR_STR, + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "Game %d could not be saved to disk", num); - center(curwin, 5, ATTR_ERROR_WINDOW, "File %s: %s", filename, + center(curwin, 5, ATTR_ERROR_NORMAL, "File %s: %s", filename, strerror(saved_errno)); - wait_for_key(curwin, 7, ATTR_WAITERROR_STR); + wait_for_key(curwin, 7, ATTR_ERROR_WAITFORKEY); deltxwin(); free(buf); diff --git a/src/game.c b/src/game.c index 6a1fbc1..263f380 100644 --- a/src/game.c +++ b/src/game.c @@ -89,12 +89,12 @@ void init_game (void) mvwaddstr(curwin, 2, 2, "Enter number of players "); waddstr(curwin, "["); - attrpr(curwin, ATTR_KEYCODE_STR, "1"); + attrpr(curwin, ATTR_KEYCODE, "1"); waddstr(curwin, "-"); - attrpr(curwin, ATTR_KEYCODE_STR, "%d", MAX_PLAYERS); + attrpr(curwin, ATTR_KEYCODE, "%d", MAX_PLAYERS); waddstr(curwin, "]"); waddstr(curwin, " or "); - attrpr(curwin, ATTR_KEYCODE_STR, ""); + attrpr(curwin, ATTR_KEYCODE, ""); waddstr(curwin, " to continue a game: "); curs_set(CURS_ON); @@ -136,12 +136,12 @@ void init_game (void) mvwaddstr(curwin, 2, 2, "Enter game number "); waddstr(curwin, "["); - attrpr(curwin, ATTR_KEYCODE_STR, "1"); + attrpr(curwin, ATTR_KEYCODE, "1"); waddstr(curwin, "-"); - attrpr(curwin, ATTR_KEYCODE_STR, "9"); + attrpr(curwin, ATTR_KEYCODE, "9"); waddstr(curwin, "]"); waddstr(curwin, " or "); - attrpr(curwin, ATTR_KEYCODE_STR, ""); + attrpr(curwin, ATTR_KEYCODE, ""); waddstr(curwin, " to cancel: "); curs_set(CURS_ON); @@ -221,9 +221,9 @@ void init_game (void) mvwaddstr(curwin, 2, 2, "Do you need any instructions? "); waddstr(curwin, "["); - attrpr(curwin, ATTR_KEYCODE_STR, "Y"); + attrpr(curwin, ATTR_KEYCODE, "Y"); waddstr(curwin, "/"); - attrpr(curwin, ATTR_KEYCODE_STR, "N"); + attrpr(curwin, ATTR_KEYCODE, "N"); waddstr(curwin, "] "); if (answer_yesno(curwin)) { @@ -240,7 +240,7 @@ void init_game (void) newtxwin(number_players + 5, WIN_COLS - 4, 9, WCENTER(WIN_COLS - 4), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " Enter Player Names "); + center(curwin, 1, ATTR_TITLE, " Enter Player Names "); for (i = 0; i < number_players; i++) { player[i].name = NULL; @@ -321,9 +321,9 @@ void init_game (void) mvwaddstr(curwin, 2, 2, "Does any player need instructions? "); waddstr(curwin, "["); - attrpr(curwin, ATTR_KEYCODE_STR, "Y"); + attrpr(curwin, ATTR_KEYCODE, "Y"); waddstr(curwin, "/"); - attrpr(curwin, ATTR_KEYCODE_STR, "N"); + attrpr(curwin, ATTR_KEYCODE, "N"); waddstr(curwin, "] "); if (answer_yesno(curwin)) { @@ -380,12 +380,11 @@ void init_game (void) newtxwin(7, 50, 8, WCENTER(50), true, ATTR_NORMAL_WINDOW); - center(curwin, 2, ATTR_NORMAL_WINDOW, - "The first player to go is"); - center(curwin, 3, ATTR_HIGHLIGHT_STR, "%s", + center(curwin, 2, ATTR_NORMAL, "The first player to go is"); + center(curwin, 3, ATTR_HIGHLIGHT, "%s", player[first_player].name); - wait_for_key(curwin, 5, ATTR_WAITNORMAL_STR); + wait_for_key(curwin, 5, ATTR_WAITFORKEY); deltxwin(); txrefresh(); } @@ -426,10 +425,10 @@ void end_game (void) newtxwin(7, 40, 9, WCENTER(40), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " Game Over "); - center(curwin, 3, ATTR_ERROR_STR, "The game is over after %d turns", + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "The game is over after %d turns", turn_number - 1); - wait_for_key(curwin, 5, ATTR_WAITERROR_STR); + wait_for_key(curwin, 5, ATTR_ERROR_WAITFORKEY); deltxwin(); for (i = 0; i < number_players; i++) { @@ -441,11 +440,11 @@ void end_game (void) newtxwin(9, 60, 8, WCENTER(60), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " Total Value "); - center2(curwin, 4, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, + center(curwin, 1, ATTR_TITLE, " Total Value "); + center2(curwin, 4, ATTR_NORMAL, ATTR_HIGHLIGHT, "Your total value was ", "%s", buf); - wait_for_key(curwin, 7, ATTR_WAITNORMAL_STR); + wait_for_key(curwin, 7, ATTR_WAITFORKEY); deltxwin(); } else { // Sort players on the basis of total value @@ -457,15 +456,15 @@ void end_game (void) newtxwin(number_players + 10, WIN_COLS - 4, 3, WCENTER(WIN_COLS - 4), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " Game Winner "); - center2(curwin, 3, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, - "The winner is ", "%s", player[0].name); + center(curwin, 1, ATTR_TITLE, " Game Winner "); + center2(curwin, 3, ATTR_NORMAL, ATTR_HIGHLIGHT, "The winner is ", + "%s", player[0].name); if (player[0].sort_value == 0.0) { - center2(curwin, 4, ATTR_NORMAL_WINDOW, ATTR_STANDOUT_STR, - "who is ", "%s", "*** BANKRUPT ***"); + center2(curwin, 4, ATTR_NORMAL, ATTR_BLINK, "who is ", + "*** BANKRUPT ***"); } else { l_strfmon(buf, BUFSIZE, "%1n", player[0].sort_value); - center2(curwin, 4, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, + center2(curwin, 4, ATTR_NORMAL, ATTR_HIGHLIGHT, "with a value of ", "%s", buf); } @@ -473,9 +472,9 @@ void end_game (void) localeconv_info.currency_symbol); int w = getmaxx(curwin) - 33; - wattrset(curwin, ATTR_WINDOW_SUBTITLE); + wattrset(curwin, ATTR_SUBTITLE); mvwprintw(curwin, 6, 2, "%5s %-*.*s %18s ", "", w, w, "Player", buf); - wattrset(curwin, ATTR_NORMAL_WINDOW); + wattrset(curwin, ATTR_NORMAL); for (i = 0; i < number_players; i++) { l_strfmon(buf, BUFSIZE, "%!18n", player[i].sort_value); @@ -483,7 +482,7 @@ void end_game (void) ordinal[i + 1], w, w, player[i].name, buf); } - wait_for_key(curwin, getmaxy(curwin) - 2, ATTR_WAITNORMAL_STR); + wait_for_key(curwin, getmaxy(curwin) - 2, ATTR_WAITFORKEY); deltxwin(); } @@ -517,13 +516,13 @@ void show_map (bool closewin) mvwaddch(curwin, 2, getmaxx(curwin) - 1, ACS_RTEE); // Display current player and turn number - wattrset(curwin, ATTR_MAP_TITLE); + wattrset(curwin, ATTR_MAPWIN_TITLE); mvwaddstr(curwin, 1, 2, " "); waddstr(curwin, "Player: "); n = getmaxx(curwin) - getcurx(curwin) - 4; - wattrset(curwin, ATTR_MAP_T_HIGHLIGHT); + wattrset(curwin, ATTR_MAPWIN_HIGHLIGHT); wprintw(curwin, "%-*.*s", n, n, player[current_player].name); - wattrset(curwin, ATTR_MAP_TITLE); + wattrset(curwin, ATTR_MAPWIN_TITLE); waddstr(curwin, " "); if (turn_number != max_turn) { @@ -539,9 +538,9 @@ void show_map (bool closewin) mvwaddstr(curwin, 1, getmaxx(curwin) - (len1 + len2) - 6, " "); waddstr(curwin, initial); - wattrset(curwin, ATTR_MAP_T_HIGHLIGHT); + wattrset(curwin, ATTR_MAPWIN_HIGHLIGHT); waddstr(curwin, buf); - wattrset(curwin, ATTR_MAP_TITLE); + wattrset(curwin, ATTR_MAPWIN_TITLE); waddstr(curwin, " "); free(buf); @@ -550,9 +549,9 @@ void show_map (bool closewin) int len = strlen(buf); mvwaddstr(curwin, 1, getmaxx(curwin) - len - 6, " "); - wattrset(curwin, ATTR_MAP_T_STANDOUT); + wattrset(curwin, ATTR_MAPWIN_BLINK); waddstr(curwin, buf); - wattrset(curwin, ATTR_MAP_TITLE); + wattrset(curwin, ATTR_MAPWIN_TITLE); waddstr(curwin, " "); } @@ -593,7 +592,7 @@ void show_map (bool closewin) newtxwin(WIN_LINES - MAX_Y - 5, WIN_COLS, MAX_Y + 5, WCENTER(WIN_COLS), true, ATTR_NORMAL_WINDOW); - wait_for_key(curwin, 2, ATTR_WAITNORMAL_STR); + wait_for_key(curwin, 2, ATTR_WAITFORKEY); deltxwin(); // Wait for key window deltxwin(); // Galaxy map window @@ -623,13 +622,13 @@ void show_status (int num) newtxwin(MAX_COMPANIES + 15, WIN_COLS, 1, WCENTER(WIN_COLS), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " Stock Portfolio "); - center2(curwin, 2, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, "Player: ", - "%s", player[num].name); + center(curwin, 1, ATTR_TITLE, " Stock Portfolio "); + center2(curwin, 2, ATTR_NORMAL, ATTR_HIGHLIGHT, "Player: ", "%s", + player[num].name); val = total_value(num); if (val == 0.0) { - center(curwin, 11, ATTR_STANDOUT_STR, "* * * B A N K R U P T * * *"); + center(curwin, 11, ATTR_BLINK, "* * * B A N K R U P T * * *"); } else { char *buf = malloc(BUFSIZE); if (buf == NULL) { @@ -646,18 +645,18 @@ void show_status (int num) } if (none) { - center(curwin, 8, ATTR_NORMAL_WINDOW, "No companies on the map"); + center(curwin, 8, ATTR_NORMAL, "No companies on the map"); } else { // Handle the locale's currency symbol snprintf(buf, BUFSIZE, "share (%s)", localeconv_info.currency_symbol); - wattrset(curwin, ATTR_WINDOW_SUBTITLE); + wattrset(curwin, ATTR_SUBTITLE); mvwprintw(curwin, 4, 2, " %-22s %12s %10s %10s %10s ", "", "Price per", "", "Holdings", "Company"); mvwprintw(curwin, 5, 2, " %-22s %12s %10s %10s %10s ", "Company", buf, "Return (%)", "(shares)", "owner (%)"); - wattrset(curwin, ATTR_NORMAL_WINDOW); + wattrset(curwin, ATTR_NORMAL); for (line = 6, i = 0; i < MAX_COMPANIES; i++) { if (company[i].on_map) { @@ -677,24 +676,24 @@ void show_status (int num) line = 15; l_strfmon(buf, BUFSIZE, "%18n", player[num].cash); - center2(curwin, line++, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, - "Current cash: ", " %s ", buf); + center2(curwin, line++, ATTR_NORMAL, ATTR_HIGHLIGHT, "Current cash: ", + " %s ", buf); if (player[num].debt != 0.0) { l_strfmon(buf, BUFSIZE, "%18n", player[num].debt); - center2(curwin, line++, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, + center2(curwin, line++, ATTR_NORMAL, ATTR_HIGHLIGHT, "Current debt: ", " %s ", buf); - center2(curwin, line++, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, + center2(curwin, line++, ATTR_NORMAL, ATTR_HIGHLIGHT, "Interest rate: ", " %17.2f%% ", interest_rate * 100.0); } l_strfmon(buf, BUFSIZE, "%18n", val); - center2(curwin, line + 1, ATTR_HIGHLIGHT_STR, ATTR_WINDOW_TITLE, + center2(curwin, line + 1, ATTR_HIGHLIGHT, ATTR_TITLE, "Total value: ", " %s ", buf); free(buf); } - wait_for_key(curwin, 21, ATTR_WAITNORMAL_STR); + wait_for_key(curwin, 21, ATTR_WAITFORKEY); deltxwin(); txrefresh(); } diff --git a/src/help.c b/src/help.c index b4ae37e..7b5ae1c 100644 --- a/src/help.c +++ b/src/help.c @@ -178,15 +178,14 @@ void show_help (void) werase(curwin); wbkgd(curwin, ATTR_NORMAL_WINDOW); box(curwin, 0, 0); - center(curwin, 1, ATTR_WINDOW_TITLE, " How to Play "); - center(curwin, 2, ATTR_NORMAL_WINDOW, "Page %d of %d", - curpage + 1, numpages); + center(curwin, 1, ATTR_TITLE, " How to Play "); + center(curwin, 2, ATTR_NORMAL, "Page %d of %d", curpage + 1, numpages); wmove(curwin, 4, 2); // Process the help text string const char *s = help_text[curpage]; - int curattr = ATTR_NORMAL_WINDOW; + int curattr = ATTR_NORMAL; while (*s != '\0') { switch (*s) { @@ -204,22 +203,22 @@ void show_help (void) break; case 'N': - curattr = ATTR_NORMAL_WINDOW; + curattr = ATTR_NORMAL; wattrset(curwin, curattr); break; case 'B': - curattr = ATTR_NORMAL_WINDOW | A_BOLD; + curattr = ATTR_NORMAL | A_BOLD; wattrset(curwin, curattr); break; case 'H': - curattr = ATTR_HIGHLIGHT_STR; + curattr = ATTR_HIGHLIGHT; wattrset(curwin, curattr); break; case 'K': - curattr = ATTR_KEYCODE_STR; + curattr = ATTR_KEYCODE; wattrset(curwin, curattr); break; @@ -327,7 +326,7 @@ void show_help (void) s++; } - center(curwin, 21, ATTR_WAITNORMAL_STR, (curpage == 0) ? + center(curwin, 21, ATTR_WAITFORKEY, (curpage == 0) ? "[ Press to continue ] " : "[ Press to continue or for the previous page ] "); diff --git a/src/intf.h b/src/intf.h index bbbf43f..c927f48 100644 --- a/src/intf.h +++ b/src/intf.h @@ -135,32 +135,41 @@ enum color_pairs { // Colour and non-colour character rendition selection #define ATTR(color, nocolor) (use_color ? (color) : (nocolor)) -// Character renditions (attributes) used in Star Traders -#define ATTR_GAME_TITLE ATTR(COLOR_PAIR(YELLOW_ON_CYAN) | A_BOLD, A_REVERSE | A_BOLD) +/* + Character renditions (attributes) used in Star Traders +*/ #define ATTR_ROOT_WINDOW ATTR(COLOR_PAIR(WHITE_ON_BLACK), A_NORMAL) +#define ATTR_GAME_TITLE ATTR(COLOR_PAIR(YELLOW_ON_CYAN) | A_BOLD, A_REVERSE | A_BOLD) + #define ATTR_NORMAL_WINDOW ATTR(COLOR_PAIR(WHITE_ON_BLUE), A_NORMAL) -#define ATTR_MAP_WINDOW ATTR(COLOR_PAIR(WHITE_ON_BLACK), A_NORMAL) -#define ATTR_STATUS_WINDOW ATTR(COLOR_PAIR(BLACK_ON_WHITE), A_REVERSE) -#define ATTR_ERROR_WINDOW ATTR(COLOR_PAIR(WHITE_ON_RED), A_REVERSE) -#define ATTR_WINDOW_TITLE ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_REVERSE) -#define ATTR_WINDOW_SUBTITLE ATTR(COLOR_PAIR(WHITE_ON_BLACK), A_REVERSE) -#define ATTR_MAP_TITLE ATTR(COLOR_PAIR(WHITE_ON_BLUE), A_NORMAL) -#define ATTR_MAP_T_HIGHLIGHT ATTR(COLOR_PAIR(YELLOW_ON_BLUE) | A_BOLD, A_BOLD) -#define ATTR_MAP_T_STANDOUT ATTR(COLOR_PAIR(YELLOW_ON_BLUE) | A_BOLD | A_BLINK, A_BOLD | A_BLINK) -#define ATTR_ERROR_TITLE ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_BOLD) +#define ATTR_TITLE ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_REVERSE) +#define ATTR_SUBTITLE ATTR(COLOR_PAIR(WHITE_ON_BLACK), A_REVERSE) +#define ATTR_NORMAL ATTR_NORMAL_WINDOW +#define ATTR_HIGHLIGHT ATTR(COLOR_PAIR(YELLOW_ON_BLUE) | A_BOLD, A_BOLD) +#define ATTR_BLINK ATTR(COLOR_PAIR(YELLOW_ON_BLUE) | A_BOLD | A_BLINK, A_BOLD | A_BLINK) +#define ATTR_KEYCODE ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_REVERSE) +#define ATTR_CHOICE ATTR(COLOR_PAIR(WHITE_ON_RED) | A_BOLD, A_REVERSE) #define ATTR_INPUT_FIELD ATTR(COLOR_PAIR(WHITE_ON_BLACK), A_BOLD | '_') -#define ATTR_KEYCODE_STR ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_REVERSE) -#define ATTR_HIGHLIGHT_STR ATTR(COLOR_PAIR(YELLOW_ON_BLUE) | A_BOLD, A_BOLD) -#define ATTR_STANDOUT_STR ATTR(COLOR_PAIR(YELLOW_ON_BLUE) | A_BOLD | A_BLINK, A_BOLD | A_BLINK) -#define ATTR_ERROR_STR ATTR(COLOR_PAIR(WHITE_ON_RED) | A_BOLD, A_REVERSE) -#define ATTR_WAITNORMAL_STR ATTR(COLOR_PAIR(CYAN_ON_BLUE), A_NORMAL) -#define ATTR_WAITERROR_STR ATTR(COLOR_PAIR(WHITE_ON_RED), A_REVERSE) +#define ATTR_WAITFORKEY ATTR(COLOR_PAIR(CYAN_ON_BLUE), A_NORMAL) + +#define ATTR_MAP_WINDOW ATTR(COLOR_PAIR(WHITE_ON_BLACK), A_NORMAL) +#define ATTR_MAPWIN_TITLE ATTR(COLOR_PAIR(WHITE_ON_BLUE), A_NORMAL) +#define ATTR_MAPWIN_HIGHLIGHT ATTR(COLOR_PAIR(YELLOW_ON_BLUE) | A_BOLD, A_BOLD) +#define ATTR_MAPWIN_BLINK ATTR(COLOR_PAIR(YELLOW_ON_BLUE) | A_BOLD | A_BLINK, A_BOLD | A_BLINK) #define ATTR_MAP_EMPTY ATTR(COLOR_PAIR(BLUE_ON_BLACK) | A_BOLD, A_NORMAL) #define ATTR_MAP_OUTPOST ATTR(COLOR_PAIR(GREEN_ON_BLACK) | A_BOLD, A_NORMAL) #define ATTR_MAP_STAR ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_BOLD) #define ATTR_MAP_COMPANY ATTR(COLOR_PAIR(RED_ON_BLACK) | A_BOLD, A_BOLD) #define ATTR_MAP_CHOICE ATTR(COLOR_PAIR(WHITE_ON_RED) | A_BOLD, A_REVERSE) +#define ATTR_STATUS_WINDOW ATTR(COLOR_PAIR(BLACK_ON_WHITE), A_REVERSE) + +#define ATTR_ERROR_WINDOW ATTR(COLOR_PAIR(WHITE_ON_RED), A_REVERSE) +#define ATTR_ERROR_TITLE ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_BOLD) +#define ATTR_ERROR_NORMAL ATTR_ERROR_WINDOW +#define ATTR_ERROR_HIGHLIGHT ATTR(COLOR_PAIR(WHITE_ON_RED) | A_BOLD, A_REVERSE) +#define ATTR_ERROR_WAITFORKEY ATTR(COLOR_PAIR(WHITE_ON_RED), A_REVERSE) + /************************************************************************ * Global variable declarations * diff --git a/src/move.c b/src/move.c index 6fbf937..bc4e5c2 100644 --- a/src/move.c +++ b/src/move.c @@ -172,32 +172,32 @@ selection_t get_move (void) box(curwin, 0, 0); wmove(curwin, 2, 2); - attrpr(curwin, ATTR_KEYCODE_STR, "<1>"); + attrpr(curwin, ATTR_KEYCODE, "<1>"); waddstr(curwin, " Display stock portfolio"); wmove(curwin, 3, 2); - attrpr(curwin, ATTR_KEYCODE_STR, "<2>"); + attrpr(curwin, ATTR_KEYCODE, "<2>"); waddstr(curwin, " Declare bankruptcy"); wmove(curwin, 2, 42); - attrpr(curwin, ATTR_KEYCODE_STR, "<3>"); + attrpr(curwin, ATTR_KEYCODE, "<3>"); waddstr(curwin, " Save and end the game"); wmove(curwin, 3, 42); - attrpr(curwin, ATTR_KEYCODE_STR, ""); + attrpr(curwin, ATTR_KEYCODE, ""); waddstr(curwin, " Quit the game"); mvwaddstr(curwin, 1, 8, " Select move "); waddstr(curwin, "["); - attrpr(curwin, ATTR_MAP_CHOICE, "%c", MOVE_TO_KEY(0)); + attrpr(curwin, ATTR_CHOICE, "%c", MOVE_TO_KEY(0)); waddstr(curwin, "-"); - attrpr(curwin, ATTR_MAP_CHOICE, "%c", MOVE_TO_KEY(NUMBER_MOVES - 1)); + attrpr(curwin, ATTR_CHOICE, "%c", MOVE_TO_KEY(NUMBER_MOVES - 1)); waddstr(curwin, "/"); - attrpr(curwin, ATTR_KEYCODE_STR, "1"); + attrpr(curwin, ATTR_KEYCODE, "1"); waddstr(curwin, "-"); - attrpr(curwin, ATTR_KEYCODE_STR, "3"); + attrpr(curwin, ATTR_KEYCODE, "3"); waddstr(curwin, "/"); - attrpr(curwin, ATTR_KEYCODE_STR, ""); + attrpr(curwin, ATTR_KEYCODE, ""); waddstr(curwin, "]: "); curs_set(CURS_ON); @@ -212,7 +212,7 @@ selection_t get_move (void) curs_set(CURS_OFF); waddstr(curwin, "Move "); - attrpr(curwin, ATTR_MAP_CHOICE, "%c", key); + attrpr(curwin, ATTR_CHOICE, "%c", key); } else { switch (key) { case '1': @@ -264,11 +264,11 @@ selection_t get_move (void) } // Clear the menu choices - wattrset(curwin, ATTR_NORMAL_WINDOW); + wattrset(curwin, ATTR_NORMAL); for (y = 2; y < 4; y++) { wmove(curwin, y, 2); for (x = 2; x < getmaxx(curwin) - 2; x++) { - waddch(curwin, ' ' | ATTR_NORMAL_WINDOW); + waddch(curwin, ' ' | ATTR_NORMAL); } } wrefresh(curwin); @@ -276,9 +276,9 @@ selection_t get_move (void) // Ask the player to confirm their choice mvwaddstr(curwin, 2, 22, "Are you sure? "); waddstr(curwin, "["); - attrpr(curwin, ATTR_KEYCODE_STR, "Y"); + attrpr(curwin, ATTR_KEYCODE, "Y"); waddstr(curwin, "/"); - attrpr(curwin, ATTR_KEYCODE_STR, "N"); + attrpr(curwin, ATTR_KEYCODE, "N"); waddstr(curwin, "] "); if (! answer_yesno(curwin)) { @@ -309,15 +309,15 @@ selection_t get_move (void) // Ask which game to save newtxwin(6, 54, 8, WCENTER(54), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " Save Game "); + center(curwin, 1, ATTR_TITLE, " Save Game "); mvwaddstr(curwin, 3, 2, "Enter game number "); waddstr(curwin, "["); - attrpr(curwin, ATTR_KEYCODE_STR, "1"); + attrpr(curwin, ATTR_KEYCODE, "1"); waddstr(curwin, "-"); - attrpr(curwin, ATTR_KEYCODE_STR, "9"); + attrpr(curwin, ATTR_KEYCODE, "9"); waddstr(curwin, "]"); waddstr(curwin, " or "); - attrpr(curwin, ATTR_KEYCODE_STR, ""); + attrpr(curwin, ATTR_KEYCODE, ""); waddstr(curwin, " to cancel: "); curs_set(CURS_ON); @@ -604,25 +604,33 @@ void bankrupt_player (bool forced) if (forced) { if (longname) { - center(curwin, 3, ATTR_ERROR_STR, "%s", player[current_player].name); - center(curwin, 4, ATTR_ERROR_STR, "has been declared bankrupt by the"); - center(curwin, 5, ATTR_ERROR_STR, "Interstellar Trading Bank"); - } else { - center(curwin, 3, ATTR_ERROR_STR, "%s has been declared bankrupt", + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "%s", player[current_player].name); - center(curwin, 4, ATTR_ERROR_STR, "by the Interstellar Trading Bank"); + center(curwin, 4, ATTR_ERROR_HIGHLIGHT, + "has been declared bankrupt by the"); + center(curwin, 5, ATTR_ERROR_HIGHLIGHT, + "Interstellar Trading Bank"); + } else { + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, + "%s has been declared bankrupt", + player[current_player].name); + center(curwin, 4, ATTR_ERROR_HIGHLIGHT, + "by the Interstellar Trading Bank"); } } else { if (longname) { - center(curwin, 3, ATTR_ERROR_STR, "%s", player[current_player].name); - center(curwin, 4, ATTR_ERROR_STR, "has declared bankruptcy"); + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "%s", + player[current_player].name); + center(curwin, 4, ATTR_ERROR_HIGHLIGHT, + "has declared bankruptcy"); } else { - center(curwin, 3, ATTR_ERROR_STR, "%s has declared bankruptcy", + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, + "%s has declared bankruptcy", player[current_player].name); } } - wait_for_key(curwin, getmaxy(curwin) - 2, ATTR_WAITERROR_STR); + wait_for_key(curwin, getmaxy(curwin) - 2, ATTR_ERROR_WAITFORKEY); deltxwin(); txrefresh(); @@ -693,12 +701,12 @@ void try_start_new_company (int x, int y) newtxwin(8, 50, 7, WCENTER(50), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " New Company "); - center(curwin, 3, ATTR_NORMAL_WINDOW, "A new company has been formed!"); - center2(curwin, 4, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, - "Its name is ", "%s", company[i].name); + center(curwin, 1, ATTR_TITLE, " New Company "); + center(curwin, 3, ATTR_NORMAL, "A new company has been formed!"); + center2(curwin, 4, ATTR_NORMAL, ATTR_HIGHLIGHT, "Its name is ", + "%s", company[i].name); - wait_for_key(curwin, 6, ATTR_WAITNORMAL_STR); + wait_for_key(curwin, 6, ATTR_WAITFORKEY); deltxwin(); txrefresh(); @@ -765,25 +773,25 @@ void merge_companies (map_val_t a, map_val_t b) newtxwin(number_players + 14, WIN_COLS - 4, 9 - number_players, WCENTER(WIN_COLS - 4), true, ATTR_NORMAL_WINDOW); - center(curwin, 1, ATTR_WINDOW_TITLE, " Company Merger "); - center3(curwin, 3, ATTR_HIGHLIGHT_STR, ATTR_HIGHLIGHT_STR, ATTR_NORMAL_WINDOW, + center(curwin, 1, ATTR_TITLE, " Company Merger "); + center3(curwin, 3, ATTR_HIGHLIGHT, ATTR_HIGHLIGHT, ATTR_NORMAL, company[bb].name, company[aa].name, " has just merged into "); - center(curwin, 5, ATTR_NORMAL_WINDOW, "Please note the following transactions:"); + center(curwin, 5, ATTR_NORMAL, "Please note the following transactions:"); - center2(curwin, 7, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, " Old stock: ", + center2(curwin, 7, ATTR_NORMAL, ATTR_HIGHLIGHT, " Old stock: ", "%-20s", company[bb].name); - center2(curwin, 8, ATTR_NORMAL_WINDOW, ATTR_HIGHLIGHT_STR, " New stock: ", + center2(curwin, 8, ATTR_NORMAL, ATTR_HIGHLIGHT, " New stock: ", "%-20s", company[aa].name); // Handle the locale's currency symbol snprintf(buf, BUFSIZE, "Bonus (%s)", localeconv_info.currency_symbol); int w = getmaxx(curwin) - 52; - wattrset(curwin, ATTR_WINDOW_SUBTITLE); + wattrset(curwin, ATTR_SUBTITLE); mvwprintw(curwin, 10, 2, " %-*.*s %8s %8s %8s %12s ", w, w, "Player", "Old", "New", "Total", buf); - wattrset(curwin, ATTR_NORMAL_WINDOW); + wattrset(curwin, ATTR_NORMAL); total_new = 0; for (line = 11, i = 0; i < number_players; i++) { @@ -827,7 +835,7 @@ void merge_companies (map_val_t a, map_val_t b) } } - wait_for_key(curwin, getmaxy(curwin) - 2, ATTR_WAITNORMAL_STR); + wait_for_key(curwin, getmaxy(curwin) - 2, ATTR_WAITFORKEY); deltxwin(); // "Company merger" window txrefresh(); @@ -932,15 +940,15 @@ void adjust_values (void) newtxwin(10, 60, 6, WCENTER(60), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " Bankruptcy Court "); - center(curwin, 3, ATTR_ERROR_STR, "%s has been declared", + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "%s has been declared", company[which].name); - center(curwin, 4, ATTR_ERROR_STR, + center(curwin, 4, ATTR_ERROR_HIGHLIGHT, "bankrupt by the Interstellar Trading Bank."); center(curwin, 6, ATTR_ERROR_WINDOW, "All assets have been taken to repay outstanding loans."); - wait_for_key(curwin, 8, ATTR_WAITERROR_STR); + wait_for_key(curwin, 8, ATTR_ERROR_WAITFORKEY); deltxwin(); txrefresh(); @@ -962,26 +970,26 @@ void adjust_values (void) newtxwin(14, 60, 4, WCENTER(60), true, ATTR_ERROR_WINDOW); center(curwin, 1, ATTR_ERROR_TITLE, " Bankruptcy Court "); - center(curwin, 3, ATTR_ERROR_STR, "%s has been declared", + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, "%s has been declared", company[which].name); - center(curwin, 4, ATTR_ERROR_STR, + center(curwin, 4, ATTR_ERROR_HIGHLIGHT, "bankrupt by the Interstellar Trading Bank."); - center2(curwin, 6, ATTR_ERROR_WINDOW, ATTR_ERROR_STR, + center2(curwin, 6, ATTR_ERROR_NORMAL, ATTR_ERROR_HIGHLIGHT, "The Bank has agreed to pay stock holders ", "%4.2f%%", rate * 100.0); - center(curwin, 7, ATTR_ERROR_WINDOW, + center(curwin, 7, ATTR_ERROR_NORMAL, "of the share value on each share owned."); l_strfmon(buf, BUFSIZE, "%12n", company[which].share_price); - center2(curwin, 9, ATTR_ERROR_WINDOW, ATTR_ERROR_STR, + center2(curwin, 9, ATTR_ERROR_NORMAL, ATTR_ERROR_HIGHLIGHT, "Old share value: ", "%s", buf); l_strfmon(buf, BUFSIZE, "%12n", company[which].share_price * rate); - center2(curwin, 10, ATTR_ERROR_WINDOW, ATTR_ERROR_STR, + center2(curwin, 10, ATTR_ERROR_NORMAL, ATTR_ERROR_HIGHLIGHT, "Amount paid per share: ", "%s", buf); - wait_for_key(curwin, 12, ATTR_WAITERROR_STR); + wait_for_key(curwin, 12, ATTR_ERROR_WAITFORKEY); deltxwin(); txrefresh(); @@ -1075,13 +1083,15 @@ void adjust_values (void) center(curwin, 1, ATTR_ERROR_TITLE, " Interstellar Trading Bank "); l_strfmon(buf, BUFSIZE, "%1n", player[current_player].debt); - center(curwin, 3, ATTR_ERROR_STR, "Your debt has amounted to %s", buf); + center(curwin, 3, ATTR_ERROR_HIGHLIGHT, + "Your debt has amounted to %s", buf); l_strfmon(buf, BUFSIZE, "%1n", impounded); - center3(curwin, 4, ATTR_ERROR_WINDOW, ATTR_ERROR_WINDOW, ATTR_ERROR_STR, - "The Bank has impounded ", " from your cash", "%s", buf); + center3(curwin, 4, ATTR_ERROR_NORMAL, ATTR_ERROR_NORMAL, + ATTR_ERROR_HIGHLIGHT, "The Bank has impounded ", + " from your cash", "%s", buf); - wait_for_key(curwin, 6, ATTR_WAITERROR_STR); + wait_for_key(curwin, 6, ATTR_ERROR_WAITFORKEY); deltxwin(); txrefresh();