diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-24 16:26:48 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-24 16:26:48 +0200 |
commit | 6bbd3e9e43fddca75b87d5bca1fc1a37faf87357 (patch) | |
tree | a07916f901ac860052e7562d2ec0f5efc51e40dc /crawl-ref/source | |
parent | e4d195a439f1cbcd6a4302a3fd7d7454cfb04d42 (diff) | |
download | crawl-ref-6bbd3e9e43fddca75b87d5bca1fc1a37faf87357.tar.gz crawl-ref-6bbd3e9e43fddca75b87d5bca1fc1a37faf87357.zip |
Convert player::your_name to std::string.
Doesn't seem to break anything...
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/acr.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/arena.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/crash-u.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/ctest.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/debug.cc | 20 | ||||
-rw-r--r-- | crawl-ref/source/files.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/files.h | 4 | ||||
-rw-r--r-- | crawl-ref/source/ghost.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/initfile.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/l_you.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/newgame.cc | 110 | ||||
-rw-r--r-- | crawl-ref/source/newgame.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/ouch.cc | 16 | ||||
-rw-r--r-- | crawl-ref/source/output.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/player.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/tags.cc | 4 |
17 files changed, 87 insertions, 121 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 9873519f4c..59294d07f9 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1925,11 +1925,7 @@ void process_command( command_type cmd ) break; case CMD_CHARACTER_DUMP: - char name_your[kNameLen+1]; - - strncpy(name_your, you.your_name, kNameLen); - name_your[kNameLen] = 0; - if (dump_char( name_your, false )) + if (dump_char(you.your_name, false)) mpr("Char dumped successfully."); else mpr("Char dump unsuccessful! Sorry about that."); @@ -3611,11 +3607,10 @@ static bool _initialise(void) #ifdef CLUA_BINDINGS clua.runhook("chk_startgame", "b", newc); - std::string yname = you.your_name; + std::string yname = you.your_name; // XXX: what's this for? read_init_file(true); Options.fixup_options(); - strncpy(you.your_name, yname.c_str(), kNameLen); - you.your_name[kNameLen - 1] = 0; + you.your_name = yname; // In case Lua changed the character set. init_char_table(Options.char_set); diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc index 1c8037146c..2d03feb352 100644 --- a/crawl-ref/source/arena.cc +++ b/crawl-ref/source/arena.cc @@ -480,7 +480,7 @@ namespace arena you.moveto(yplace); crawl_state.arena = true; - strcpy(you.your_name, "Arena"); + you.your_name = "Arena"; you.hp = you.hp_max = 99; diff --git a/crawl-ref/source/crash-u.cc b/crawl-ref/source/crash-u.cc index 60c60c5e95..f7e6f8c14c 100644 --- a/crawl-ref/source/crash-u.cc +++ b/crawl-ref/source/crash-u.cc @@ -81,7 +81,7 @@ static void _crash_signal_handler(int sig_num) char name[180]; sprintf(name, "%scrash-recursive-%s-%d.txt", dir.c_str(), - you.your_name, (int) time(NULL)); + you.your_name.c_str(), (int) time(NULL)); FILE* file = fopen(name, "w"); diff --git a/crawl-ref/source/ctest.cc b/crawl-ref/source/ctest.cc index b96bdd0491..53824859c9 100644 --- a/crawl-ref/source/ctest.cc +++ b/crawl-ref/source/ctest.cc @@ -44,8 +44,7 @@ namespace crawl_tests ntests = 0; nsuccess = 0; failures.clear(); - // XXX: Good grief, you.your_name is still not a C++ string?! - strncpy(you.your_name, test_player_name.c_str(), kNameLen); + you.your_name = test_player_name; you.your_name[kNameLen - 1] = 0; you.species = test_player_species; you.char_class = test_player_job; diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 3b3c269f29..f1097def10 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -6109,22 +6109,6 @@ static void _dump_player(FILE *file) fprintf(file, "{{{{{{{{{{{" EOL); bool name_overrun = true; - for (int i = 0; i < kNameLen; ++i) - { - if (you.your_name[i] == '\0') - { - name_overrun = false; - break; - } - } - - if (name_overrun) - { - fprintf(file, "Player name runs past end of your_name buffer." EOL); - you.your_name[kNameLen - 1] = '\0'; - } - - name_overrun = true; for (int i = 0; i < 30; ++i) { if (you.class_name[i] == '\0') @@ -6140,7 +6124,7 @@ static void _dump_player(FILE *file) you.class_name[29] = '\0'; } - fprintf(file, "Name: [%s]" EOL, you.your_name); + fprintf(file, "Name: [%s]" EOL, you.your_name.c_str()); fprintf(file, "Species: %s" EOL, species_name(you.species, 27).c_str()); fprintf(file, "Class: %s" EOL EOL, get_class_name(you.char_class)); fprintf(file, "class_name: %s" EOL EOL, you.class_name); @@ -6498,7 +6482,7 @@ void do_crash_dump() char name[180]; sprintf(name, "%scrash-%s-%d.txt", dir.c_str(), - you.your_name, (int) time(NULL)); + you.your_name.c_str(), (int) time(NULL)); fprintf(stderr, EOL "Writing crash info to %s" EOL, name); errno = 0; diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index dba2a7b8ac..4d8c1def06 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -821,12 +821,12 @@ static std::string _get_level_suffix(int level, branch_type where, } } -std::string make_filename( const char *prefix, int level, branch_type where, - level_area_type ltype, bool isGhost ) +std::string make_filename(std::string prefix, int level, branch_type where, + level_area_type ltype, bool isGhost) { - return get_savedir_filename( prefix, "", - _get_level_suffix(level, where, ltype), - isGhost ); + return get_savedir_filename(prefix, "", + _get_level_suffix(level, where, ltype), + isGhost ); } static void _write_version( FILE *dataFile, int majorVersion, int minorVersion, @@ -1537,7 +1537,7 @@ void save_game(bool leave_game, const char *farewellmsg) unwind_bool saving_game(crawl_state.saving_game, true); /* Stashes */ - std::string stashFile = get_savedir_filename( you.your_name, "", "st" ); + std::string stashFile = get_savedir_filename(you.your_name, "", "st"); FILE *stashf = fopen(stashFile.c_str(), "wb"); if (stashf) { @@ -1549,14 +1549,14 @@ void save_game(bool leave_game, const char *farewellmsg) #ifdef CLUA_BINDINGS /* lua */ - std::string luaFile = get_savedir_filename( you.your_name, "", "lua" ); + std::string luaFile = get_savedir_filename(you.your_name, "", "lua"); clua.save(luaFile.c_str()); // Note that luaFile may not exist. DO_CHMOD_PRIVATE(luaFile.c_str()); #endif /* kills */ - std::string killFile = get_savedir_filename( you.your_name, "", "kil" ); + std::string killFile = get_savedir_filename(you.your_name, "", "kil"); FILE *killf = fopen(killFile.c_str(), "wb"); if (killf) { @@ -1671,7 +1671,7 @@ void save_game(bool leave_game, const char *farewellmsg) whereis_record("saved"); #endif end(0, false, farewellmsg? "%s" : "See you soon, %s!", - farewellmsg? farewellmsg : you.your_name); + farewellmsg? farewellmsg : you.your_name.c_str()); } // end save_game() // Saves the game without exiting. diff --git a/crawl-ref/source/files.h b/crawl-ref/source/files.h index 083bb380ae..3c05196f4a 100644 --- a/crawl-ref/source/files.h +++ b/crawl-ref/source/files.h @@ -115,8 +115,8 @@ void save_ghost( bool force = false ); /* *********************************************************************** * called from: files hiscores * *********************************************************************** */ -std::string make_filename( const char *prefix, int level, branch_type branch, - level_area_type lt, bool isGhost ); +std::string make_filename(std::string prefix, int level, branch_type branch, + level_area_type lt, bool isGhost ); FILE *lk_open(const char *mode, const std::string &file); void lk_close(FILE *handle, const char *mode, const std::string &file); diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc index bc7a741bf3..1b682b3603 100644 --- a/crawl-ref/source/ghost.cc +++ b/crawl-ref/source/ghost.cc @@ -894,7 +894,7 @@ bool debug_check_ghosts() return (false); // Name validation. - if (!validate_player_name(ghost.name.c_str(), false)) + if (!validate_player_name(ghost.name, false)) return (false); if (ghost.name.length() > (kNameLen - 1) || ghost.name.length() == 0) return (false); diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index d55bfd5e0c..a36763ce4c 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -1388,7 +1388,7 @@ void read_startup_prefs() static void write_newgame_options(FILE *f) { // Write current player name - fprintf(f, "name = %s\n", you.your_name); + fprintf(f, "name = %s\n", you.your_name.c_str()); if (Options.prev_randpick) Options.prev_race = Options.prev_cls = '*'; diff --git a/crawl-ref/source/l_you.cc b/crawl-ref/source/l_you.cc index e21f9d641d..5893fe1dcd 100644 --- a/crawl-ref/source/l_you.cc +++ b/crawl-ref/source/l_you.cc @@ -50,7 +50,7 @@ static const char *transform_name() } LUARET1(you_turn_is_over, boolean, you.turn_is_over) -LUARET1(you_name, string, you.your_name) +LUARET1(you_name, string, you.your_name.c_str()) LUARET1(you_race, string, species_name(you.species, you.experience_level).c_str()) LUARET1(you_class, string, get_class_name(you.char_class)) diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 7682badd34..e73e4bad0b 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -62,7 +62,6 @@ extern std::string init_file_error; #define MIN_START_STAT 3 -static bool _validate_player_name(bool verbose); static void _enter_player_name(bool blankOK); static void _give_basic_knowledge(job_type which_job); static void _give_basic_spells(job_type which_job); @@ -178,12 +177,12 @@ static void _print_character_info() clrscr(); // At this point all of name, species and class should be decided. - if (strlen(you.your_name) > 0 + if (!you.your_name.empty() && you.char_class != JOB_UNKNOWN && you.species != SP_UNKNOWN) { cprintf("Welcome, "); textcolor( YELLOW ); - cprintf("%s the %s %s." EOL, you.your_name, species_name(you.species, 1).c_str(), + cprintf("%s the %s %s." EOL, you.your_name.c_str(), species_name(you.species, 1).c_str(), get_class_name(you.char_class)); } } @@ -286,7 +285,7 @@ static bool _check_saved_game(void) { FILE *handle; - std::string basename = get_savedir_filename( you.your_name, "", "" ); + std::string basename = get_savedir_filename(you.your_name, "", ""); std::string savename = basename + ".sav"; #ifdef LOAD_UNPACKAGE_CMD @@ -852,10 +851,7 @@ bool new_game(void) } if (!Options.player_name.empty()) - { - strncpy(you.your_name, Options.player_name.c_str(), kNameLen); - you.your_name[kNameLen - 1] = 0; - } + you.your_name = Options.player_name; textcolor(LIGHTGREY); @@ -863,15 +859,12 @@ bool new_game(void) // note that you.your_name could already be set from init.txt. // This, clearly, will overwrite such information. {dlb} if (!SysEnv.crawl_name.empty()) - { - strncpy( you.your_name, SysEnv.crawl_name.c_str(), kNameLen ); - you.your_name[ kNameLen - 1 ] = 0; - } + you.your_name = SysEnv.crawl_name; _opening_screen(); _enter_player_name(true); - if (you.your_name[0] != 0) + if (!you.your_name.empty()) { if (_check_saved_game()) { @@ -930,7 +923,7 @@ game_start: } // New: pick name _after_ race and class choices. - if (you.your_name[0] == 0) + if (you.your_name.empty()) { clrscr(); @@ -953,7 +946,7 @@ game_start: textcolor( BROWN ); cprintf(EOL EOL "Welcome back, "); textcolor( YELLOW ); - cprintf("%s!", you.your_name); + cprintf("%s!", you.your_name.c_str()); textcolor( LIGHTGREY ); return (false); @@ -999,9 +992,7 @@ game_start: Options.reset_startup_options(); - // Restore old name. - strncpy(you.your_name, old_name.c_str(), kNameLen); - you.your_name[kNameLen - 1] = 0; + you.your_name = old_name; // Choose new character. goto game_start; @@ -1924,26 +1915,28 @@ static void _show_name_prompt(int where, bool blankOK, textcolor( LIGHTGREY ); } -static void _preprocess_character_name(char *name, bool blankOK) +static void _preprocess_character_name(std::string &name, bool blankOK) { - if (!*name && blankOK && Options.prev_name.length() + if (name.empty() && blankOK && Options.prev_name.length() && Options.remember_name) { - strncpy(name, Options.prev_name.c_str(), kNameLen); - name[kNameLen - 1] = 0; + name = Options.prev_name; } // '.', '?' and '*' are blanked. - if (!name[1] && (*name == '.' || *name == '*' || *name == '?')) - *name = 0; + if (name.length() == 1 + && (name[0] == '.' || name[0] == '*' || name[0] == '?')) + { + name = ""; + } } -static bool _is_good_name(char *name, bool blankOK, bool verbose) +static bool _is_good_name(std::string &name, bool blankOK, bool verbose) { _preprocess_character_name(name, blankOK); // verification begins here {dlb}: - if (you.your_name[0] == 0) + if (name.empty()) { if (blankOK) return (true); @@ -1961,14 +1954,14 @@ static bool _is_good_name(char *name, bool blankOK, bool verbose) // ... having the name "bones" of course! The problem comes from // the fact that bones files would have the exact same filename // as level files for a character named "bones". -- bwr - if (stricmp(you.your_name, "bones") == 0) + if (stricmp(name.c_str(), "bones") == 0) { if (verbose) cprintf(EOL "That's a silly name!" EOL); return (false); } #endif - return (_validate_player_name(verbose)); + return (validate_player_name(name, verbose)); } static int newname_keyfilter(int &ch) @@ -1979,16 +1972,20 @@ static int newname_keyfilter(int &ch) return 1; } -static bool _read_player_name( char *name, int len, - const std::vector<player_save_info> &existing, - slider_menu &menu) +static bool _read_player_name(std::string &name, + const std::vector<player_save_info> &existing, + slider_menu &menu) { const int name_x = wherex(), name_y = wherey(); int (*keyfilter)(int &) = newname_keyfilter; if (existing.empty()) keyfilter = NULL; - - line_reader reader(name, len); + char buf[kNameLen]; + // XXX: Prompt displays garbage otherwise, but don't really know why. + // Other places don't do this. --rob + buf[0] = '\0'; + line_reader reader(buf, sizeof(buf)); + reader.set_keyproc(keyfilter); while (true) @@ -2000,7 +1997,10 @@ static bool _read_player_name( char *name, int len, cgotoxy(name_x, name_y); int ret = reader.read_line(false); if (!ret) + { + name = buf; return (true); + } if (ret == CK_ESCAPE) return (false); @@ -2014,8 +2014,7 @@ static bool _read_player_name( char *name, int len, { const player_save_info &p = *static_cast<player_save_info*>( sel->data ); - strncpy(name, p.name.c_str(), kNameLen); - name[kNameLen - 1] = 0; + name = p.name; return (true); } } @@ -2028,11 +2027,10 @@ static void _enter_player_name(bool blankOK) { int prompt_start = wherey(); bool ask_name = true; - char *name = you.your_name; std::vector<player_save_info> existing_chars; slider_menu char_menu(MF_SINGLESELECT | MF_NOWRAP, false); - if (you.your_name[0] != 0) + if (!you.your_name.empty()) ask_name = false; if (blankOK && (ask_name || !_is_good_name(you.your_name, false, false))) @@ -2077,32 +2075,22 @@ static void _enter_player_name(bool blankOK) _show_name_prompt(prompt_start, blankOK, existing_chars, char_menu); // If the player wants out, we bail out. - if (!_read_player_name(name, kNameLen, existing_chars, char_menu)) + if (!_read_player_name(you.your_name, existing_chars, char_menu)) end(0); - - // Laboriously trim the damn thing. - std::string read_name = name; - trim_string(read_name); - strncpy(name, read_name.c_str(), kNameLen); - name[kNameLen - 1] = 0; + trim_string(you.your_name); } } while (ask_name = !_is_good_name(you.your_name, blankOK, true)); } -static bool _validate_player_name(bool verbose) -{ - return validate_player_name(you.your_name, verbose); -} - -bool validate_player_name(const char* name, bool verbose) +bool validate_player_name(const std::string &name, bool verbose) { #if defined(TARGET_OS_DOS) || defined(TARGET_OS_WINDOWS) // Quick check for CON -- blows up real good under DOS/Windows. - if (stricmp(name, "con") == 0 - || stricmp(name, "nul") == 0 - || stricmp(name, "prn") == 0 - || strnicmp(name, "LPT", 3) == 0) + if (stricmp(name.c_str(), "con") == 0 + || stricmp(name.c_str(), "nul") == 0 + || stricmp(name.c_str(), "prn") == 0 + || strnicmp(name.c_str(), "LPT", 3) == 0) { if (verbose) cprintf(EOL "Sorry, that name gives your OS a headache." EOL); @@ -2110,9 +2098,9 @@ bool validate_player_name(const char* name, bool verbose) } #endif - for (const char *pn = name; *pn; ++pn) + for (unsigned int i = 0; i < name.length(); i++) { - char c = *pn; + char c = name[i]; // Note that this includes systems which may be using the // packaging system. The packaging system is very simple // and doesn't take the time to escape every character that @@ -3252,7 +3240,7 @@ spec_query: { textcolor( BROWN ); bool shortgreet = false; - if (strlen(you.your_name) || you.char_class != JOB_UNKNOWN) + if (!you.your_name.empty() || you.char_class != JOB_UNKNOWN) cprintf("Welcome, "); else { @@ -3261,9 +3249,9 @@ spec_query: } textcolor( YELLOW ); - if (strlen(you.your_name) > 0) + if (!you.your_name.empty()) { - cprintf("%s", you.your_name); + cprintf("%s", you.your_name.c_str()); if (you.char_class != JOB_UNKNOWN) cprintf(" the "); } @@ -3510,8 +3498,8 @@ job_query: textcolor( BROWN ); cprintf("Welcome, "); textcolor( YELLOW ); - if (you.your_name[0]) - cprintf("%s the ", you.your_name); + if (!you.your_name.empty()) + cprintf("%s the ", you.your_name.c_str()); cprintf("%s.", species_name(you.species, 1).c_str()); textcolor( WHITE ); } diff --git a/crawl-ref/source/newgame.h b/crawl-ref/source/newgame.h index dfc9a2ac8e..d48fd291b8 100644 --- a/crawl-ref/source/newgame.h +++ b/crawl-ref/source/newgame.h @@ -68,6 +68,6 @@ bool choose_class(void); * *********************************************************************** */ void give_basic_mutations(species_type speci); -bool validate_player_name(const char *name, bool verbose); +bool validate_player_name(const std::string &name, bool verbose); #endif diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index d18060aa54..21bba6736e 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -1128,7 +1128,7 @@ static std::string morgue_name(time_t when_crawl_got_even) #ifdef SHORT_FILE_NAMES return "morgue"; #else // !SHORT_FILE_NAMES - std::string name = "morgue-" + std::string(you.your_name); + std::string name = "morgue-" + you.your_name; if (tm *loc = TIME_FN(&when_crawl_got_even)) { @@ -1180,11 +1180,11 @@ void end_game( scorefile_entry &se ) { const level_id &place(*i); unlink( - make_filename( you.your_name, - place.absdepth(), - place.branch, - place.level_type, - false ).c_str() ); + make_filename(you.your_name, + place.absdepth(), + place.branch, + place.level_type, + false).c_str()); } // temp levels, if any @@ -1198,7 +1198,7 @@ void end_game( scorefile_entry &se ) LEVEL_PORTAL_VAULT, false ).c_str() ); // create base file name - std::string basename = get_savedir_filename( you.your_name, "", "" ); + std::string basename = get_savedir_filename(you.your_name, "", ""); const char* suffixes[] = { #ifdef CLUA_BINDINGS @@ -1245,7 +1245,7 @@ void end_game( scorefile_entry &se ) clrscr(); clrscr(); - cprintf( "Goodbye, %s.", you.your_name ); + cprintf("Goodbye, %s.", you.your_name.c_str()); cprintf( EOL EOL " " ); // Space padding where # would go in list format std::string hiscore = hiscores_format_single_long( se, true ); diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 938948e626..a03f66ff8a 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1882,7 +1882,7 @@ static std::string _overview_screen_title() you.num_turns, make_time_string(curr, true).c_str() ); } - int linelength = strlen(you.your_name) + strlen(title) + int linelength = you.your_name.length() + strlen(title) + strlen(race_class) + strlen(time_turns); for (int count = 0; linelength >= get_number_of_cols() && count < 2; count++) @@ -1901,7 +1901,7 @@ static std::string _overview_screen_title() default: break; } - linelength = strlen(you.your_name) + strlen(title) + linelength = you.your_name.length() + strlen(title) + strlen(race_class) + strlen(time_turns); } diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 1e59167c7e..00bce8440b 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -161,7 +161,7 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift, mprf(MSGCH_WARN, "Wait a moment, %s! Do you really want to step there?", - you.your_name); + you.your_name.c_str()); if (!you.running.is_any_travel()) more(); @@ -5852,7 +5852,7 @@ void player::init() wizard = false; #endif - your_name[0] = 0; + your_name = ""; banished = false; banished_by.clear(); diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 687615a6eb..4e830ad3d6 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -41,8 +41,8 @@ public: unsigned short prev_targ; coord_def prev_grd_targ; - char your_name[kNameLen]; + std::string your_name; species_type species; job_type char_class; diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 1f1e6a8b06..23b42b61da 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -821,7 +821,7 @@ static void tag_construct_you(writer &th) { int i, j; - marshallString(th, you.your_name, 30); + marshallString(th, you.your_name, kNameLen); marshallByte(th, you.religion); marshallString(th, you.second_god_name); @@ -1230,7 +1230,7 @@ static void tag_read_you(reader &th, char minorVersion) char count_c; short count_s; - unmarshallCString(th, you.your_name, 30); + you.your_name = unmarshallString(th, kNameLen); you.religion = static_cast<god_type>(unmarshallByte(th)); |