diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-11-13 04:57:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-11-13 04:57:16 +0300 |
commit | 4d453108f45f9fb2ff4f5715cc1b3ddd63d36a80 (patch) | |
tree | c1edb8d8b368fdd43cd8639e6044b0f4e8dde70a /src/playerrelations.cpp | |
parent | ece00592ecd93f7a96db0ca82589d00846e2f938 (diff) | |
parent | d471e99fd38ac589a8a9e8e8677b9f577f0cc5c6 (diff) | |
download | manaverse-4d453108f45f9fb2ff4f5715cc1b3ddd63d36a80.tar.gz manaverse-4d453108f45f9fb2ff4f5715cc1b3ddd63d36a80.tar.bz2 manaverse-4d453108f45f9fb2ff4f5715cc1b3ddd63d36a80.tar.xz manaverse-4d453108f45f9fb2ff4f5715cc1b3ddd63d36a80.zip |
Merge branch 'master' into strippedstripped1.1.11.12
Conflicts:
data/fonts/mplus-1p-bold.ttf
data/fonts/mplus-1p-regular.ttf
src/guichan/basiccontainer.cpp
src/guichan/focushandler.cpp
src/guichan/graphics.cpp
src/guichan/gui.cpp
src/guichan/image.cpp
src/guichan/include/guichan/widgets/checkbox.hpp
src/guichan/include/guichan/widgets/dropdown.hpp
src/guichan/sdl/sdlgraphics.cpp
src/guichan/sdl/sdlimage.cpp
src/guichan/widget.cpp
src/guichan/widgets/dropdown.cpp
src/guichan/widgets/icon.cpp
src/guichan/widgets/imagebutton.cpp
src/guichan/widgets/listbox.cpp
src/guichan/widgets/scrollarea.cpp
src/guichan/widgets/tab.cpp
src/guichan/widgets/tabbedarea.cpp
src/guichan/widgets/textbox.cpp
src/guichan/widgets/window.cpp
Diffstat (limited to 'src/playerrelations.cpp')
-rw-r--r-- | src/playerrelations.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index d7532b884..324dac065 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -28,6 +28,7 @@ #include "being.h" #include "configuration.h" #include "graphics.h" +#include "localplayer.h" #include "utils/dtor.h" #include "utils/gettext.h" @@ -68,7 +69,7 @@ class PlayerConfSerialiser : ConfigurationObject *cobj) { if (!cobj || !value.second) - return NULL; + return nullptr; cobj->setValue(NAME, value.first); cobj->setValue(RELATION, toString( static_cast<int>(value.second->mRelation))); @@ -108,7 +109,8 @@ const unsigned int PlayerRelation::RELATION_PERMISSIONS[RELATIONS_NR] = { /* DISREGARDED*/ EMOTE | SPEECH_FLOAT, /* IGNORED */ 0, /* ERASED */ INVISIBLE, - /* BLACKLISTED */ SPEECH_LOG | WHISPER + /* BLACKLISTED */ SPEECH_LOG | WHISPER, + /* ENEMY2 */ EMOTE | SPEECH_FLOAT | SPEECH_LOG | WHISPER | TRADE }; PlayerRelation::PlayerRelation(Relation relation) @@ -119,7 +121,7 @@ PlayerRelation::PlayerRelation(Relation relation) PlayerRelationsManager::PlayerRelationsManager() : mPersistIgnores(false), mDefaultPermissions(PlayerRelation::DEFAULT), - mIgnoreStrategy(0) + mIgnoreStrategy(nullptr) { } @@ -144,7 +146,7 @@ void PlayerRelationsManager::clear() removePlayer(*it); } delete names; - names = 0; + names = nullptr; } #define PERSIST_IGNORE_LIST "persistent-player-list" @@ -326,6 +328,12 @@ bool PlayerRelationsManager::hasPermission(const std::string &name, void PlayerRelationsManager::setRelation(const std::string &player_name, PlayerRelation::Relation relation) { + if (!player_node || (relation != PlayerRelation::NEUTRAL + && player_node->getName() == player_name)) + { + return; + } + PlayerRelation *r = mRelations[player_name]; if (!r) mRelations[player_name] = new PlayerRelation(relation); @@ -408,6 +416,23 @@ void PlayerRelationsManager::ignoreTrade(std::string name) } } +bool PlayerRelationsManager::checkBadRelation(std::string name) +{ + if (name.empty()) + return true; + + PlayerRelation::Relation relation = getRelation(name); + + if (relation == PlayerRelation::IGNORED + || relation == PlayerRelation::DISREGARDED + || relation == PlayerRelation::BLACKLISTED + || relation == PlayerRelation::ERASED + || relation == PlayerRelation::ENEMY2) + { + return true; + } + return false; +} //////////////////////////////////////// // ignore strategies |