diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-24 07:58:55 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-24 07:58:55 +0000 |
commit | 1fe13ae00d76681b04bd3c38227452f87c8b2a8c (patch) | |
tree | ebcba1daded81ca4b4024b27a0432f131bb159be /crawl-ref/source/direct.cc | |
parent | cf19d614afae806d0424ad0d7cf73b29cd49f007 (diff) | |
download | crawl-ref-1fe13ae00d76681b04bd3c38227452f87c8b2a8c.tar.gz crawl-ref-1fe13ae00d76681b04bd3c38227452f87c8b2a8c.zip |
Moving from snprintf() to std::ostringstream, slowly but surely.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1356 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/direct.cc')
-rw-r--r-- | crawl-ref/source/direct.cc | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index aeb942f947..ec356bbc3b 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -21,6 +21,7 @@ #include "format.h" #include <cstdarg> +#include <sstream> #include <stdlib.h> #include <string.h> #include <stdio.h> @@ -1484,25 +1485,21 @@ static void describe_cell(int mx, int my) if (menv[i].type != MONS_DANCING_WEAPON && mon_wep != NON_ITEM) { - snprintf( info, INFO_SIZE, "%s is wielding %s", - mons_pronoun( menv[i].type, PRONOUN_CAP ), - mitm[mon_wep].name(DESC_NOCAP_A).c_str()); + std::ostringstream msg; + msg << mons_pronoun( menv[i].type, PRONOUN_CAP ) + << " is wielding " + << mitm[mon_wep].name(DESC_NOCAP_A); // 2-headed ogres can wield 2 weapons if ((menv[i].type == MONS_TWO_HEADED_OGRE || menv[i].type == MONS_ETTIN) && menv[i].inv[MSLOT_MISSILE] != NON_ITEM) { - strcat(info, " and " ); - strcat(info, mitm[menv[i].inv[MSLOT_MISSILE]].name(DESC_NOCAP_A).c_str()); - strcat(info, "."); - mpr(info); - } - else - { - strcat(info, "."); - mpr(info); + msg << " and " + << mitm[menv[i].inv[MSLOT_MISSILE]].name(DESC_NOCAP_A); } + msg << "."; + mpr(msg.str().c_str()); } if (mon_arm != NON_ITEM) |