summaryrefslogtreecommitdiff
path: root/src/notifymanager.cpp
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2025-06-05 21:20:17 +0000
committerFedja Beader <fedja@protonmail.ch>2025-06-05 21:20:17 +0000
commita12c3f03564bfa6217fc32cd0031c952b1499ea3 (patch)
treea22de4636cde0d3fefe0b8b0cf854ef3dfc644b6 /src/notifymanager.cpp
parentc9925d7b4371f347dbcb95c4b5411d61d4f36c0a (diff)
downloadmanaplus-a12c3f03564bfa6217fc32cd0031c952b1499ea3.tar.gz
manaplus-a12c3f03564bfa6217fc32cd0031c952b1499ea3.tar.bz2
manaplus-a12c3f03564bfa6217fc32cd0031c952b1499ea3.tar.xz
manaplus-a12c3f03564bfa6217fc32cd0031c952b1499ea3.zip
Delay localChatTab nullptr checks in notify() to where they're required & dedupe
(consequence: if localChatTab is nullptr, then the message will go to debug.) **** mana/plus!187
Diffstat (limited to 'src/notifymanager.cpp')
-rw-r--r--src/notifymanager.cpp37
1 files changed, 9 insertions, 28 deletions
diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp
index aed5dd9f8..af7720911 100644
--- a/src/notifymanager.cpp
+++ b/src/notifymanager.cpp
@@ -83,11 +83,9 @@ namespace NotifyManager
void notify(const unsigned int message)
{
- if (message >= NotifyTypes::TYPE_END ||
- localChatTab == nullptr)
- {
+ if (message >= NotifyTypes::TYPE_END)
return;
- }
+
const NotificationInfo &info = notifications[message];
if (*info.text == 0)
{
@@ -98,10 +96,7 @@ namespace NotifyManager
switch (info.flags)
{
case NotifyFlags::EMPTY:
- localChatTab->chatLog(gettext(info.text),
- ChatMsgType::BY_SERVER,
- IgnoreRecord_false,
- TryRemoveColors_true);
+ chatLog(localChatTab, gettext(info.text));
break;
case NotifyFlags::GUILD:
@@ -139,31 +134,22 @@ namespace NotifyManager
void notify(const unsigned int message, const int num)
{
- if (message >= NotifyTypes::TYPE_END ||
- localChatTab == nullptr)
- {
+ if (message >= NotifyTypes::TYPE_END)
return;
- }
+
const NotificationInfo &info = notifications[message];
if (info.flags == NotifyFlags::INT &&
*info.text != 0)
{
- localChatTab->chatLog(
- strprintf(gettext(info.text), num),
- ChatMsgType::BY_SERVER,
- IgnoreRecord_false,
- TryRemoveColors_true);
+ chatLog(localChatTab, strprintf(gettext(info.text), num));
}
soundManager.playSfx(SoundDB::getSound(message), 0, 0);
}
void notify(const unsigned int message, const std::string &str)
{
- if (message >= NotifyTypes::TYPE_END ||
- localChatTab == nullptr)
- {
+ if (message >= NotifyTypes::TYPE_END)
return;
- }
soundManager.playSfx(SoundDB::getSound(message), 0, 0);
@@ -182,14 +168,9 @@ namespace NotifyManager
switch (info.flags)
{
case NotifyFlags::STRING:
- {
- localChatTab->chatLog(
- strprintf(gettext(info.text), str.c_str()),
- ChatMsgType::BY_SERVER,
- IgnoreRecord_false,
- TryRemoveColors_true);
+ chatLog(localChatTab,
+ strprintf(gettext(info.text), str.c_str()));
break;
- }
case NotifyFlags::GUILD_STRING:
{
ChatTab *const tab = getGuildTab();