diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-28 13:49:28 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-28 13:49:28 +0000 |
commit | 90629939ac4ba4ba84acf7b768c8673d4188c108 (patch) | |
tree | 1c7ff76f2716b6d9ca193dc29f2edc7fc7d388fc /crawl-ref/source/player.cc | |
parent | 5b1c13035877e9a9fcfad7b322244a309b49f212 (diff) | |
download | crawl-ref-90629939ac4ba4ba84acf7b768c8673d4188c108.tar.gz crawl-ref-90629939ac4ba4ba84acf7b768c8673d4188c108.zip |
Some code review and cleanup.
extern char info[] is almost gone.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1387 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r-- | crawl-ref/source/player.cc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 048f262a93..7a96a7921f 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -3709,6 +3709,7 @@ void modify_stat(unsigned char which_stat, char amount, bool suppress_msg) char *ptr_stat_max = NULL; char *ptr_redraw = NULL; + // sanity - is non-zero amount? if (amount == 0) return; @@ -3717,8 +3718,7 @@ void modify_stat(unsigned char which_stat, char amount, bool suppress_msg) if (amount < 0) interrupt_activity( AI_STAT_CHANGE ); - if (!suppress_msg) - strcpy(info, "You feel "); + std::string msg = "You feel "; if (which_stat == STAT_RANDOM) which_stat = random2(NUM_STATS); @@ -3729,29 +3729,26 @@ void modify_stat(unsigned char which_stat, char amount, bool suppress_msg) ptr_stat = &you.strength; ptr_stat_max = &you.max_strength; ptr_redraw = &you.redraw_strength; - if (!suppress_msg) - strcat(info, (amount > 0) ? "stronger." : "weaker."); + msg += ((amount > 0) ? "stronger." : "weaker."); break; case STAT_DEXTERITY: ptr_stat = &you.dex; ptr_stat_max = &you.max_dex; ptr_redraw = &you.redraw_dexterity; - if (!suppress_msg) - strcat(info, (amount > 0) ? "agile." : "clumsy."); + msg += ((amount > 0) ? "agile." : "clumsy."); break; case STAT_INTELLIGENCE: ptr_stat = &you.intel; ptr_stat_max = &you.max_intel; ptr_redraw = &you.redraw_intelligence; - if (!suppress_msg) - strcat(info, (amount > 0) ? "clever." : "stupid."); + msg += ((amount > 0) ? "clever." : "stupid."); break; } if (!suppress_msg) - mpr( info, (amount > 0) ? MSGCH_INTRINSIC_GAIN : MSGCH_WARN ); + mpr( msg.c_str(), (amount > 0) ? MSGCH_INTRINSIC_GAIN : MSGCH_WARN ); *ptr_stat += amount; *ptr_stat_max += amount; |