summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/Makefile.am5
-rw-r--r--src/being/being.cpp1
-rw-r--r--src/eventsmanager.cpp2
-rw-r--r--src/gui/widgets/guitable.cpp2
-rw-r--r--src/gui/widgets/guitable.h3
-rw-r--r--src/guildmanager.cpp5
-rw-r--r--src/listeners/tablemodellistener.h6
-rw-r--r--src/net/download.cpp8
-rw-r--r--src/net/ea/buysellhandler.cpp9
-rw-r--r--src/net/ea/chathandler.cpp19
-rw-r--r--src/net/ea/gamehandler.cpp7
-rw-r--r--src/net/ea/guildhandler.cpp32
-rw-r--r--src/net/ea/inventoryhandler.cpp7
-rw-r--r--src/net/ea/partyhandler.cpp37
-rw-r--r--src/net/ea/playerhandler.cpp13
-rw-r--r--src/net/ea/skillhandler.cpp6
-rw-r--r--src/net/ea/tradehandler.cpp27
-rw-r--r--src/net/eathena/adminhandler.cpp7
-rw-r--r--src/net/eathena/buysellhandler.cpp11
-rw-r--r--src/net/eathena/partyhandler.cpp5
-rw-r--r--src/net/tmwa/adminhandler.cpp7
-rw-r--r--src/net/tmwa/buysellhandler.cpp11
-rw-r--r--src/net/tmwa/partyhandler.cpp5
-rw-r--r--src/net/uploadcharinfo.h6
-rw-r--r--src/notifymanager.cpp46
-rw-r--r--src/resources/db/sounddb.cpp10
-rw-r--r--src/resources/map/map.cpp12
-rw-r--r--src/resources/notificationinfo.h47
-rw-r--r--src/resources/notifications.h (renamed from src/notifications.h)323
-rw-r--r--src/resources/notifyflags.h40
-rw-r--r--src/resources/notifytypes.h104
-rw-r--r--src/resources/openglimagehelper.cpp2
-rw-r--r--src/utils/gettexthelper.cpp9
34 files changed, 513 insertions, 326 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 82bce78e8..ab5114529 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -583,6 +583,10 @@ SET(SRCS
resources/mapreader.h
resources/modinfo.cpp
resources/modinfo.h
+ resources/notificationinfo.h
+ resources/notifications.h
+ resources/notifyflags.h
+ resources/notifytypes.h
resources/db/monsterdb.cpp
resources/db/monsterdb.h
resources/db/npcdb.cpp
@@ -852,7 +856,6 @@ SET(SRCS
navigationmanager.h
render/normalopenglgraphics.cpp
render/normalopenglgraphics.h
- notifications.h
notifymanager.cpp
notifymanager.h
options.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 20ebedd9e..6ed8775ec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -705,6 +705,10 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
resources/mapreader.h \
resources/modinfo.cpp \
resources/modinfo.h \
+ resources/notificationinfo.h \
+ resources/notifications.h \
+ resources/notifyflags.h \
+ resources/notifytypes.h \
resources/db/monsterdb.cpp \
resources/db/monsterdb.h \
resources/db/npcdb.cpp \
@@ -968,7 +972,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
navigationmanager.h \
render/normalopenglgraphics.cpp \
render/normalopenglgraphics.h \
- notifications.h \
notifymanager.cpp \
notifymanager.h \
options.h \
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 5aa95bbd6..95d0f9481 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -35,7 +35,6 @@
#include "text.h"
#include "being/attributes.h"
-#include "being/beingaction.h"
#include "being/beingcacheentry.h"
#include "being/beingflag.h"
#include "being/beingspeech.h"
diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp
index a87b1fd1d..e7b2eb977 100644
--- a/src/eventsmanager.cpp
+++ b/src/eventsmanager.cpp
@@ -24,7 +24,9 @@
#include "client.h"
#include "game.h"
#include "logger.h"
+#ifdef USE_MUMBLE
#include "mumblemanager.h"
+#endif
#include "sdlshared.h"
#include "settings.h"
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 7f4a18858..0cb320c91 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -26,7 +26,7 @@
#include "gui/gui.h"
-#include "events/keyevent.h"
+#include "gui/models/tablemodel.h"
#include "input/inputaction.h"
diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h
index bea678706..4f4e2cfa3 100644
--- a/src/gui/widgets/guitable.h
+++ b/src/gui/widgets/guitable.h
@@ -25,8 +25,6 @@
#include "localconsts.h"
-#include "gui/models/tablemodel.h"
-
#include "listeners/keylistener.h"
#include "listeners/mouselistener.h"
#include "listeners/tablemodellistener.h"
@@ -36,6 +34,7 @@
#include <vector>
class GuiTableActionListener;
+class TableModel;
/**
* A table, with rows and columns made out of sub-widgets. Largely inspired by
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index 809343daa..211735158 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -24,7 +24,6 @@
#include "client.h"
#include "configuration.h"
#include "guild.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/localplayer.h"
@@ -41,6 +40,8 @@
#include "utils/delete2.h"
#include "utils/timer.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
GuildManager *guildManager = nullptr;
@@ -521,7 +522,7 @@ bool GuildManager::afterRemove()
player_node->setGuildName("");
player_node->clearGuilds();
}
- NotifyManager::notify(NotifyManager::GUILD_LEFT);
+ NotifyManager::notify(NotifyTypes::GUILD_LEFT);
delete2(mTab);
if (socialWindow)
diff --git a/src/listeners/tablemodellistener.h b/src/listeners/tablemodellistener.h
index c908261a0..630563517 100644
--- a/src/listeners/tablemodellistener.h
+++ b/src/listeners/tablemodellistener.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef GUI_LISTENERS_TABLEMODELLISTENER_H
-#define GUI_LISTENERS_TABLEMODELLISTENER_H
+#ifndef LISTENERS_TABLEMODELLISTENER_H
+#define LISTENERS_TABLEMODELLISTENER_H
#include <set>
#include <vector>
@@ -49,4 +49,4 @@ class TableModelListener notfinal
{ }
};
-#endif // GUI_LISTENERS_TABLEMODELLISTENER_H
+#endif // LISTENERS_TABLEMODELLISTENER_H
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 03e258b38..069290cde 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -569,12 +569,16 @@ void Download::secureCurl(CURL *const curl)
#endif
}
+#if CURLVERSION_ATLEAST(7, 21, 7)
void Download::addHeaders(CURL *const curl)
{
-#if CURLVERSION_ATLEAST(7, 21, 7)
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
-#endif
}
+#else
+void Download::addHeaders(CURL *const curl A_UNUSED)
+{
+}
+#endif
void Download::prepareForm(curl_httppost **form, const std::string &fileName)
{
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp
index 47074d99c..f8871748f 100644
--- a/src/net/ea/buysellhandler.cpp
+++ b/src/net/ea/buysellhandler.cpp
@@ -24,7 +24,6 @@
#include "configuration.h"
#include "inventory.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/attributes.h"
@@ -42,6 +41,8 @@
#include "utils/timer.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
namespace Ea
@@ -162,7 +163,7 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg,
}
else
{
- NotifyManager::notify(NotifyManager::SELL_LIST_EMPTY);
+ NotifyManager::notify(NotifyTypes::SELL_LIST_EMPTY);
}
}
@@ -170,7 +171,7 @@ void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) const
{
if (msg.readInt8() == 0)
{
- NotifyManager::notify(NotifyManager::BUY_DONE);
+ NotifyManager::notify(NotifyTypes::BUY_DONE);
}
else
{
@@ -178,7 +179,7 @@ void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) const
// would go fine
if (mBuyDialog)
mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
- NotifyManager::notify(NotifyManager::BUY_FAILED);
+ NotifyManager::notify(NotifyTypes::BUY_FAILED);
}
}
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 40dc15a15..5c972db6b 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -25,7 +25,6 @@
#include "actormanager.h"
#include "configuration.h"
#include "guildmanager.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/localplayer.h"
@@ -36,10 +35,12 @@
#include "gui/widgets/tabs/gmtab.h"
-#include "gui/widgets/tabs/chattab.h"
-
#include "net/messagein.h"
+#include "resources/notifytypes.h"
+
+#include "utils/gettext.h"
+
#include <string>
#include "debug.h"
@@ -423,9 +424,9 @@ void ChatHandler::processMVP(Net::MessageIn &msg) const
{
const Being *const being = actorManager->findBeing(id);
if (!being)
- NotifyManager::notify(NotifyManager::MVP_PLAYER, "");
+ NotifyManager::notify(NotifyTypes::MVP_PLAYER, "");
else
- NotifyManager::notify(NotifyManager::MVP_PLAYER, being->getName());
+ NotifyManager::notify(NotifyTypes::MVP_PLAYER, being->getName());
}
BLOCK_END("ChatHandler::processMVP")
}
@@ -448,10 +449,10 @@ void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) const
switch (fail)
{
case 0:
- NotifyManager::notify(NotifyManager::WHISPERS_IGNORED);
+ NotifyManager::notify(NotifyTypes::WHISPERS_IGNORED);
break;
default:
- NotifyManager::notify(NotifyManager::
+ NotifyManager::notify(NotifyTypes::
WHISPERS_IGNORE_FAILED);
break;
}
@@ -462,10 +463,10 @@ void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) const
switch (fail)
{
case 0:
- NotifyManager::notify(NotifyManager::WHISPERS_UNIGNORED);
+ NotifyManager::notify(NotifyTypes::WHISPERS_UNIGNORED);
break;
default:
- NotifyManager::notify(NotifyManager::
+ NotifyManager::notify(NotifyTypes::
WHISPERS_UNIGNORE_FAILED);
break;
}
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp
index 3d7da6247..afebc93a1 100644
--- a/src/net/ea/gamehandler.cpp
+++ b/src/net/ea/gamehandler.cpp
@@ -24,7 +24,6 @@
#include "client.h"
#include "game.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/localplayer.h"
@@ -33,6 +32,10 @@
#include "net/messagein.h"
+#include "resources/notifytypes.h"
+
+#include "utils/gettext.h"
+
#include "debug.h"
namespace Ea
@@ -73,7 +76,7 @@ void GameHandler::processMapLogin(Net::MessageIn &msg) const
void GameHandler::processWhoAnswer(Net::MessageIn &msg) const
{
- NotifyManager::notify(NotifyManager::ONLINE_USERS, msg.readInt32());
+ NotifyManager::notify(NotifyTypes::ONLINE_USERS, msg.readInt32());
}
void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) const
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 15fa3165e..68d6a774b 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -23,7 +23,6 @@
#include "actormanager.h"
#include "configuration.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/localplayer.h"
@@ -36,6 +35,9 @@
#include "net/ea/gui/guildtab.h"
#include "utils/delete2.h"
+#include "utils/gettext.h"
+
+#include "resources/notifytypes.h"
#include "debug.h"
@@ -78,27 +80,27 @@ void GuildHandler::processGuildCreateResponse(Net::MessageIn &msg) const
{
case 0:
// Success
- NotifyManager::notify(NotifyManager::GUILD_CREATED);
+ NotifyManager::notify(NotifyTypes::GUILD_CREATED);
break;
case 1:
// Already in a guild
- NotifyManager::notify(NotifyManager::GUILD_ALREADY);
+ NotifyManager::notify(NotifyTypes::GUILD_ALREADY);
break;
case 2:
// Unable to make (likely name already in use)
- NotifyManager::notify(NotifyManager::GUILD_ALREADY);
+ NotifyManager::notify(NotifyTypes::GUILD_ALREADY);
break;
case 3:
// Emperium check failed
- NotifyManager::notify(NotifyManager::GUILD_EMPERIUM_CHECK_FAILED);
+ NotifyManager::notify(NotifyTypes::GUILD_EMPERIUM_CHECK_FAILED);
break;
default:
// Unknown response
- NotifyManager::notify(NotifyManager::GUILD_ERROR);
+ NotifyManager::notify(NotifyTypes::GUILD_ERROR);
break;
}
}
@@ -426,23 +428,23 @@ void GuildHandler::processGuildInviteAck(Net::MessageIn &msg) const
switch (flag)
{
case 0:
- NotifyManager::notify(NotifyManager::GUILD_INVITE_FAILED);
+ NotifyManager::notify(NotifyTypes::GUILD_INVITE_FAILED);
break;
case 1:
- NotifyManager::notify(NotifyManager::GUILD_INVITE_REJECTED);
+ NotifyManager::notify(NotifyTypes::GUILD_INVITE_REJECTED);
break;
case 2:
- NotifyManager::notify(NotifyManager::GUILD_INVITE_JOINED);
+ NotifyManager::notify(NotifyTypes::GUILD_INVITE_JOINED);
break;
case 3:
- NotifyManager::notify(NotifyManager::GUILD_INVITE_FULL);
+ NotifyManager::notify(NotifyTypes::GUILD_INVITE_FULL);
break;
default:
- NotifyManager::notify(NotifyManager::GUILD_INVITE_ERROR);
+ NotifyManager::notify(NotifyTypes::GUILD_INVITE_ERROR);
break;
}
}
@@ -465,7 +467,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg) const
taGuild->removeFromMembers();
taGuild->clearMembers();
}
- NotifyManager::notify(NotifyManager::GUILD_LEFT);
+ NotifyManager::notify(NotifyTypes::GUILD_LEFT);
delete2(guildTab)
if (socialWindow && taGuild)
@@ -475,7 +477,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg) const
}
else
{
- NotifyManager::notify(NotifyManager::GUILD_USER_LEFT, nick);
+ NotifyManager::notify(NotifyTypes::GUILD_USER_LEFT, nick);
if (actorManager)
{
Being *const b = actorManager->findBeingByName(
@@ -508,7 +510,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) const
taGuild->removeFromMembers();
taGuild->clearMembers();
}
- NotifyManager::notify(NotifyManager::GUILD_KICKED);
+ NotifyManager::notify(NotifyTypes::GUILD_KICKED);
delete2(guildTab)
if (socialWindow && taGuild)
@@ -518,7 +520,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) const
}
else
{
- NotifyManager::notify(NotifyManager::GUILD_USER_KICKED, nick);
+ NotifyManager::notify(NotifyTypes::GUILD_USER_KICKED, nick);
if (actorManager)
{
Being *const b = actorManager->findBeingByName(
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 21ad9139a..a508460d4 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -22,7 +22,6 @@
#include "net/ea/inventoryhandler.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/attributes.h"
@@ -37,6 +36,8 @@
#include "listeners/arrowslistener.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
extern int serverVersion;
@@ -394,7 +395,7 @@ void InventoryHandler::processItemUseResponse(Net::MessageIn &msg)
if (msg.readInt8() == 0)
{
- NotifyManager::notify(NotifyManager::USE_FAILED);
+ NotifyManager::notify(NotifyTypes::USE_FAILED);
}
else
{
@@ -555,7 +556,7 @@ void InventoryHandler::processPlayerEquip(Net::MessageIn &msg)
const int flag = msg.readInt8();
if (!flag)
- NotifyManager::notify(NotifyManager::EQUIP_FAILED);
+ NotifyManager::notify(NotifyTypes::EQUIP_FAILED);
else
mEquips.setEquipment(getSlot(equipType), index);
}
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index be672f760..8ba78cd91 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -23,7 +23,6 @@
#include "actormanager.h"
#include "configuration.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "party.h"
@@ -38,6 +37,8 @@
#include "utils/delete2.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
namespace Ea
@@ -75,9 +76,9 @@ void PartyHandler::clear() const
void PartyHandler::processPartyCreate(Net::MessageIn &msg) const
{
if (msg.readInt8())
- NotifyManager::notify(NotifyManager::PARTY_CREATE_FAILED);
+ NotifyManager::notify(NotifyTypes::PARTY_CREATE_FAILED);
else
- NotifyManager::notify(NotifyManager::PARTY_CREATED);
+ NotifyManager::notify(NotifyTypes::PARTY_CREATED);
}
void PartyHandler::processPartyInfo(Net::MessageIn &msg) const
@@ -139,7 +140,7 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg) const
{
if (names.find(nick) == names.end())
{
- NotifyManager::notify(NotifyManager::PARTY_USER_JOINED,
+ NotifyManager::notify(NotifyTypes::PARTY_USER_JOINED,
nick);
joined = true;
}
@@ -193,21 +194,21 @@ void PartyHandler::processPartyInviteResponse(Net::MessageIn &msg) const
switch (msg.readInt8())
{
case 0:
- NotifyManager::notify(NotifyManager::PARTY_INVITE_ALREADY_MEMBER,
+ NotifyManager::notify(NotifyTypes::PARTY_INVITE_ALREADY_MEMBER,
nick);
break;
case 1:
- NotifyManager::notify(NotifyManager::PARTY_INVITE_REFUSED, nick);
+ NotifyManager::notify(NotifyTypes::PARTY_INVITE_REFUSED, nick);
break;
case 2:
- NotifyManager::notify(NotifyManager::PARTY_INVITE_DONE, nick);
+ NotifyManager::notify(NotifyTypes::PARTY_INVITE_DONE, nick);
break;
case 3:
- NotifyManager::notify(NotifyManager::PARTY_INVITE_PARTY_FULL,
+ NotifyManager::notify(NotifyTypes::PARTY_INVITE_PARTY_FULL,
nick);
break;
default:
- NotifyManager::notify(NotifyManager::PARTY_INVITE_ERROR, nick);
+ NotifyManager::notify(NotifyTypes::PARTY_INVITE_ERROR, nick);
break;
}
}
@@ -257,19 +258,19 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
if (mShareExp == Net::PartyShare::YES)
break;
mShareExp = Net::PartyShare::YES;
- NotifyManager::notify(NotifyManager::PARTY_EXP_SHARE_ON);
+ NotifyManager::notify(NotifyTypes::PARTY_EXP_SHARE_ON);
break;
case Net::PartyShare::NO:
if (mShareExp == Net::PartyShare::NO)
break;
mShareExp = Net::PartyShare::NO;
- NotifyManager::notify(NotifyManager::PARTY_EXP_SHARE_OFF);
+ NotifyManager::notify(NotifyTypes::PARTY_EXP_SHARE_OFF);
break;
case Net::PartyShare::NOT_POSSIBLE:
if (mShareExp == Net::PartyShare::NOT_POSSIBLE)
break;
mShareExp = Net::PartyShare::NOT_POSSIBLE;
- NotifyManager::notify(NotifyManager::PARTY_EXP_SHARE_ERROR);
+ NotifyManager::notify(NotifyTypes::PARTY_EXP_SHARE_ERROR);
break;
default:
logger->log("QQQ Unknown party exp option: %d\n", exp);
@@ -282,19 +283,19 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
if (mShareItems == Net::PartyShare::YES)
break;
mShareItems = Net::PartyShare::YES;
- NotifyManager::notify(NotifyManager::PARTY_ITEM_SHARE_ON);
+ NotifyManager::notify(NotifyTypes::PARTY_ITEM_SHARE_ON);
break;
case Net::PartyShare::NO:
if (mShareItems == Net::PartyShare::NO)
break;
mShareItems = Net::PartyShare::NO;
- NotifyManager::notify(NotifyManager::PARTY_ITEM_SHARE_OFF);
+ NotifyManager::notify(NotifyTypes::PARTY_ITEM_SHARE_OFF);
break;
case Net::PartyShare::NOT_POSSIBLE:
if (mShareItems == Net::PartyShare::NOT_POSSIBLE)
break;
mShareItems = Net::PartyShare::NOT_POSSIBLE;
- NotifyManager::notify(NotifyManager::PARTY_ITEM_SHARE_ERROR);
+ NotifyManager::notify(NotifyTypes::PARTY_ITEM_SHARE_ERROR);
break;
default:
logger->log("QQQ Unknown party item option: %d\n", exp);
@@ -348,7 +349,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg) const
Ea::taParty->removeFromMembers();
Ea::taParty->clearMembers();
}
- NotifyManager::notify(NotifyManager::PARTY_LEFT);
+ NotifyManager::notify(NotifyTypes::PARTY_LEFT);
delete2(Ea::partyTab)
if (socialWindow && Ea::taParty)
@@ -357,7 +358,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg) const
}
else
{
- NotifyManager::notify(NotifyManager::PARTY_USER_LEFT, nick);
+ NotifyManager::notify(NotifyTypes::PARTY_USER_LEFT, nick);
if (actorManager)
{
Being *const b = actorManager->findBeing(id);
@@ -431,7 +432,7 @@ void PartyHandler::processPartyMessage(Net::MessageIn &msg) const
}
else
{
- NotifyManager::notify(NotifyManager::PARTY_UNKNOWN_USER_MSG,
+ NotifyManager::notify(NotifyTypes::PARTY_UNKNOWN_USER_MSG,
chatMsg);
}
}
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 0ed9f9a18..9e2a0dfb3 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -25,7 +25,6 @@
#include "configuration.h"
#include "game.h"
#include "party.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "units.h"
@@ -38,6 +37,8 @@
#include "gui/windows/skilldialog.h"
#include "gui/windows/statuswindow.h"
+#include "resources/notifytypes.h"
+
#include "resources/db/deaddb.h"
#include "resources/map/map.h"
@@ -50,6 +51,8 @@
#include "net/ea/eaprotocol.h"
+#include "utils/gettext.h"
+
#include "debug.h"
extern int weightNoticeTime;
@@ -395,12 +398,12 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg)
const int newMoney = msg.readInt32();
if (newMoney > oldMoney)
{
- NotifyManager::notify(NotifyManager::MONEY_GET,
+ NotifyManager::notify(NotifyTypes::MONEY_GET,
Units::formatCurrency(newMoney - oldMoney));
}
else if (newMoney < oldMoney)
{
- NotifyManager::notify(NotifyManager::MONEY_SPENT,
+ NotifyManager::notify(NotifyTypes::MONEY_SPENT,
Units::formatCurrency(oldMoney - newMoney).c_str());
}
@@ -448,7 +451,7 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg)
const int points = PlayerInfo::getAttribute(Attributes::CHAR_POINTS)
+ oldValue - value;
PlayerInfo::setAttribute(Attributes::CHAR_POINTS, points);
- NotifyManager::notify(NotifyManager::SKILL_RAISE_ERROR);
+ NotifyManager::notify(NotifyTypes::SKILL_RAISE_ERROR);
}
PlayerInfo::setStatBase(type, value);
@@ -571,7 +574,7 @@ void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg)
switch (type)
{
case 0:
- NotifyManager::notify(NotifyManager::ARROWS_EQUIP_NEEDED);
+ NotifyManager::notify(NotifyTypes::ARROWS_EQUIP_NEEDED);
break;
case 3:
// arrows equiped
diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp
index fd10a6087..002309de4 100644
--- a/src/net/ea/skillhandler.cpp
+++ b/src/net/ea/skillhandler.cpp
@@ -23,7 +23,6 @@
#include "net/ea/skillhandler.h"
#include "logger.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/localplayer.h"
@@ -31,10 +30,13 @@
#include "gui/windows/skilldialog.h"
+#include "utils/gettext.h"
#include "utils/stringutils.h"
#include "net/messagein.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
/** job dependend identifiers (?) */
@@ -254,6 +256,6 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg)
}
}
- NotifyManager::notify(NotifyManager::SKILL_FAIL_MESSAGE, txt);
+ NotifyManager::notify(NotifyTypes::SKILL_FAIL_MESSAGE, txt);
}
} // namespace Ea
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index 64e41646a..b328086fc 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -25,7 +25,6 @@
#include "inventory.h"
#include "item.h"
#include "logger.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/playerinfo.h"
@@ -38,6 +37,10 @@
#include "net/ea/eaprotocol.h"
+#include "utils/gettext.h"
+
+#include "resources/notifytypes.h"
+
#include "listeners/requesttradelistener.h"
#include "debug.h"
@@ -128,15 +131,15 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg) const
switch (msg.readInt8())
{
case 0: // Too far away
- NotifyManager::notify(NotifyManager::TRADE_FAIL_FAR_AWAY,
+ NotifyManager::notify(NotifyTypes::TRADE_FAIL_FAR_AWAY,
tradePartnerName);
break;
case 1: // Character doesn't exist
- NotifyManager::notify(NotifyManager::TRADE_FAIL_CHAR_NOT_EXISTS,
+ NotifyManager::notify(NotifyTypes::TRADE_FAIL_CHAR_NOT_EXISTS,
tradePartnerName);
break;
case 2: // Invite request check failed...
- NotifyManager::notify(NotifyManager::TRADE_CANCELLED_ERROR);
+ NotifyManager::notify(NotifyTypes::TRADE_CANCELLED_ERROR);
break;
case 3: // Trade accepted
if (tradeWindow)
@@ -153,7 +156,7 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg) const
if (player_relations.hasPermission(tradePartnerName,
PlayerRelation::SPEECH_LOG))
{
- NotifyManager::notify(NotifyManager::TRADE_CANCELLED_NAME,
+ NotifyManager::notify(NotifyTypes::TRADE_CANCELLED_NAME,
tradePartnerName);
}
// otherwise ignore silently
@@ -166,7 +169,7 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg) const
PlayerInfo::setTrading(false);
break;
default: // Shouldn't happen as well, but to be sure
- NotifyManager::notify(NotifyManager::TRADE_ERROR_UNKNOWN,
+ NotifyManager::notify(NotifyTypes::TRADE_ERROR_UNKNOWN,
tradePartnerName);
if (tradeWindow)
tradeWindow->clear();
@@ -228,19 +231,19 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
break;
case 1:
// Add item failed - player overweighted
- NotifyManager::notify(NotifyManager::
+ NotifyManager::notify(NotifyTypes::
TRADE_ADD_PARTNER_OVER_WEIGHT);
break;
case 2:
// Add item failed - player has no free slot
- NotifyManager::notify(NotifyManager::TRADE_ADD_PARTNER_NO_SLOTS);
+ NotifyManager::notify(NotifyTypes::TRADE_ADD_PARTNER_NO_SLOTS);
break;
case 3:
// Add item failed - non tradable item
- NotifyManager::notify(NotifyManager::TRADE_ADD_UNTRADABLE_ITEM);
+ NotifyManager::notify(NotifyTypes::TRADE_ADD_UNTRADABLE_ITEM);
break;
default:
- NotifyManager::notify(NotifyManager::TRADE_ADD_ERROR);
+ NotifyManager::notify(NotifyTypes::TRADE_ADD_ERROR);
logger->log("QQQ SMSG_TRADE_ITEM_ADD_RESPONSE: "
+ toString(res));
break;
@@ -258,7 +261,7 @@ void TradeHandler::processTradeOk(Net::MessageIn &msg)
void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED)
{
- NotifyManager::notify(NotifyManager::TRADE_CANCELLED);
+ NotifyManager::notify(NotifyTypes::TRADE_CANCELLED);
if (tradeWindow)
{
tradeWindow->setVisible(false);
@@ -269,7 +272,7 @@ void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED)
void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED)
{
- NotifyManager::notify(NotifyManager::TRADE_COMPLETE);
+ NotifyManager::notify(NotifyTypes::TRADE_COMPLETE);
if (tradeWindow)
{
tradeWindow->setVisible(false);
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp
index 6a68446f3..86b57a2b2 100644
--- a/src/net/eathena/adminhandler.cpp
+++ b/src/net/eathena/adminhandler.cpp
@@ -22,12 +22,13 @@
#include "net/eathena/adminhandler.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
+#include "resources/notifytypes.h"
+
#include <string>
#include "debug.h"
@@ -56,9 +57,9 @@ void AdminHandler::handleMessage(Net::MessageIn &msg)
{
case SMSG_ADMIN_KICK_ACK:
if (msg.readInt32() == 0)
- NotifyManager::notify(NotifyManager::KICK_FAIL);
+ NotifyManager::notify(NotifyTypes::KICK_FAIL);
else
- NotifyManager::notify(NotifyManager::KICK_SUCCEED);
+ NotifyManager::notify(NotifyTypes::KICK_SUCCEED);
break;
default:
break;
diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp
index 65e955d91..30fb8beae 100644
--- a/src/net/eathena/buysellhandler.cpp
+++ b/src/net/eathena/buysellhandler.cpp
@@ -22,7 +22,6 @@
#include "net/eathena/buysellhandler.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/attributes.h"
@@ -34,6 +33,8 @@
#include "net/eathena/protocol.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
extern Net::BuySellHandler *buySellHandler;
@@ -113,17 +114,17 @@ void BuySellHandler::processNpcSellResponse(Net::MessageIn &msg)
switch (msg.readInt8())
{
case 0:
- NotifyManager::notify(NotifyManager::SOLD);
+ NotifyManager::notify(NotifyTypes::SOLD);
break;
case 1:
default:
- NotifyManager::notify(NotifyManager::SELL_FAILED);
+ NotifyManager::notify(NotifyTypes::SELL_FAILED);
break;
case 2:
- NotifyManager::notify(NotifyManager::SELL_TRADE_FAILED);
+ NotifyManager::notify(NotifyTypes::SELL_TRADE_FAILED);
break;
case 3:
- NotifyManager::notify(NotifyManager::SELL_UNSELLABLE_FAILED);
+ NotifyManager::notify(NotifyTypes::SELL_UNSELLABLE_FAILED);
break;
}
}
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index bfbe5c8f7..08074fa23 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -22,7 +22,6 @@
#include "net/eathena/partyhandler.h"
#include "actormanager.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "party.h"
@@ -31,6 +30,8 @@
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
extern Net::PartyHandler *partyHandler;
@@ -167,7 +168,7 @@ void PartyHandler::kick(const std::string &name) const
const PartyMember *const m = Ea::taParty->getMember(name);
if (!m)
{
- NotifyManager::notify(NotifyManager::PARTY_USER_NOT_IN_PARTY, name);
+ NotifyManager::notify(NotifyTypes::PARTY_USER_NOT_IN_PARTY, name);
return;
}
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index c7b437944..c1cc349d4 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -22,12 +22,13 @@
#include "net/tmwa/adminhandler.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "net/tmwa/messageout.h"
#include "net/tmwa/protocol.h"
+#include "resources/notifytypes.h"
+
#include <string>
#include "debug.h"
@@ -56,9 +57,9 @@ void AdminHandler::handleMessage(Net::MessageIn &msg)
{
case SMSG_ADMIN_KICK_ACK:
if (msg.readInt32() == 0)
- NotifyManager::notify(NotifyManager::KICK_FAIL);
+ NotifyManager::notify(NotifyTypes::KICK_FAIL);
else
- NotifyManager::notify(NotifyManager::KICK_SUCCEED);
+ NotifyManager::notify(NotifyTypes::KICK_SUCCEED);
break;
default:
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index 5cc23a786..c44b2ebbf 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -22,7 +22,6 @@
#include "net/tmwa/buysellhandler.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "being/attributes.h"
@@ -34,6 +33,8 @@
#include "net/tmwa/protocol.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
extern Net::BuySellHandler *buySellHandler;
@@ -120,17 +121,17 @@ void BuySellHandler::processNpcSellResponse(Net::MessageIn &msg)
switch (msg.readInt8())
{
case 0:
- NotifyManager::notify(NotifyManager::SOLD);
+ NotifyManager::notify(NotifyTypes::SOLD);
break;
case 1:
default:
- NotifyManager::notify(NotifyManager::SELL_FAILED);
+ NotifyManager::notify(NotifyTypes::SELL_FAILED);
break;
case 2:
- NotifyManager::notify(NotifyManager::SELL_TRADE_FAILED);
+ NotifyManager::notify(NotifyTypes::SELL_TRADE_FAILED);
break;
case 3:
- NotifyManager::notify(NotifyManager::SELL_UNSELLABLE_FAILED);
+ NotifyManager::notify(NotifyTypes::SELL_UNSELLABLE_FAILED);
break;
}
}
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index ca11ccdf0..b0ab2dcef 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -22,7 +22,6 @@
#include "net/tmwa/partyhandler.h"
#include "actormanager.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "party.h"
@@ -31,6 +30,8 @@
#include "net/tmwa/messageout.h"
#include "net/tmwa/protocol.h"
+#include "resources/notifytypes.h"
+
#include "debug.h"
extern Net::PartyHandler *partyHandler;
@@ -169,7 +170,7 @@ void PartyHandler::kick(const std::string &name) const
const PartyMember *const m = Ea::taParty->getMember(name);
if (!m)
{
- NotifyManager::notify(NotifyManager::PARTY_USER_NOT_IN_PARTY, name);
+ NotifyManager::notify(NotifyTypes::PARTY_USER_NOT_IN_PARTY, name);
return;
}
diff --git a/src/net/uploadcharinfo.h b/src/net/uploadcharinfo.h
index 83eb854f9..14946c385 100644
--- a/src/net/uploadcharinfo.h
+++ b/src/net/uploadcharinfo.h
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NET_UPLOADCHRINFO_H
-#define NET_UPLOADCHRINFO_H
+#ifndef NET_UPLOADCHARINFO_H
+#define NET_UPLOADCHARINFO_H
#include <string>
@@ -49,4 +49,4 @@ struct UploadChatInfo final
std::string addStr;
};
-#endif // NET_UPLOADCHRINFO_H
+#endif // NET_UPLOADCHARINFO_H
diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp
index 6d6a2b3a7..eb58c5ce8 100644
--- a/src/notifymanager.cpp
+++ b/src/notifymanager.cpp
@@ -21,7 +21,6 @@
#include "notifymanager.h"
#include "guildmanager.h"
-#include "notifications.h"
#include "soundmanager.h"
#include "being/localplayer.h"
@@ -32,6 +31,9 @@
#include "net/net.h"
#include "net/partyhandler.h"
+#include "resources/notifications.h"
+#include "resources/notifytypes.h"
+
#include "resources/db/sounddb.h"
#include "debug.h"
@@ -61,17 +63,17 @@ namespace NotifyManager
void notify(const unsigned int message)
{
- if (message >= TYPE_END || !localChatTab)
+ if (message >= NotifyTypes::TYPE_END || !localChatTab)
return;
const NotificationInfo &info = notifications[message];
switch (info.flags)
{
- case EMPTY:
+ case NotifyFlags::EMPTY:
localChatTab->chatLog(gettext(info.text),
ChatMsgType::BY_SERVER);
break;
- case GUILD:
+ case NotifyFlags::GUILD:
{
if (!player_node)
return;
@@ -80,24 +82,24 @@ namespace NotifyManager
break;
}
- case PARTY:
+ case NotifyFlags::PARTY:
{
ChatTab *const tab = Net::getPartyHandler()->getTab();
chatLog(tab, gettext(info.text));
break;
}
- case SPEECH:
+ case NotifyFlags::SPEECH:
{
if (player_node)
player_node->setSpeech(gettext(info.text));
break;
}
- case INT:
- case STRING:
- case GUILD_STRING:
- case PARTY_STRING:
+ case NotifyFlags::INT:
+ case NotifyFlags::STRING:
+ case NotifyFlags::GUILD_STRING:
+ case NotifyFlags::PARTY_STRING:
default:
break;
}
@@ -106,10 +108,10 @@ namespace NotifyManager
void notify(const unsigned int message, const int num)
{
- if (message >= TYPE_END || !localChatTab)
+ if (message >= NotifyTypes::TYPE_END || !localChatTab)
return;
const NotificationInfo &info = notifications[message];
- if (info.flags == INT)
+ if (info.flags == NotifyFlags::INT)
{
localChatTab->chatLog(strprintf(gettext(info.text),
num), ChatMsgType::BY_SERVER);
@@ -119,34 +121,34 @@ namespace NotifyManager
void notify(const unsigned int message, const std::string &str)
{
- if (message >= TYPE_END || !localChatTab)
+ if (message >= NotifyTypes::TYPE_END || !localChatTab)
return;
const NotificationInfo &info = notifications[message];
switch (info.flags)
{
- case STRING:
+ case NotifyFlags::STRING:
{
localChatTab->chatLog(strprintf(gettext(info.text),
str.c_str()), ChatMsgType::BY_SERVER);
break;
}
- case GUILD_STRING:
+ case NotifyFlags::GUILD_STRING:
{
ChatTab *const tab = getGuildTab();
chatLog(tab, strprintf(gettext(info.text), str.c_str()));
break;
}
- case PARTY_STRING:
+ case NotifyFlags::PARTY_STRING:
{
ChatTab *const tab = Net::getPartyHandler()->getTab();
chatLog(tab, strprintf(gettext(info.text), str.c_str()));
break;
}
- case EMPTY:
- case INT:
- case GUILD:
- case PARTY:
- case SPEECH:
+ case NotifyFlags::EMPTY:
+ case NotifyFlags::INT:
+ case NotifyFlags::GUILD:
+ case NotifyFlags::PARTY:
+ case NotifyFlags::SPEECH:
default:
break;
}
@@ -155,7 +157,7 @@ namespace NotifyManager
int getIndexBySound(const std::string &sound)
{
- for (int f = 0; f < TYPE_END; f ++)
+ for (int f = 0; f < NotifyTypes::TYPE_END; f ++)
{
if (notifications[f].sound == sound)
return f;
diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp
index 17ff4bc71..7c9cd4c20 100644
--- a/src/resources/db/sounddb.cpp
+++ b/src/resources/db/sounddb.cpp
@@ -21,12 +21,10 @@
#include "resources/db/sounddb.h"
#include "configuration.h"
-#include "notifications.h"
#include "notifymanager.h"
-#include "utils/xml.h"
-
#include "resources/beingcommon.h"
+#include "resources/notifytypes.h"
#include "debug.h"
@@ -81,14 +79,14 @@ void SoundDB::loadXmlFile(const std::string &fileName)
void SoundDB::unload()
{
- mSounds.resize(NotifyManager::TYPE_END);
- for (int f = 0; f < NotifyManager::TYPE_END; f ++)
+ mSounds.resize(NotifyTypes::TYPE_END);
+ for (int f = 0; f < NotifyTypes::TYPE_END; f ++)
mSounds[f] = "";
}
std::string &SoundDB::getSound(const int id)
{
- if (id < 0 || id >= NotifyManager::TYPE_END)
+ if (id < 0 || id >= NotifyTypes::TYPE_END)
return mDefault;
return mSounds[id];
}
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index c36065087..7ba798319 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -24,7 +24,6 @@
#include "configuration.h"
#include "render/graphics.h"
-#include "notifications.h"
#include "notifymanager.h"
#include "settings.h"
@@ -44,6 +43,7 @@
#include "resources/ambientlayer.h"
#include "resources/image.h"
#include "resources/mapitemtype.h"
+#include "resources/notifytypes.h"
#include "resources/resourcemanager.h"
#include "resources/subimage.h"
@@ -1198,19 +1198,19 @@ void Map::setPvpMode(const int mode)
switch (mPvp)
{
case 0:
- NotifyManager::notify(NotifyManager::PVP_OFF_GVG_OFF);
+ NotifyManager::notify(NotifyTypes::PVP_OFF_GVG_OFF);
break;
case 1:
- NotifyManager::notify(NotifyManager::PVP_ON);
+ NotifyManager::notify(NotifyTypes::PVP_ON);
break;
case 2:
- NotifyManager::notify(NotifyManager::GVG_ON);
+ NotifyManager::notify(NotifyTypes::GVG_ON);
break;
case 3:
- NotifyManager::notify(NotifyManager::PVP_ON_GVG_ON);
+ NotifyManager::notify(NotifyTypes::PVP_ON_GVG_ON);
break;
default:
- NotifyManager::notify(NotifyManager::PVP_UNKNOWN);
+ NotifyManager::notify(NotifyTypes::PVP_UNKNOWN);
break;
}
}
diff --git a/src/resources/notificationinfo.h b/src/resources/notificationinfo.h
new file mode 100644
index 000000000..ade64cf6c
--- /dev/null
+++ b/src/resources/notificationinfo.h
@@ -0,0 +1,47 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2013-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RESOURCES_NOTIFICATIONINFO_H
+#define RESOURCES_NOTIFICATIONINFO_H
+
+#include "localconsts.h"
+
+#include "resources/notifyflags.h"
+
+struct NotificationInfo final
+{
+#ifdef ADVGCC
+ NotificationInfo(const char *const sound0,
+ const char *const text0,
+ const NotifyFlags::Type flags0) :
+ sound(sound0),
+ text(text0),
+ flags(flags0)
+ { }
+
+ A_DELETE_COPY(NotificationInfo)
+#endif
+
+ const char *sound;
+ const char *text;
+ const NotifyFlags::Type flags;
+};
+
+#endif // RESOURCES_NOTIFICATIONINFO_H
diff --git a/src/notifications.h b/src/resources/notifications.h
index 925e634de..11ce65359 100644
--- a/src/notifications.h
+++ b/src/resources/notifications.h
@@ -18,335 +18,298 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NOTIFICATIONS_H
-#define NOTIFICATIONS_H
+#ifndef RESOURCES_NOTIFICATIONS_H
+#define RESOURCES_NOTIFICATIONS_H
#include "localconsts.h"
+#include "resources/notificationinfo.h"
+#include "resources/notifyflags.h"
+
#include "utils/gettext.h"
namespace NotifyManager
{
- enum NotifyFlags
- {
- EMPTY = 0,
- INT,
- STRING,
- GUILD,
- GUILD_STRING,
- PARTY,
- PARTY_STRING,
- SPEECH
- };
-
- struct NotificationInfo final
- {
-#ifdef ADVGCC
- NotificationInfo(const char *const sound0,
- const char *const text0,
- const NotifyFlags flags0) :
- sound(sound0),
- text(text0),
- flags(flags0)
- { }
-
- A_DELETE_COPY(NotificationInfo)
-#endif
-
- const char *sound;
- const char *text;
- const NotifyFlags flags;
- };
-
- enum NotifyTypes
- {
- NONE = 0,
- BUY_DONE,
- BUY_FAILED,
- SELL_LIST_EMPTY,
- SOLD,
- SELL_FAILED,
- SELL_TRADE_FAILED,
- SELL_UNSELLABLE_FAILED,
- ONLINE_USERS,
- GUILD_CREATED,
- GUILD_ALREADY,
- GUILD_EMPERIUM_CHECK_FAILED,
- GUILD_ERROR,
- GUILD_LEFT,
- GUILD_INVITE_FAILED,
- GUILD_INVITE_REJECTED,
- GUILD_INVITE_JOINED,
- GUILD_INVITE_FULL,
- GUILD_INVITE_ERROR,
- GUILD_USER_LEFT,
- GUILD_KICKED,
- GUILD_USER_KICKED,
- USE_FAILED,
- EQUIP_FAILED,
- PARTY_CREATE_FAILED,
- PARTY_CREATED,
- PARTY_LEFT,
- PARTY_USER_JOINED,
- PARTY_INVITE_ALREADY_MEMBER,
- PARTY_INVITE_REFUSED,
- PARTY_INVITE_DONE,
- PARTY_INVITE_PARTY_FULL,
- PARTY_INVITE_ERROR,
- PARTY_EXP_SHARE_ON,
- PARTY_EXP_SHARE_OFF,
- PARTY_EXP_SHARE_ERROR,
- PARTY_ITEM_SHARE_ON,
- PARTY_ITEM_SHARE_OFF,
- PARTY_ITEM_SHARE_ERROR,
- PARTY_USER_LEFT,
- PARTY_UNKNOWN_USER_MSG,
- PARTY_USER_NOT_IN_PARTY,
- MONEY_GET,
- MONEY_SPENT,
- SKILL_RAISE_ERROR,
- ARROWS_EQUIP_NEEDED,
- TRADE_FAIL_FAR_AWAY,
- TRADE_FAIL_CHAR_NOT_EXISTS,
- TRADE_CANCELLED_ERROR,
- TRADE_CANCELLED_NAME,
- TRADE_ERROR_UNKNOWN,
- TRADE_ADD_PARTNER_OVER_WEIGHT,
- TRADE_ADD_PARTNER_NO_SLOTS,
- TRADE_ADD_UNTRADABLE_ITEM,
- TRADE_ADD_ERROR,
- TRADE_CANCELLED,
- TRADE_COMPLETE,
- KICK_FAIL,
- KICK_SUCCEED,
- MVP_PLAYER,
- WHISPERS_IGNORED,
- WHISPERS_IGNORE_FAILED,
- WHISPERS_UNIGNORED,
- WHISPERS_UNIGNORE_FAILED,
- SKILL_FAIL_MESSAGE,
- PVP_OFF_GVG_OFF,
- PVP_ON,
- GVG_ON,
- PVP_ON_GVG_ON,
- PVP_UNKNOWN,
-
- TYPE_END
- };
-
static const NotificationInfo notifications[] =
{
{"",
- "", EMPTY},
+ "", NotifyFlags::EMPTY},
{"buy done",
// TRANSLATORS: notification message
- N_("Thanks for buying."), EMPTY},
+ N_("Thanks for buying."),
+ NotifyFlags::EMPTY},
{"buy fail",
// TRANSLATORS: notification message
- N_("Unable to buy."), EMPTY},
+ N_("Unable to buy."),
+ NotifyFlags::EMPTY},
{"sell empty",
// TRANSLATORS: notification message
- N_("Nothing to sell."), EMPTY},
+ N_("Nothing to sell."),
+ NotifyFlags::EMPTY},
{"sell done",
// TRANSLATORS: notification message
- N_("Thanks for selling."), EMPTY},
+ N_("Thanks for selling."),
+ NotifyFlags::EMPTY},
{"sell fail",
// TRANSLATORS: notification message
- N_("Unable to sell."), EMPTY},
+ N_("Unable to sell."),
+ NotifyFlags::EMPTY},
{"sell trade fail",
// TRANSLATORS: notification message
- N_("Unable to sell while trading."), EMPTY},
+ N_("Unable to sell while trading."),
+ NotifyFlags::EMPTY},
{"sell unsellable fail",
// TRANSLATORS: notification message
- N_("Unable to sell unsellable item."), EMPTY},
+ N_("Unable to sell unsellable item."),
+ NotifyFlags::EMPTY},
{"online users",
// TRANSLATORS: notification message
- N_("Online users: %d"), INT},
+ N_("Online users: %d"),
+ NotifyFlags::INT},
{"guild created",
// TRANSLATORS: notification message
- N_("Guild created."), EMPTY},
+ N_("Guild created."),
+ NotifyFlags::EMPTY},
{"guild already",
// TRANSLATORS: notification message
- N_("You are already in guild."), EMPTY},
+ N_("You are already in guild."),
+ NotifyFlags::EMPTY},
{"guild create fail",
// TRANSLATORS: notification message
- N_("Emperium check failed."), EMPTY},
+ N_("Emperium check failed."),
+ NotifyFlags::EMPTY},
{"guild error",
// TRANSLATORS: notification message
- N_("Unknown server response."), EMPTY},
+ N_("Unknown server response."),
+ NotifyFlags::EMPTY},
{"guild left",
// TRANSLATORS: notification message
- N_("You have left the guild."), EMPTY},
+ N_("You have left the guild."),
+ NotifyFlags::EMPTY},
{"guild invite fail",
// TRANSLATORS: notification message
- N_("Could not invite user to guild."), GUILD},
+ N_("Could not invite user to guild."),
+ NotifyFlags::GUILD},
{"guild invite rejected",
// TRANSLATORS: notification message
- N_("User rejected guild invite."), GUILD},
+ N_("User rejected guild invite."),
+ NotifyFlags::GUILD},
{"guild invite joined",
// TRANSLATORS: notification message
- N_("User is now part of your guild."), GUILD},
+ N_("User is now part of your guild."),
+ NotifyFlags::GUILD},
{"guild invite full",
// TRANSLATORS: notification message
- N_("Your guild is full."), GUILD},
+ N_("Your guild is full."),
+ NotifyFlags::GUILD},
{"guild invite error",
// TRANSLATORS: notification message
- N_("Unknown guild invite response."), GUILD},
+ N_("Unknown guild invite response."),
+ NotifyFlags::GUILD},
{"guild user left",
// TRANSLATORS: notification message
- N_("%s has left your guild."), GUILD_STRING},
+ N_("%s has left your guild."),
+ NotifyFlags::GUILD_STRING},
{"guild kicked",
// TRANSLATORS: notification message
- N_("You were kicked from guild."), EMPTY},
+ N_("You were kicked from guild."),
+ NotifyFlags::EMPTY},
{"guild user kicked",
// TRANSLATORS: notification message
- N_("%s has kicked from your guild."), GUILD_STRING},
+ N_("%s has kicked from your guild."),
+ NotifyFlags::GUILD_STRING},
{"use failed",
// TRANSLATORS: notification message
- N_("Failed to use item."), EMPTY},
+ N_("Failed to use item."),
+ NotifyFlags::EMPTY},
{"equip failed",
// TRANSLATORS: notification message
- N_("Unable to equip."), EMPTY},
+ N_("Unable to equip."),
+ NotifyFlags::EMPTY},
{"party create failed",
// TRANSLATORS: notification message
- N_("Could not create party."), EMPTY},
+ N_("Could not create party."),
+ NotifyFlags::EMPTY},
{"party created",
// TRANSLATORS: notification message
- N_("Party successfully created."), EMPTY},
+ N_("Party successfully created."),
+ NotifyFlags::EMPTY},
{"party left",
// TRANSLATORS: notification message
- N_("You have left the party."), EMPTY},
+ N_("You have left the party."),
+ NotifyFlags::EMPTY},
{"party user joined",
// TRANSLATORS: notification message
- N_("%s has joined your party."), PARTY_STRING},
+ N_("%s has joined your party."),
+ NotifyFlags::PARTY_STRING},
{"party invite already member",
// TRANSLATORS: notification message
- N_("%s is already a member of a party."), PARTY_STRING},
+ N_("%s is already a member of a party."),
+ NotifyFlags::PARTY_STRING},
{"party invite refused",
// TRANSLATORS: notification message
- N_("%s refused your invitation."), PARTY_STRING},
+ N_("%s refused your invitation."),
+ NotifyFlags::PARTY_STRING},
{"party invite done",
// TRANSLATORS: notification message
- N_("%s is now a member of your party."), PARTY_STRING},
+ N_("%s is now a member of your party."),
+ NotifyFlags::PARTY_STRING},
{"party invite full",
// TRANSLATORS: notification message
N_("%s can't join your party because party is full."),
- PARTY_STRING},
+ NotifyFlags::PARTY_STRING},
{"party invite error",
// TRANSLATORS: notification message
- N_("QQQ Unknown invite response for %s."), PARTY_STRING},
+ N_("QQQ Unknown invite response for %s."),
+ NotifyFlags::PARTY_STRING},
{"party exp sharing on",
// TRANSLATORS: notification message
- N_("Experience sharing enabled."), PARTY},
+ N_("Experience sharing enabled."),
+ NotifyFlags::PARTY},
{"party exp sharing off",
// TRANSLATORS: notification message
- N_("Experience sharing disabled."), PARTY},
+ N_("Experience sharing disabled."),
+ NotifyFlags::PARTY},
{"party exp sharing error",
// TRANSLATORS: notification message
- N_("Experience sharing not possible."), PARTY},
+ N_("Experience sharing not possible."),
+ NotifyFlags::PARTY},
{"party item sharing on",
// TRANSLATORS: notification message
- N_("Item sharing enabled."), PARTY},
+ N_("Item sharing enabled."),
+ NotifyFlags::PARTY},
{"party item sharing off",
// TRANSLATORS: notification message
- N_("Item sharing disabled."), PARTY},
+ N_("Item sharing disabled."),
+ NotifyFlags::PARTY},
{"party item sharing error",
// TRANSLATORS: notification message
- N_("Item sharing not possible."), PARTY},
+ N_("Item sharing not possible."),
+ NotifyFlags::PARTY},
{"party user left",
// TRANSLATORS: notification message
- N_("%s has left your party."), PARTY_STRING},
+ N_("%s has left your party."),
+ NotifyFlags::PARTY_STRING},
{"party unknown user msg",
// TRANSLATORS: notification message
- N_("An unknown member tried to say: %s"), PARTY_STRING},
+ N_("An unknown member tried to say: %s"),
+ NotifyFlags::PARTY_STRING},
{"party user not in party",
// TRANSLATORS: notification message
- N_("%s is not in your party!"), PARTY_STRING},
+ N_("%s is not in your party!"),
+ NotifyFlags::PARTY_STRING},
{"money get",
// TRANSLATORS: notification message
- N_("You picked up %s."), STRING},
+ N_("You picked up %s."),
+ NotifyFlags::STRING},
{"money spend",
// TRANSLATORS: notification message
- N_("You spent %s."), STRING},
+ N_("You spent %s."),
+ NotifyFlags::STRING},
{"skill raise error",
// TRANSLATORS: notification message
- N_("Cannot raise skill!"), EMPTY},
+ N_("Cannot raise skill!"),
+ NotifyFlags::EMPTY},
{"arrow equip needed",
// TRANSLATORS: notification message
- N_("Equip ammunition first."), EMPTY},
+ N_("Equip ammunition first."),
+ NotifyFlags::EMPTY},
{"trade fail far away",
// TRANSLATORS: notification message
N_("Trading with %s isn't possible. Trade partner is "
- "too far away."), STRING},
+ "too far away."),
+ NotifyFlags::STRING},
{"trade fail chat not exists",
// TRANSLATORS: notification message
N_("Trading with %s isn't possible. Character doesn't exist."),
- STRING},
+ NotifyFlags::STRING},
{"trade cancelled error",
// TRANSLATORS: notification message
- N_("Trade cancelled due to an unknown reason."), EMPTY},
+ N_("Trade cancelled due to an unknown reason."),
+ NotifyFlags::EMPTY},
{"trade cancelled user",
// TRANSLATORS: notification message
- N_("Trade with %s cancelled."), STRING},
+ N_("Trade with %s cancelled."),
+ NotifyFlags::STRING},
{"trade error unknown",
// TRANSLATORS: notification message
- N_("Unhandled trade cancel packet with %s"), STRING},
+ N_("Unhandled trade cancel packet with %s"),
+ NotifyFlags::STRING},
{"trade add partner over weighted",
// TRANSLATORS: notification message
- N_("Failed adding item. Trade partner is over weighted."), EMPTY},
+ N_("Failed adding item. Trade partner is over weighted."),
+ NotifyFlags::EMPTY},
{"trade add partned has no free slots",
// TRANSLATORS: notification message
- N_("Failed adding item. Trade partner has no free slot."), EMPTY},
+ N_("Failed adding item. Trade partner has no free slot."),
+ NotifyFlags::EMPTY},
{"trade add untradable item",
// TRANSLATORS: notification message
- N_("Failed adding item. You can't trade this item."), EMPTY},
+ N_("Failed adding item. You can't trade this item."),
+ NotifyFlags::EMPTY},
{"trade add error",
// TRANSLATORS: notification message
- N_("Failed adding item for unknown reason."), EMPTY},
+ N_("Failed adding item for unknown reason."),
+ NotifyFlags::EMPTY},
{"trade cancelled",
// TRANSLATORS: notification message
- N_("Trade canceled."), EMPTY},
+ N_("Trade canceled."),
+ NotifyFlags::EMPTY},
{"trade complete",
// TRANSLATORS: notification message
- N_("Trade completed."), EMPTY},
+ N_("Trade completed."),
+ NotifyFlags::EMPTY},
{"kick fail",
// TRANSLATORS: notification message
- N_("Kick failed!"), EMPTY},
+ N_("Kick failed!"),
+ NotifyFlags::EMPTY},
{"kick succeed",
// TRANSLATORS: notification message
- N_("Kick succeeded!"), EMPTY},
+ N_("Kick succeeded!"),
+ NotifyFlags::EMPTY},
{"mvp player",
// TRANSLATORS: notification message
- N_("MVP player: %s"), STRING},
+ N_("MVP player: %s"),
+ NotifyFlags::STRING},
{"whispers ignored",
// TRANSLATORS: notification message
- N_("All whispers ignored."), EMPTY},
+ N_("All whispers ignored."),
+ NotifyFlags::EMPTY},
{"whispers ignore failed",
// TRANSLATORS: notification message
- N_("All whispers ignore failed."), EMPTY},
+ N_("All whispers ignore failed."),
+ NotifyFlags::EMPTY},
{"whispers unignored",
// TRANSLATORS: notification message
- N_("All whispers unignored."), EMPTY},
+ N_("All whispers unignored."),
+ NotifyFlags::EMPTY},
{"whispers unignore failed",
// TRANSLATORS: notification message
- N_("All whispers unignore failed."), EMPTY},
+ N_("All whispers unignore failed."),
+ NotifyFlags::EMPTY},
{"skill fail message",
- "%s", STRING},
+ "%s",
+ NotifyFlags::STRING},
{"pvp off gvg off",
// TRANSLATORS: notification message
- N_("pvp off, gvg off"), SPEECH},
+ N_("pvp off, gvg off"),
+ NotifyFlags::SPEECH},
{"pvp on",
// TRANSLATORS: notification message
- N_("pvp on"), SPEECH},
+ N_("pvp on"),
+ NotifyFlags::SPEECH},
{"gvg on",
// TRANSLATORS: notification message
- N_("gvg on"), SPEECH},
+ N_("gvg on"),
+ NotifyFlags::SPEECH},
{"pvp on gvg on",
// TRANSLATORS: notification message
- N_("pvp on, gvg on"), SPEECH},
+ N_("pvp on, gvg on"),
+ NotifyFlags::SPEECH},
{"unknown pvp",
// TRANSLATORS: notification message
- N_("unknown pvp"), SPEECH},
+ N_("unknown pvp"),
+ NotifyFlags::SPEECH},
};
} // namespace NotifyManager
-#endif // NOTIFICATIONS_H
+#endif // RESOURCES_NOTIFICATIONS_H
diff --git a/src/resources/notifyflags.h b/src/resources/notifyflags.h
new file mode 100644
index 000000000..6d08109dc
--- /dev/null
+++ b/src/resources/notifyflags.h
@@ -0,0 +1,40 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2013-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RESOURCES_NOTIFYFLAGS_H
+#define RESOURCES_NOTIFYFLAGS_H
+
+#include "localconsts.h"
+
+namespace NotifyFlags
+{
+ enum Type
+ {
+ EMPTY = 0,
+ INT,
+ STRING,
+ GUILD,
+ GUILD_STRING,
+ PARTY,
+ PARTY_STRING,
+ SPEECH
+ };
+} // namespace NotifyFlags
+#endif // RESOURCES_NOTIFYFLAGS_H
diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h
new file mode 100644
index 000000000..25f4b5680
--- /dev/null
+++ b/src/resources/notifytypes.h
@@ -0,0 +1,104 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2013-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RESOURCES_NOTIFYTYPES_H
+#define RESOURCES_NOTIFYTYPES_H
+
+#include "localconsts.h"
+
+namespace NotifyTypes
+{
+ enum Type
+ {
+ NONE = 0,
+ BUY_DONE,
+ BUY_FAILED,
+ SELL_LIST_EMPTY,
+ SOLD,
+ SELL_FAILED,
+ SELL_TRADE_FAILED,
+ SELL_UNSELLABLE_FAILED,
+ ONLINE_USERS,
+ GUILD_CREATED,
+ GUILD_ALREADY,
+ GUILD_EMPERIUM_CHECK_FAILED,
+ GUILD_ERROR,
+ GUILD_LEFT,
+ GUILD_INVITE_FAILED,
+ GUILD_INVITE_REJECTED,
+ GUILD_INVITE_JOINED,
+ GUILD_INVITE_FULL,
+ GUILD_INVITE_ERROR,
+ GUILD_USER_LEFT,
+ GUILD_KICKED,
+ GUILD_USER_KICKED,
+ USE_FAILED,
+ EQUIP_FAILED,
+ PARTY_CREATE_FAILED,
+ PARTY_CREATED,
+ PARTY_LEFT,
+ PARTY_USER_JOINED,
+ PARTY_INVITE_ALREADY_MEMBER,
+ PARTY_INVITE_REFUSED,
+ PARTY_INVITE_DONE,
+ PARTY_INVITE_PARTY_FULL,
+ PARTY_INVITE_ERROR,
+ PARTY_EXP_SHARE_ON,
+ PARTY_EXP_SHARE_OFF,
+ PARTY_EXP_SHARE_ERROR,
+ PARTY_ITEM_SHARE_ON,
+ PARTY_ITEM_SHARE_OFF,
+ PARTY_ITEM_SHARE_ERROR,
+ PARTY_USER_LEFT,
+ PARTY_UNKNOWN_USER_MSG,
+ PARTY_USER_NOT_IN_PARTY,
+ MONEY_GET,
+ MONEY_SPENT,
+ SKILL_RAISE_ERROR,
+ ARROWS_EQUIP_NEEDED,
+ TRADE_FAIL_FAR_AWAY,
+ TRADE_FAIL_CHAR_NOT_EXISTS,
+ TRADE_CANCELLED_ERROR,
+ TRADE_CANCELLED_NAME,
+ TRADE_ERROR_UNKNOWN,
+ TRADE_ADD_PARTNER_OVER_WEIGHT,
+ TRADE_ADD_PARTNER_NO_SLOTS,
+ TRADE_ADD_UNTRADABLE_ITEM,
+ TRADE_ADD_ERROR,
+ TRADE_CANCELLED,
+ TRADE_COMPLETE,
+ KICK_FAIL,
+ KICK_SUCCEED,
+ MVP_PLAYER,
+ WHISPERS_IGNORED,
+ WHISPERS_IGNORE_FAILED,
+ WHISPERS_UNIGNORED,
+ WHISPERS_UNIGNORE_FAILED,
+ SKILL_FAIL_MESSAGE,
+ PVP_OFF_GVG_OFF,
+ PVP_ON,
+ GVG_ON,
+ PVP_ON_GVG_ON,
+ PVP_UNKNOWN,
+
+ TYPE_END
+ };
+} // namespace NotifyTypes
+#endif // RESOURCES_NOTIFYTYPES_H
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index d06500a18..6d25aa952 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -50,7 +50,7 @@ bool OpenGLImageHelper::mUseTextureSampler = false;
OpenGLImageHelper::~OpenGLImageHelper()
{
- glDeleteTextures(texturesSize - mFreeTextureIndex,
+ glDeleteTextures(static_cast<GLsizei>(texturesSize - mFreeTextureIndex),
&mTextures[mFreeTextureIndex]);
}
diff --git a/src/utils/gettexthelper.cpp b/src/utils/gettexthelper.cpp
index 1e2fffef7..063142f06 100644
--- a/src/utils/gettexthelper.cpp
+++ b/src/utils/gettexthelper.cpp
@@ -20,21 +20,20 @@
#include "utils/gettexthelper.h"
+#ifdef ENABLE_NLS
#include "client.h"
#include "configuration.h"
-
-#ifdef ENABLE_NLS
#include "logger.h"
-#include <libintl.h>
-#endif
-
#include "utils/physfstools.h"
+#include <libintl.h>
+
#ifdef WIN32
#include <string>
extern "C" char const *_nl_locale_name_default(void);
#endif
+#endif
#include "debug.h"