From 1ab177757bec9eb28482785f75fd8a4fb8a1313c Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Thu, 17 Dec 2009 12:48:02 +0100 Subject: Replace static snprintf() with make_sprintf() where the result is immediately cast to std::string. --- crawl-ref/source/mon-act.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/mon-act.cc') diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 4e866cec38..16c025e217 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -1324,22 +1324,19 @@ static bool _mons_throw(struct monsters *monster, struct bolt &pbolt, // [dshaligram] When changing bolt names here, you must edit // hiscores.cc (scorefile_entry::terse_missile_cause()) to match. - char throw_buff[ITEMNAME_SIZE]; if (projected == LRET_LAUNCHED) { - snprintf(throw_buff, sizeof(throw_buff), "Shot with a%s %s by %s", + pbolt.aux_source = make_stringf("Shot with a%s %s by %s", (is_vowel(pbolt.name[0]) ? "n" : ""), pbolt.name.c_str(), monster->name(DESC_NOCAP_A).c_str()); } else { - snprintf(throw_buff, sizeof(throw_buff), "Hit by a%s %s thrown by %s", + pbolt.aux_source = make_stringf("Hit by a%s %s thrown by %s", (is_vowel(pbolt.name[0]) ? "n" : ""), pbolt.name.c_str(), monster->name(DESC_NOCAP_A).c_str()); } - pbolt.aux_source = throw_buff; - // Add everything up. pbolt.hit = baseHit + random2avg(exHitBonus, 2) + ammoHitBonus; pbolt.damage = -- cgit v1.2.3-54-g00ecf