diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-06 22:41:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-07 02:07:03 +0300 |
commit | a51da75e329df773a01e963c3a27e72cf487138c (patch) | |
tree | c48d7c682be1104138dd16daa75fd12a3fcae82b /src/resources | |
parent | 4f7e38d218848bd34bd86dda75446881dad2bb32 (diff) | |
download | ManaVerse-a51da75e329df773a01e963c3a27e72cf487138c.tar.gz ManaVerse-a51da75e329df773a01e963c3a27e72cf487138c.tar.bz2 ManaVerse-a51da75e329df773a01e963c3a27e72cf487138c.tar.xz ManaVerse-a51da75e329df773a01e963c3a27e72cf487138c.zip |
fix code style.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/db/sounddb.cpp | 10 | ||||
-rw-r--r-- | src/resources/map/map.cpp | 12 | ||||
-rw-r--r-- | src/resources/notificationinfo.h | 47 | ||||
-rw-r--r-- | src/resources/notifications.h | 315 | ||||
-rw-r--r-- | src/resources/notifyflags.h | 40 | ||||
-rw-r--r-- | src/resources/notifytypes.h | 104 | ||||
-rw-r--r-- | src/resources/openglimagehelper.cpp | 2 |
7 files changed, 517 insertions, 13 deletions
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/resources/notifications.h b/src/resources/notifications.h new file mode 100644 index 000000000..11ce65359 --- /dev/null +++ b/src/resources/notifications.h @@ -0,0 +1,315 @@ +/* + * 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_NOTIFICATIONS_H +#define RESOURCES_NOTIFICATIONS_H + +#include "localconsts.h" + +#include "resources/notificationinfo.h" +#include "resources/notifyflags.h" + +#include "utils/gettext.h" + +namespace NotifyManager +{ + static const NotificationInfo notifications[] = + { + {"", + "", NotifyFlags::EMPTY}, + {"buy done", + // TRANSLATORS: notification message + N_("Thanks for buying."), + NotifyFlags::EMPTY}, + {"buy fail", + // TRANSLATORS: notification message + N_("Unable to buy."), + NotifyFlags::EMPTY}, + {"sell empty", + // TRANSLATORS: notification message + N_("Nothing to sell."), + NotifyFlags::EMPTY}, + {"sell done", + // TRANSLATORS: notification message + N_("Thanks for selling."), + NotifyFlags::EMPTY}, + {"sell fail", + // TRANSLATORS: notification message + N_("Unable to sell."), + NotifyFlags::EMPTY}, + {"sell trade fail", + // TRANSLATORS: notification message + N_("Unable to sell while trading."), + NotifyFlags::EMPTY}, + {"sell unsellable fail", + // TRANSLATORS: notification message + N_("Unable to sell unsellable item."), + NotifyFlags::EMPTY}, + {"online users", + // TRANSLATORS: notification message + N_("Online users: %d"), + NotifyFlags::INT}, + {"guild created", + // TRANSLATORS: notification message + N_("Guild created."), + NotifyFlags::EMPTY}, + {"guild already", + // TRANSLATORS: notification message + N_("You are already in guild."), + NotifyFlags::EMPTY}, + {"guild create fail", + // TRANSLATORS: notification message + N_("Emperium check failed."), + NotifyFlags::EMPTY}, + {"guild error", + // TRANSLATORS: notification message + N_("Unknown server response."), + NotifyFlags::EMPTY}, + {"guild left", + // TRANSLATORS: notification message + N_("You have left the guild."), + NotifyFlags::EMPTY}, + {"guild invite fail", + // TRANSLATORS: notification message + N_("Could not invite user to guild."), + NotifyFlags::GUILD}, + {"guild invite rejected", + // TRANSLATORS: notification message + N_("User rejected guild invite."), + NotifyFlags::GUILD}, + {"guild invite joined", + // TRANSLATORS: notification message + N_("User is now part of your guild."), + NotifyFlags::GUILD}, + {"guild invite full", + // TRANSLATORS: notification message + N_("Your guild is full."), + NotifyFlags::GUILD}, + {"guild invite error", + // TRANSLATORS: notification message + N_("Unknown guild invite response."), + NotifyFlags::GUILD}, + {"guild user left", + // TRANSLATORS: notification message + N_("%s has left your guild."), + NotifyFlags::GUILD_STRING}, + {"guild kicked", + // TRANSLATORS: notification message + N_("You were kicked from guild."), + NotifyFlags::EMPTY}, + {"guild user kicked", + // TRANSLATORS: notification message + N_("%s has kicked from your guild."), + NotifyFlags::GUILD_STRING}, + {"use failed", + // TRANSLATORS: notification message + N_("Failed to use item."), + NotifyFlags::EMPTY}, + {"equip failed", + // TRANSLATORS: notification message + N_("Unable to equip."), + NotifyFlags::EMPTY}, + {"party create failed", + // TRANSLATORS: notification message + N_("Could not create party."), + NotifyFlags::EMPTY}, + {"party created", + // TRANSLATORS: notification message + N_("Party successfully created."), + NotifyFlags::EMPTY}, + {"party left", + // TRANSLATORS: notification message + N_("You have left the party."), + NotifyFlags::EMPTY}, + {"party user joined", + // TRANSLATORS: notification message + 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."), + NotifyFlags::PARTY_STRING}, + {"party invite refused", + // TRANSLATORS: notification message + N_("%s refused your invitation."), + NotifyFlags::PARTY_STRING}, + {"party invite done", + // TRANSLATORS: notification message + 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."), + NotifyFlags::PARTY_STRING}, + {"party invite error", + // TRANSLATORS: notification message + N_("QQQ Unknown invite response for %s."), + NotifyFlags::PARTY_STRING}, + {"party exp sharing on", + // TRANSLATORS: notification message + N_("Experience sharing enabled."), + NotifyFlags::PARTY}, + {"party exp sharing off", + // TRANSLATORS: notification message + N_("Experience sharing disabled."), + NotifyFlags::PARTY}, + {"party exp sharing error", + // TRANSLATORS: notification message + N_("Experience sharing not possible."), + NotifyFlags::PARTY}, + {"party item sharing on", + // TRANSLATORS: notification message + N_("Item sharing enabled."), + NotifyFlags::PARTY}, + {"party item sharing off", + // TRANSLATORS: notification message + N_("Item sharing disabled."), + NotifyFlags::PARTY}, + {"party item sharing error", + // TRANSLATORS: notification message + N_("Item sharing not possible."), + NotifyFlags::PARTY}, + {"party user left", + // TRANSLATORS: notification message + N_("%s has left your party."), + NotifyFlags::PARTY_STRING}, + {"party unknown user msg", + // TRANSLATORS: notification message + 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!"), + NotifyFlags::PARTY_STRING}, + {"money get", + // TRANSLATORS: notification message + N_("You picked up %s."), + NotifyFlags::STRING}, + {"money spend", + // TRANSLATORS: notification message + N_("You spent %s."), + NotifyFlags::STRING}, + {"skill raise error", + // TRANSLATORS: notification message + N_("Cannot raise skill!"), + NotifyFlags::EMPTY}, + {"arrow equip needed", + // TRANSLATORS: notification message + 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."), + NotifyFlags::STRING}, + {"trade fail chat not exists", + // TRANSLATORS: notification message + N_("Trading with %s isn't possible. Character doesn't exist."), + NotifyFlags::STRING}, + {"trade cancelled error", + // TRANSLATORS: notification message + N_("Trade cancelled due to an unknown reason."), + NotifyFlags::EMPTY}, + {"trade cancelled user", + // TRANSLATORS: notification message + N_("Trade with %s cancelled."), + NotifyFlags::STRING}, + {"trade error unknown", + // TRANSLATORS: notification message + 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."), + NotifyFlags::EMPTY}, + {"trade add partned has no free slots", + // TRANSLATORS: notification message + 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."), + NotifyFlags::EMPTY}, + {"trade add error", + // TRANSLATORS: notification message + N_("Failed adding item for unknown reason."), + NotifyFlags::EMPTY}, + {"trade cancelled", + // TRANSLATORS: notification message + N_("Trade canceled."), + NotifyFlags::EMPTY}, + {"trade complete", + // TRANSLATORS: notification message + N_("Trade completed."), + NotifyFlags::EMPTY}, + {"kick fail", + // TRANSLATORS: notification message + N_("Kick failed!"), + NotifyFlags::EMPTY}, + {"kick succeed", + // TRANSLATORS: notification message + N_("Kick succeeded!"), + NotifyFlags::EMPTY}, + {"mvp player", + // TRANSLATORS: notification message + N_("MVP player: %s"), + NotifyFlags::STRING}, + {"whispers ignored", + // TRANSLATORS: notification message + N_("All whispers ignored."), + NotifyFlags::EMPTY}, + {"whispers ignore failed", + // TRANSLATORS: notification message + N_("All whispers ignore failed."), + NotifyFlags::EMPTY}, + {"whispers unignored", + // TRANSLATORS: notification message + N_("All whispers unignored."), + NotifyFlags::EMPTY}, + {"whispers unignore failed", + // TRANSLATORS: notification message + N_("All whispers unignore failed."), + NotifyFlags::EMPTY}, + {"skill fail message", + "%s", + NotifyFlags::STRING}, + {"pvp off gvg off", + // TRANSLATORS: notification message + N_("pvp off, gvg off"), + NotifyFlags::SPEECH}, + {"pvp on", + // TRANSLATORS: notification message + N_("pvp on"), + NotifyFlags::SPEECH}, + {"gvg on", + // TRANSLATORS: notification message + N_("gvg on"), + NotifyFlags::SPEECH}, + {"pvp on gvg on", + // TRANSLATORS: notification message + N_("pvp on, gvg on"), + NotifyFlags::SPEECH}, + {"unknown pvp", + // TRANSLATORS: notification message + N_("unknown pvp"), + NotifyFlags::SPEECH}, + }; +} // namespace NotifyManager +#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]); } |