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 "view/display-messages.h"
10 void msg_print_wizard(PlayerType *player_ptr, int cheat_type, concptr msg)
12 constexpr auto max_type = 4;
13 if ((cheat_type < 0) || (cheat_type >= max_type)) {
14 throw std::logic_error("Invalid cheat type is specified!");
17 if (!cheat_room && cheat_type == CHEAT_DUNGEON) {
21 if (!cheat_peek && cheat_type == CHEAT_OBJECT) {
25 if (!cheat_hear && cheat_type == CHEAT_MONSTER) {
29 if (!cheat_xtra && cheat_type == CHEAT_MISC) {
33 static const std::array<std::string, max_type> cheat_mes = { { "ITEM:", "MONS:", "DUNG:", "MISC:" } };
35 ss << "WIZ-" << cheat_mes[cheat_type] << msg;
36 const auto mes = ss.str();
38 if (cheat_diary_output) {
39 exe_write_diary(player_ptr, DIARY_WIZARD_LOG, 0, mes);
44 * Display a formatted message, using "vstrnfmt()" and "msg_print()".
46 void msg_format_wizard(PlayerType *player_ptr, int cheat_type, concptr fmt, ...)
48 if (!cheat_room && cheat_type == CHEAT_DUNGEON) {
51 if (!cheat_peek && cheat_type == CHEAT_OBJECT) {
54 if (!cheat_hear && cheat_type == CHEAT_MONSTER) {
57 if (!cheat_xtra && cheat_type == CHEAT_MISC) {
64 (void)vstrnfmt(buf, 1024, fmt, vp);
66 msg_print_wizard(player_ptr, cheat_type, buf);