diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/being/playerrelation.cpp | 30 | ||||
-rw-r--r-- | src/being/playerrelation.h | 65 | ||||
-rw-r--r-- | src/being/playerrelations.cpp | 5 | ||||
-rw-r--r-- | src/being/playerrelations.h | 40 |
6 files changed, 101 insertions, 43 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 56cae8a3d..df09dc971 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -762,6 +762,8 @@ SET(SRCS party.h being/playerinfo.cpp being/playerinfo.h + being/playerrelation.cpp + being/playerrelation.h being/playerrelations.cpp being/playerrelations.h listeners/playerrelationslistener.h diff --git a/src/Makefile.am b/src/Makefile.am index 3e09cb464..ab0936910 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -849,6 +849,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ party.h \ being/playerinfo.cpp \ being/playerinfo.h \ + being/playerrelation.cpp \ + being/playerrelation.h \ being/playerrelations.cpp \ being/playerrelations.h \ listeners/playerrelationslistener.h \ diff --git a/src/being/playerrelation.cpp b/src/being/playerrelation.cpp new file mode 100644 index 000000000..2b12dd6bb --- /dev/null +++ b/src/being/playerrelation.cpp @@ -0,0 +1,30 @@ +/* + * The ManaPlus Client + * Copyright (C) 2008-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-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/>. + */ + +#include "being/playerrelation.h" + +#include "debug.h" + +PlayerRelation::PlayerRelation(const Relation relation) : + mRelation(relation) +{ +} diff --git a/src/being/playerrelation.h b/src/being/playerrelation.h new file mode 100644 index 000000000..5b4a941b0 --- /dev/null +++ b/src/being/playerrelation.h @@ -0,0 +1,65 @@ +/* + * The ManaPlus Client + * Copyright (C) 2008-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-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 BEING_PLAYERRELATION_H +#define BEING_PLAYERRELATION_H + +#include "localconsts.h" + +struct PlayerRelation final +{ + static const unsigned int EMOTE = (1U << 0); + static const unsigned int SPEECH_FLOAT = (1U << 1); + static const unsigned int SPEECH_LOG = (1U << 2); + static const unsigned int WHISPER = (1U << 3); + static const unsigned int TRADE = (1U << 4); + static const unsigned int INVISIBLE = (1U << 5); + static const unsigned int BLACKLIST = (1U << 6); + static const unsigned int ENEMY = (1U << 7); + + static const unsigned int RELATIONS_NR = 7; + static const unsigned int RELATION_PERMISSIONS[RELATIONS_NR]; + + static const unsigned int DEFAULT = EMOTE + | SPEECH_FLOAT + | SPEECH_LOG + | WHISPER + | TRADE; + enum Relation + { + NEUTRAL = 0, + FRIEND = 1, + DISREGARDED = 2, + IGNORED = 3, + ERASED = 4, + BLACKLISTED = 5, + ENEMY2 = 6 + }; + + explicit PlayerRelation(const Relation relation); + + A_DELETE_COPY(PlayerRelation) + + Relation mRelation; // bitmask for all of the above +}; + +#endif // BEING_PLAYERRELATION_H diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index 238f96642..90f19c236 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -128,11 +128,6 @@ const unsigned int PlayerRelation::RELATION_PERMISSIONS[RELATIONS_NR] = /* ENEMY2 */ EMOTE | SPEECH_FLOAT | SPEECH_LOG | WHISPER | TRADE }; -PlayerRelation::PlayerRelation(const Relation relation) : - mRelation(relation) -{ -} - PlayerRelationsManager::PlayerRelationsManager() : mPersistIgnores(false), mDefaultPermissions(PlayerRelation::DEFAULT), diff --git a/src/being/playerrelations.h b/src/being/playerrelations.h index c9a884d2e..f0b7b4279 100644 --- a/src/being/playerrelations.h +++ b/src/being/playerrelations.h @@ -25,6 +25,8 @@ #include "utils/stringvector.h" +#include "being/playerrelation.h" + #include <list> #include <map> @@ -33,44 +35,6 @@ class Being; class PlayerRelationsListener; -struct PlayerRelation final -{ - static const unsigned int EMOTE = (1U << 0); - static const unsigned int SPEECH_FLOAT = (1U << 1); - static const unsigned int SPEECH_LOG = (1U << 2); - static const unsigned int WHISPER = (1U << 3); - static const unsigned int TRADE = (1U << 4); - static const unsigned int INVISIBLE = (1U << 5); - static const unsigned int BLACKLIST = (1U << 6); - static const unsigned int ENEMY = (1U << 7); - - static const unsigned int RELATIONS_NR = 7; - static const unsigned int RELATION_PERMISSIONS[RELATIONS_NR]; - - static const unsigned int DEFAULT = EMOTE - | SPEECH_FLOAT - | SPEECH_LOG - | WHISPER - | TRADE; - enum Relation - { - NEUTRAL = 0, - FRIEND = 1, - DISREGARDED = 2, - IGNORED = 3, - ERASED = 4, - BLACKLISTED = 5, - ENEMY2 = 6 - }; - - explicit PlayerRelation(const Relation relation); - - A_DELETE_COPY(PlayerRelation) - - Relation mRelation; // bitmask for all of the above -}; - - /** * Ignore strategy: describes how we should handle ignores. */ |