summaryrefslogtreecommitdiff
path: root/src/notifymanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/notifymanager.cpp')
-rw-r--r--src/notifymanager.cpp53
1 files changed, 22 insertions, 31 deletions
diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp
index c9c7adbb8..af7720911 100644
--- a/src/notifymanager.cpp
+++ b/src/notifymanager.cpp
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2013-2020 The ManaPlus Developers
- * Copyright (C) 2020-2023 The ManaVerse Developers
+ * Copyright (C) 2020-2025 The ManaVerse Developers
*
- * This file is part of The ManaPlus Client.
+ * This file is part of The ManaVerse Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +21,8 @@
#include "notifymanager.h"
+#include "configuration.h"
+
#include "soundmanager.h"
#include "being/localplayer.h"
@@ -81,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)
{
@@ -96,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:
@@ -137,48 +134,43 @@ 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);
+
+ if (message == NotifyTypes::MONEY_GET &&
+ !config.getBoolValue("showpickupchat"))
{
return;
}
+
const NotificationInfo &info = notifications[message];
if (*info.text == 0)
{
- soundManager.playSfx(SoundDB::getSound(message), 0, 0);
return;
}
+
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();
@@ -199,7 +191,6 @@ namespace NotifyManager
default:
break;
}
- soundManager.playSfx(SoundDB::getSound(message), 0, 0);
}
int getIndexBySound(const std::string &sound)