diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 77dd50fb8..e40407586 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1737,7 +1737,7 @@ bool PressEscKey() rv = true; } - if (msgflag != EMSG_NONE) { + if (IsDiabloMsgAvailable()) { msgdelay = 0; rv = true; } diff --git a/Source/error.cpp b/Source/error.cpp index d86648fe7..92e01bf8a 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -14,12 +14,12 @@ namespace devilution { uint32_t msgdelay; -diablo_message msgflag; namespace { diablo_message msgtable[MAX_SEND_STR_LEN]; uint8_t msgcnt; +diablo_message msgflag; } // namespace @@ -99,6 +99,11 @@ void InitDiabloMsg(diablo_message e) msgdelay = SDL_GetTicks(); } +bool IsDiabloMsgAvailable() +{ + return msgflag != EMSG_NONE; +} + void ClrDiabloMsg() { for (auto &msg : msgtable) diff --git a/Source/error.h b/Source/error.h index c0384fa75..3219146bd 100644 --- a/Source/error.h +++ b/Source/error.h @@ -70,9 +70,9 @@ enum diablo_message : uint8_t { }; extern uint32_t msgdelay; -extern diablo_message msgflag; void InitDiabloMsg(diablo_message e); +bool IsDiabloMsgAvailable(); void ClrDiabloMsg(); void DrawDiabloMsg(const Surface &out); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 4a41a0b2c..4656e32b5 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1230,7 +1230,7 @@ void DrawView(const Surface &out, int startX, int startY) if (HelpFlag) { DrawHelp(out); } - if (msgflag != EMSG_NONE) { + if (IsDiabloMsgAvailable()) { DrawDiabloMsg(out); } if (MyPlayerIsDead) {