diff options
author | Bardur Arantsson <bardur@scientician.net> | 2017-05-02 19:20:57 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2017-05-02 19:20:57 +0200 |
commit | ca47ccdc66d252e0b5791112cac4042e86cefc89 (patch) | |
tree | eee43a66c0351f088eea2e9bb288eec7b8bb298b /src | |
parent | 598c5887ae589059e4f4a9801ff1e4f7f8385f00 (diff) |
Remove character background
Diffstat (limited to 'src')
-rw-r--r-- | src/birth.cc | 332 | ||||
-rw-r--r-- | src/birther.hpp | 5 | ||||
-rw-r--r-- | src/cmd4.cc | 4 | ||||
-rw-r--r-- | src/files.cc | 48 | ||||
-rw-r--r-- | src/game_edit_data.hpp | 6 | ||||
-rw-r--r-- | src/hist_type.hpp | 18 | ||||
-rw-r--r-- | src/init1.cc | 32 | ||||
-rw-r--r-- | src/loadsave.cc | 10 | ||||
-rw-r--r-- | src/player_race.hpp | 2 | ||||
-rw-r--r-- | src/variable.cc | 5 | ||||
-rw-r--r-- | src/variable.hpp | 1 |
11 files changed, 22 insertions, 441 deletions
diff --git a/src/birth.cc b/src/birth.cc index f18c87fa..c94fbf4d 100644 --- a/src/birth.cc +++ b/src/birth.cc @@ -19,7 +19,6 @@ #include "game.hpp" #include "gods.hpp" #include "help.hpp" -#include "hist_type.hpp" #include "hooks.hpp" #include "init2.hpp" #include "mimic.hpp" @@ -200,12 +199,6 @@ static void save_prev_data(void) previous_char.stat[i] = p_ptr->stat_max[i]; } previous_char.luck = p_ptr->luck_base; - - /* Save the history */ - for (int i = 0; i < 4; i++) - { - strcpy(previous_char.history[i], history[i]); - } } @@ -230,13 +223,6 @@ static void load_prev_data(bool_ save) } temp.luck = p_ptr->luck_base; - /* Save the history */ - for (int i = 0; i < 4; i++) - { - strcpy(temp.history[i], history[i]); - } - - /*** Load the previous data ***/ /* Load the data */ @@ -251,12 +237,6 @@ static void load_prev_data(bool_ save) p_ptr->luck_base = previous_char.luck; p_ptr->luck_max = previous_char.luck; - /* Load the history */ - for (int i = 0; i < 4; i++) - { - strcpy(history[i], previous_char.history[i]); - } - /*** Save the current data ***/ if (!save) return; @@ -270,12 +250,6 @@ static void load_prev_data(bool_ save) previous_char.stat[i] = temp.stat[i]; } previous_char.luck = temp.luck; - - /* Save the history */ - for (int i = 0; i < 4; i++) - { - strcpy(previous_char.history[i], temp.history[i]); - } } @@ -487,102 +461,6 @@ static void get_extra(void) /* - * Get the racial history, and social class, using the "history charts". - */ -static void get_history(void) -{ - auto const &bg = game->edit_data.bg; - - int i, n, chart, roll; - - char *s, *t; - - char buf[240]; - - - /* Clear the previous history strings */ - for (i = 0; i < 4; i++) - { - history[i][0] = '\0'; - } - - /* Clear the history text */ - buf[0] = '\0'; - - /* Starting place */ - chart = rp_ptr->chart; - - /* Process the history */ - while (chart) - { - /* Start over */ - i = 0; - - /* Roll for nobility */ - roll = randint(100); - - /* Access the proper entry in the table */ - while ((chart != bg[i].chart) || (roll > bg[i].roll)) - { - i++; - } - - /* Acquire the textual history */ - strcat(buf, bg[i].info.c_str()); - strcat(buf, " "); - - /* Enter the next chart */ - chart = bg[i].next; - } - - /* Skip leading spaces */ - for (s = buf; *s == ' '; s++) /* loop */; - - /* Get apparent length */ - n = strlen(s); - - /* Kill trailing spaces */ - while ((n > 0) && (s[n - 1] == ' ')) s[--n] = '\0'; - - - /* Start at first line */ - i = 0; - - /* Collect the history */ - while (TRUE) - { - /* Extract remaining length */ - n = strlen(s); - - /* All done */ - if (n < 60) - { - /* Save one line of history */ - strcpy(history[i++], s); - - /* All done */ - break; - } - - /* Find a reasonable break-point */ - for (n = 60; ((n > 0) && (s[n - 1] != ' ')); n--) /* loop */; - - /* Save next location */ - t = s + n; - - /* Wipe trailing spaces */ - while ((n > 0) && (s[n - 1] == ' ')) s[--n] = '\0'; - - /* Save one line of history */ - strcpy(history[i++], s); - - /* Start next line */ - for (s = t; *s == ' '; s++) /* loop */; - } -} - - -/* * Fill the random_artifacts array with relevant info. */ static errr init_randart(void) @@ -709,16 +587,6 @@ static void player_wipe(void) /* Not dead yet */ p_ptr->lives = 0; - /* Wipe the history */ - for (std::size_t i = 0; i < 4; i++) - { - for (std::size_t j = 0; j < 60; j++) - { - if (j < 59) history[i][j] = ' '; - else history[i][j] = '\0'; - } - } - /* Wipe the towns */ for (std::size_t i = 0; i < d_info.size(); i++) { @@ -2249,8 +2117,6 @@ static bool_ player_birth_aux_point(void) char buf[80]; - int mode = 0; - /* Initialize stats */ for (i = 0; i < 6; i++) @@ -2263,9 +2129,6 @@ static bool_ player_birth_aux_point(void) /* Roll for base hitpoints */ get_extra(); - /* Roll for social class */ - get_history(); - /* Get luck */ p_ptr->luck_base = rp_ptr->luck + rmp_ptr->luck + rand_range( -5, 5); p_ptr->luck_max = p_ptr->luck_base; @@ -2318,7 +2181,7 @@ static bool_ player_birth_aux_point(void) p_ptr->csp = p_ptr->msp; /* Display the player */ - display_player(mode); + display_player(0); /* Display the costs header */ put_str("Cost", row - 2, col + 32); @@ -2388,8 +2251,6 @@ static bool_ player_birth_aux_auto() { int i, j, m, v; - int mode = 0; - bool_ flag = FALSE; bool_ prev = FALSE; @@ -2607,15 +2468,9 @@ static bool_ player_birth_aux_auto() /*** Display ***/ - /* Mode */ - mode = 0; - /* Roll for base hitpoints */ get_extra(); - /* Roll for social class */ - get_history(); - /* Roll for gold */ get_money(); @@ -2635,15 +2490,13 @@ static bool_ player_birth_aux_auto() p_ptr->csp = p_ptr->msp; /* Display the player */ - display_player(mode); + display_player(0); /* Prepare a prompt (must squeeze everything in) */ Term_gotoxy(2, 23); Term_addch(TERM_WHITE, b1); Term_addstr( -1, TERM_WHITE, "'r' to reroll"); if (prev) Term_addstr( -1, TERM_WHITE, ", 'p' for prev"); - if (mode) Term_addstr( -1, TERM_WHITE, ", 'h' for Misc."); - else Term_addstr( -1, TERM_WHITE, ", 'h' for History"); Term_addstr( -1, TERM_WHITE, ", or ESC to accept"); Term_addch(TERM_WHITE, b2); @@ -2669,13 +2522,6 @@ static bool_ player_birth_aux_auto() continue; } - /* Toggle the display */ - if ((c == 'H') || (c == 'h')) - { - mode = ((mode != 0) ? 0 : 1); - continue; - } - /* Help */ if (c == '?') { @@ -2718,10 +2564,6 @@ static bool_ player_birth_aux() char c; - int y = 0, x = 0; - - char old_history[4][60]; - /* Ask */ if (!player_birth_aux_ask()) return (FALSE); @@ -2789,92 +2631,9 @@ static bool_ player_birth_aux() if (!player_birth_aux_auto()) return FALSE; } - /* Edit character background */ - for (std::size_t i = 0; i < 4; i++) - { - strnfmt(old_history[i], 60, "%s", history[i]); - } - - /* Turn NUL to space */ - for (std::size_t i = 0; i < 4; i++) - { - std::size_t j = 0; - - // Search for the NUL - while (history[i][j++]) - ;; - - // Turn into spaces - for (; j < 59; j++) - { - history[i][j] = ' '; - } - } - display_player(1); - c_put_str(TERM_L_GREEN, "(Character Background - Edit Mode)", 15, 20); - while (TRUE) - { - for (std::size_t i = 0; i < 4; i++) - { - put_str(history[i], i + 16, 10); - } - c_put_str(TERM_L_BLUE, format("%c", history[y][x]), y + 16, x + 10); - - /* Place cursor just after cost of current stat */ - Term_gotoxy(x + 10, y + 16); - - c = inkey(); - - if (c == '8') - { - y--; - if (y < 0) y = 3; - } - else if (c == '2') - { - y++; - if (y > 3) y = 0; - } - else if (c == '6') - { - x++; - if (x > 59) x = 0; - } - else if (c == '4') - { - x--; - if (x < 0) x = 59; - } - else if (c == '\r') - { - break; - } - else if (c == ESCAPE) - { - for (std::size_t i = 0; i < 4; i++) - { - strnfmt(history[i], 60, "%s", old_history[i]); - put_str(history[i], i + 16, 10); - } - break; - } - else - { - history[y][x++] = c; - if (x > 58) - { - x = 0; - y++; - if (y > 3) y = 0; - } - } - } - - /*** Finish up ***/ /* Get a name, recolor it, prepare savefile */ - get_name(); @@ -2901,90 +2660,6 @@ static bool_ player_birth_aux() /* - * Helper function for validate_bg(). - */ -static void validate_bg_aux(int chart, bool_ chart_checked[], std::string &buf) -{ - auto const &bg = game->edit_data.bg; - - /* Assume the chart does not exist */ - bool_ chart_exists = FALSE; - - /* Assume the chart is not complete */ - bool_ chart_complete = FALSE; - - /* No chart */ - if (!chart) return; - - /* Already saw this chart */ - if (chart_checked[chart]) return; - - /* XXX XXX XXX */ - buf += fmt::format("{:d} --> ", chart); - - /* Check each chart */ - for (auto const &hist: bg) - { - /* Require same chart */ - if (hist.chart != chart) continue; - - /* The chart exists */ - chart_exists = TRUE; - - /* Validate the "next" chart recursively */ - validate_bg_aux(hist.next, chart_checked, buf); - - /* Require a terminator */ - if (hist.roll != 100) continue; - - /* The chart is complete */ - chart_complete = TRUE; - } - - /* Failed: The chart does not exist */ - if (!chart_exists) - { - quit_fmt("birth.c: bg[] chart %d does not exist\n%s", chart, buf.c_str()); - } - - /* Failed: The chart is not complete */ - if (!chart_complete) - { - quit_fmt("birth.c: bg[] chart %d is not complete", chart); - } - - /* Remember we saw this chart */ - chart_checked[chart] = TRUE; -} - - -/* - * Verify that the bg[] table is valid. - */ -static void validate_bg(void) -{ - auto const &race_info = game->edit_data.race_info; - - bool_ chart_checked[512]; - - for (std::size_t i = 0; i < 512; i++) - { - chart_checked[i] = FALSE; - } - - /* Check each race */ - for (auto const &race: race_info) - { - /* Get the first chart for this race */ - int chart = race.chart; - - /* Validate the chart recursively */ - std::string buf; - validate_bg_aux(chart, chart_checked, buf); - } -} - -/* * Initialize a random town */ static void init_town(int t_idx) @@ -3015,9 +2690,6 @@ void player_birth(void) /* Starting index for generated towns */ std::size_t rtown = TOWN_RANDOM; - /* Validate the bg[] table */ - validate_bg(); - /* Create a new character */ while (1) { diff --git a/src/birther.hpp b/src/birther.hpp index 566bcb42..7b7baa89 100644 --- a/src/birther.hpp +++ b/src/birther.hpp @@ -2,6 +2,9 @@ #include "h-basic.h" +#include <string> +#include <vector> + /** * Player information during the birth process. */ @@ -23,7 +26,5 @@ struct birther s16b stat[6]; s16b luck; - char history[4][60]; - bool_ quick_ok; }; diff --git a/src/cmd4.cc b/src/cmd4.cc index afb84def..59554dc4 100644 --- a/src/cmd4.cc +++ b/src/cmd4.cc @@ -149,8 +149,8 @@ void do_cmd_change_name(void) /* Forever */ while (1) { - /* keep mode below 7 */ - mode = (mode + 6) % 6; + /* keep mode below 5 */ + mode = (mode + 5) % 5; /* Display the player */ display_player(mode); diff --git a/src/files.cc b/src/files.cc index 49505292..e148a679 100644 --- a/src/files.cc +++ b/src/files.cc @@ -2205,23 +2205,14 @@ static void display_player_ben_one(int page) } // namespace <anonymous> /* - * Display the character on the screen (various modes) - * - * The top two and bottom two lines are left blank. - * - * Mode 0 = standard display with skills - * Mode 1 = standard display with history - * Mode 2 = current flags (part 1) - * Mode 3 = current flags (part 2) - * Mode 4 = current flags (part 3) - * Mode 5 = current flags (part 4) - * Mode 6 = current flags (part 5 -- esp) + * Display the character on the screen */ void display_player(int mode) { auto const &r_info = game->edit_data.r_info; - int i; + assert(mode >= 0); + assert(mode < 5); char buf[80]; @@ -2230,7 +2221,7 @@ void display_player(int mode) clear_from(0); /* Standard */ - if ((mode == 0) || (mode == 1)) + if (mode == 0) { auto r_ptr = &r_info[p_ptr->body_monster]; @@ -2252,7 +2243,7 @@ void display_player(int mode) c_put_str(TERM_L_BLUE, deity_info[p_ptr->pgod].name, 6, 9); /* Display the stats */ - for (i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) { char punctuation = p_ptr->stat_max[i] == 18 + 100 ? '!' : ':'; /* Special treatment of "injured" stats */ @@ -2305,30 +2296,15 @@ void display_player(int mode) /* Extra info */ display_player_middle(); - /* Display "history" info */ - if (mode == 1) - { - put_str("(Character Background)", 15, 25); - - for (i = 0; i < 4; i++) - { - put_str(history[i], i + 16, 10); - } - } - /* Display "various" info */ - else - { - put_str("(Miscellaneous Abilities)", 15, 25); - - display_player_various(); - } + put_str("(Miscellaneous Abilities)", 15, 25); + display_player_various(); } /* Special */ else { - display_player_ben_one(mode - 2); + display_player_ben_one(mode - 1); } } @@ -2795,19 +2771,19 @@ errr file_character(cptr name, bool_ full) fprintf (fff, "\n\n"); /* adds and slays */ - display_player (2); + display_player(1); file_character_print_grid(fff, FALSE, TRUE); /* sustains and resistances */ - display_player (3); + display_player(2); file_character_print_grid(fff, TRUE, FALSE); /* stuff */ - display_player (4); + display_player(3); file_character_print_grid(fff, FALSE, FALSE); /* a little bit of stuff */ - display_player (5); + display_player(4); file_character_print_grid(fff, FALSE, FALSE); /* Dump corruptions */ diff --git a/src/game_edit_data.hpp b/src/game_edit_data.hpp index cc3af2dc..a4727d90 100644 --- a/src/game_edit_data.hpp +++ b/src/game_edit_data.hpp @@ -5,7 +5,6 @@ #include "dungeon_info_type.hpp" #include "ego_item_type.hpp" #include "feature_type.hpp" -#include "hist_type.hpp" #include "monster_ego.hpp" #include "monster_race.hpp" #include "object_kind.hpp" @@ -102,11 +101,6 @@ struct GameEditData { std::vector<player_race_mod> race_mod_info; /** - * Player race histories - */ - std::vector<hist_type> bg; - - /** * Player skills */ std::vector<skill_descriptor> s_descriptors; diff --git a/src/hist_type.hpp b/src/hist_type.hpp deleted file mode 100644 index 07b5a632..00000000 --- a/src/hist_type.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "h-basic.h" - -#include <string> - -/** - * Player background descriptor. - */ -struct hist_type -{ - std::string info; /* Textual History */ - - byte roll; /* Frequency of this entry */ - s16b chart; /* Chart index */ - s16b next; /* Next chart index */ - byte bonus; /* Social Class Bonus + 50 */ -}; diff --git a/src/init1.cc b/src/init1.cc index 96c1b067..056b5b51 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -13,7 +13,6 @@ #include "files.hpp" #include "game.hpp" #include "gods.hpp" -#include "hist_type.hpp" #include "init2.hpp" #include "monster2.hpp" #include "monster_ego.hpp" @@ -880,7 +879,6 @@ errr init_player_info_txt(FILE *fp) auto &class_info = game->edit_data.class_info; auto &race_info = game->edit_data.race_info; auto &race_mod_info = game->edit_data.race_mod_info; - auto &bg = game->edit_data.bg; auto &gen_skill = game->edit_data.gen_skill; int lev = 1; @@ -919,29 +917,6 @@ errr init_player_info_txt(FILE *fp) continue; } - /* Process 'H' for "History" */ - if (buf[0] == 'H') - { - char *zz[5]; - - /* Scan for the values */ - if (tokenize(buf + 2, 5, zz, ':', ':') != 5) return (1); - - /* Create new entry */ - hist_type hist; - hist.roll = atoi(zz[0]); - hist.chart = atoi(zz[1]); - hist.next = atoi(zz[2]); - hist.bonus = atoi(zz[3]); - hist.info = my_strdup(zz[4]); - - /* Append */ - bg.emplace_back(hist); - - /* Next... */ - continue; - } - /* Process 'G:k' for "General skills" */ if ((buf[0] == 'G') && (buf[2] == 'k')) { @@ -1107,16 +1082,15 @@ errr init_player_info_txt(FILE *fp) /* Process 'P' for "xtra" */ if ((buf[0] == 'R') && (buf[2] == 'P')) { - int s[4]; + int s[3]; /* Scan for the values */ - if (4 != sscanf(buf + 4, "%d:%d:%d:%d", - &s[0], &s[1], &s[2], &s[3])) return (1); + if (3 != sscanf(buf + 4, "%d:%d:%d", + &s[0], &s[1], &s[2])) return (1); rp_ptr->ps.mhp = s[0]; rp_ptr->ps.exp = s[1]; rp_ptr->infra = s[2]; - rp_ptr->chart = s[3]; /* Next... */ continue; diff --git a/src/loadsave.cc b/src/loadsave.cc index ad824536..196e8d81 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -403,11 +403,6 @@ static void do_quick_start(ls_flag_t flag, birther &previous_char) do_s16b(&previous_char.luck, flag); do_bool(&previous_char.quick_ok, flag); - - for (std::size_t i = 0; i < 4; i++) - { - do_string(previous_char.history[i], 60, flag); - } } static void do_skill_modifier(skill_modifier *s, ls_flag_t flag) @@ -524,11 +519,6 @@ static bool_ do_extra(ls_flag_t flag) do_std_string(game->died_from, flag); - for (std::size_t i = 0; i < 4; i++) - { - do_string(history[i], 60, flag); - } - /* Handle the special levels info */ { byte tmp8u = d_info.size(); diff --git a/src/player_race.hpp b/src/player_race.hpp index a2f4699c..e0b236db 100644 --- a/src/player_race.hpp +++ b/src/player_race.hpp @@ -34,8 +34,6 @@ struct player_race byte body_parts[BODY_MAX] { }; /* To help to decide what to use when body changing */ - s16b chart = 0; /* Chart history */ - player_race_flag_set flags; std::array<player_level_flag, PY_MAX_LEVEL+1> lflags; diff --git a/src/variable.cc b/src/variable.cc index 8395a75e..3b81a51a 100644 --- a/src/variable.cc +++ b/src/variable.cc @@ -202,11 +202,6 @@ object_type *tracked_object; /* - * Hack -- Textual "history" for the Player - */ -char history[4][60]; - -/* * Buffer to hold the current savefile name */ char savefile[1024]; diff --git a/src/variable.hpp b/src/variable.hpp index a4678bae..ebbca153 100644 --- a/src/variable.hpp +++ b/src/variable.hpp @@ -105,7 +105,6 @@ extern s16b health_who; extern s16b monster_race_idx; extern s16b monster_ego_idx; extern object_type *tracked_object; -extern char history[4][60]; extern s16b lite_n; extern s16b lite_y[LITE_MAX]; extern s16b lite_x[LITE_MAX]; |