summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/newgame.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-01 19:18:06 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-01 19:18:06 +0000
commit313d4612b5af4371c00d24fa3559a7310c6f3849 (patch)
treeaa465a848b4364d4940f1cdf42baf6e94ce89b20 /crawl-ref/source/newgame.cc
parent1fcb6aa13880495afd0c26e28f9c62d8d99397e0 (diff)
downloadcrawl-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/newgame.cc')
-rw-r--r--crawl-ref/source/newgame.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 3a88d2a863..5496ff06e3 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -777,12 +777,12 @@ game_start:
{
clrscr();
- char spec_buff[80];
- strncpy(spec_buff,
- species_name(you.species, you.experience_level), 80);
+ std::string specs = species_name(you.species, you.experience_level);
+ if (specs.length() > 79)
+ specs = specs.substr(0, 79);
cprintf( "You are a%s %s %s." EOL,
- (is_vowel( spec_buff[0] )) ? "n" : "", spec_buff,
+ (is_vowel( specs[0] )) ? "n" : "", specs.c_str(),
you.class_name );
enter_player_name(false);
@@ -3099,8 +3099,8 @@ spec_query:
char buf[100];
char sletter = species_to_letter(i);
snprintf(buf, sizeof buf, "%c - %-26s",
- sletter,
- species_name(i, 1));
+ sletter,
+ species_name(i, 1).c_str());
if (sletter == Options.prev_race)
prevraceok = true;
strncat(linebuf, buf, sizeof linebuf);
@@ -3266,7 +3266,8 @@ job_query:
textcolor( YELLOW );
if (you.your_name[0])
cprintf("%s the ", you.your_name);
- cprintf("%s.", species_name(you.species,you.experience_level));
+ cprintf("%s.",
+ species_name(you.species,you.experience_level).c_str());
}
else
{