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_god.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_god.cc')
-rw-r--r-- | src/q_god.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/q_god.cc b/src/q_god.cc index de58bfe7..79213146 100644 --- a/src/q_god.cc +++ b/src/q_god.cc @@ -271,19 +271,20 @@ static std::string make_directions(bool feel_it) } } -bool_ quest_god_describe(FILE *fff) +std::string quest_god_describe() { + fmt::MemoryWriter w; + if (cquest.status == QUEST_STATUS_TAKEN) { auto directions = make_directions(false); - fprintf(fff, "#####yGod quest " FMTs32b "!\n", cquest_quests_given); - fprintf(fff, "Thou art to find the lost temple of thy God and\n"); - fprintf(fff, "to retrieve the lost part of the relic for thy God! \n"); - fprintf(fff, "%s\n", directions.c_str()); - fprintf(fff, "\n"); + w.write("#####yGod quest {}!\n", cquest_quests_given); + w.write("Thou art to find the lost temple of thy God and\n"); + w.write("to retrieve the lost part of the relic for thy God!\n"); + w.write("{}", directions.c_str()); } - return TRUE; + return w.str(); } static void quest_god_place_rand_dung() |