1 #include "wizard/wizard-messages.h"
2 #include "game-option/cheat-options.h"
3 #include "game-option/cheat-types.h"
4 #include "io/write-diary.h"
5 #include "system/angband-exceptions.h"
6 #include "view/display-messages.h"
11 void msg_print_wizard(PlayerType *player_ptr, int cheat_type, std::string_view msg)
13 constexpr auto max_type = 4;
14 if ((cheat_type < 0) || (cheat_type >= max_type)) {
15 THROW_EXCEPTION(std::logic_error, "Invalid cheat type is specified!");
18 if (!cheat_room && cheat_type == CHEAT_DUNGEON) {
22 if (!cheat_peek && cheat_type == CHEAT_OBJECT) {
26 if (!cheat_hear && cheat_type == CHEAT_MONSTER) {
30 if (!cheat_xtra && cheat_type == CHEAT_MISC) {
34 static const std::array<std::string, max_type> cheat_mes = { { "ITEM:", "MONS:", "DUNG:", "MISC:" } };
36 ss << "WIZ-" << cheat_mes[cheat_type] << msg;
37 const auto mes = ss.str();
39 if (cheat_diary_output) {
40 exe_write_diary(player_ptr, DiaryKind::WIZARD_LOG, 0, mes);
45 * Display a formatted message, using "vstrnfmt()" and "msg_print()".
47 void msg_format_wizard(PlayerType *player_ptr, int cheat_type, const char *fmt, ...)
49 if (!cheat_room && cheat_type == CHEAT_DUNGEON) {
52 if (!cheat_peek && cheat_type == CHEAT_OBJECT) {
55 if (!cheat_hear && cheat_type == CHEAT_MONSTER) {
58 if (!cheat_xtra && cheat_type == CHEAT_MISC) {
65 (void)vstrnfmt(buf, 1024, fmt, vp);
67 msg_print_wizard(player_ptr, cheat_type, buf);