diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-01 19:18:06 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-01 19:18:06 +0000 |
commit | 313d4612b5af4371c00d24fa3559a7310c6f3849 (patch) | |
tree | aa465a848b4364d4940f1cdf42baf6e94ce89b20 /crawl-ref/source/hiscores.cc | |
parent | 1fcb6aa13880495afd0c26e28f9c62d8d99397e0 (diff) | |
download | crawl-ref-313d4612b5af4371c00d24fa3559a7310c6f3849.tar.gz crawl-ref-313d4612b5af4371c00d24fa3559a7310c6f3849.zip |
Fixed bad species name (eg: deep elves with the bows title) in dump because of reuse of static buffers (Iaido).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2288 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/hiscores.cc')
-rw-r--r-- | crawl-ref/source/hiscores.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 830fa9f0f4..80228016fc 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -659,7 +659,7 @@ void scorefile_entry::set_base_xlog_fields() const fields->add_field("lv", SCORE_VERSION); fields->add_field("name", "%s", name.c_str()); fields->add_field("uid", "%d", uid); - fields->add_field("race", "%s", species_name(race, lvl)); + fields->add_field("race", "%s", species_name(race, lvl).c_str()); fields->add_field("cls", "%s", get_class_name(cls)); fields->add_field("char", "%s%s", get_species_abbrev(race), @@ -667,8 +667,9 @@ void scorefile_entry::set_base_xlog_fields() const fields->add_field("xl", "%d", lvl); fields->add_field("sk", "%s", skill_name(best_skill)); fields->add_field("sklev", "%d", best_skill_lvl); - fields->add_field("title", "%s", skill_title( best_skill, best_skill_lvl, - race, str, dex, god ) ); + fields->add_field("title", "%s", + skill_title( best_skill, best_skill_lvl, + race, str, dex, god ).c_str() ); fields->add_field("place", "%s", place_name(get_packed_place(branch, dlvl, level_type), @@ -1201,19 +1202,17 @@ scorefile_entry::character_description(death_desc_verbosity verbosity) const // Please excuse the following bit of mess in the name of flavour ;) if (verbose) { - strncpy( scratch, skill_title( best_skill, best_skill_lvl, - race, str, dex, god ), - INFO_SIZE ); - snprintf( buf, HIGHSCORE_SIZE, "%8ld %s the %s (level %d", - points, name.c_str(), scratch, lvl ); - + points, name.c_str(), + skill_title( best_skill, best_skill_lvl, + race, str, dex, god ).c_str(), + lvl ); desc = buf; } else { snprintf( buf, HIGHSCORE_SIZE, "%8ld %s the %s %s (level %d", - points, name.c_str(), species_name(race, lvl), + points, name.c_str(), species_name(race, lvl).c_str(), get_class_name(cls), lvl ); desc = buf; } @@ -1237,10 +1236,11 @@ scorefile_entry::character_description(death_desc_verbosity verbosity) const if (verbose) { - const char *const srace = species_name( race, lvl ); - + std::string srace = species_name( race, lvl ); snprintf( scratch, INFO_SIZE, "Began as a%s %s %s", - is_vowel(*srace) ? "n" : "", srace, get_class_name(cls) ); + is_vowel(srace[0]) ? "n" : "", + srace.c_str(), + get_class_name(cls) ); desc += scratch; if (birth_time > 0) |