diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-02-13 13:56:52 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-02-13 13:56:52 +0100 |
commit | 4d237a87eb76eb4c6bcc5d8cbf7544a8f3184f30 (patch) | |
tree | 5e87923522f444880a6be4239e162c16312408a4 /src/q_bounty.cc | |
parent | f13c5091e4864e957c83a35621365c8b510b80ba (diff) |
Reduce file-open/close boilerplate and simplify formatting
- We introduce a show_string() which will allow us to go without
actually writing a file if we want to later.
- Use cppformat to simplify the output formatting.
Diffstat (limited to 'src/q_bounty.cc')
-rw-r--r-- | src/q_bounty.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/q_bounty.cc b/src/q_bounty.cc index bb84d48d..7af282bf 100644 --- a/src/q_bounty.cc +++ b/src/q_bounty.cc @@ -11,6 +11,8 @@ #include "util.hpp" #include "variable.hpp" +#include <format.h> + #define cquest (quest[QUEST_BOUNTY]) #define bounty_quest_monster (cquest.data[0]) @@ -151,20 +153,18 @@ bool_ quest_bounty_get_item() return FALSE; } -bool_ quest_bounty_describe(FILE *fff) +std::string quest_bounty_describe() { char mdesc[512]; + fmt::MemoryWriter w; if (cquest.status == QUEST_STATUS_TAKEN) { monster_race_desc(mdesc, bounty_quest_monster, 0); - fprintf(fff, "#####yBounty quest!\n"); - fprintf(fff, "You must bring back %s corpse to the beastmaster.\n", mdesc); - fprintf(fff, "\n"); - - return TRUE; + w.write("#####yBounty quest!\n"); + w.write("You must bring back {} corpse to the beastmaster.", mdesc); } - return FALSE; + return w.str(); } |