diff options
-rw-r--r-- | src/being.cpp | 4 | ||||
-rw-r--r-- | src/commandhandler.cpp | 7 | ||||
-rw-r--r-- | src/commandhandler.h | 5 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 1 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 43 | ||||
-rw-r--r-- | src/gui/setup_relations.cpp | 3 | ||||
-rw-r--r-- | src/playerrelations.cpp | 3 | ||||
-rw-r--r-- | src/playerrelations.h | 6 |
8 files changed, 67 insertions, 5 deletions
diff --git a/src/being.cpp b/src/being.cpp index 5eac242fd..5e8d68041 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -1631,7 +1631,9 @@ void Being::updateColors() mNameColor = &userPalette->getColor(UserPalette::DISREGARDED); } else if (player_relations.getRelation(mName) == - PlayerRelation::IGNORED) + PlayerRelation::IGNORED + || player_relations.getRelation(mName) == + PlayerRelation::ENEMY2) { mNameColor = &userPalette->getColor(UserPalette::IGNORED); } diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 914304f22..d04fda150 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -115,6 +115,8 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) handleNeutral(args, tab); else if (type == "blacklist") handleBlackList(args, tab); + else if (type == "enemy") + handleEnemy(args, tab); else if (type == "erase") handleErase(args, tab); else if (type == "join") @@ -587,6 +589,11 @@ void CommandHandler::handleBlackList(const std::string &args, ChatTab *tab) changeRelation(args, PlayerRelation::BLACKLISTED, _("blacklisted"), tab); } +void CommandHandler::handleEnemy(const std::string &args, ChatTab *tab) +{ + changeRelation(args, PlayerRelation::ENEMY2, _("enemy"), tab); +} + void CommandHandler::handleErase(const std::string &args, ChatTab *tab) { if (args.empty()) diff --git a/src/commandhandler.h b/src/commandhandler.h index c18a9d4c9..809e9e517 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -177,6 +177,11 @@ class CommandHandler void handleBlackList(const std::string &args, ChatTab *tab); /** + * Handle an enemy command. + */ + void handleEnemy(const std::string &args, ChatTab *tab); + + /** * Handle an erase command. */ void handleErase(const std::string &args, ChatTab *tab); diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 1fa91cfa6..cdcd02bc3 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -294,6 +294,7 @@ void ChatWindow::fillCommands() mCommands.push_back("/removeattack "); mCommands.push_back("/addignoreattack "); mCommands.push_back("/blacklist "); + mCommands.push_back("/enemy "); mCommands.push_back("/serverignoreall"); mCommands.push_back("/serverunignoreall"); mCommands.push_back("/dumpg"); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index d7c7e54df..a457573ce 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -145,6 +145,7 @@ void PopupMenu::showPopup(int x, int y, Being *being) mBrowserBox->addRow("disregard", _("Disregard")); mBrowserBox->addRow("ignore", _("Ignore")); mBrowserBox->addRow("blacklist", _("Black list")); + mBrowserBox->addRow("enemy", _("Set as enemy")); mBrowserBox->addRow("erase", _("Erase")); break; @@ -152,6 +153,7 @@ void PopupMenu::showPopup(int x, int y, Being *being) mBrowserBox->addRow("disregard", _("Disregard")); mBrowserBox->addRow("ignore", _("Ignore")); mBrowserBox->addRow("blacklist", _("Black list")); + mBrowserBox->addRow("enemy", _("Set as enemy")); mBrowserBox->addRow("erase", _("Erase")); break; @@ -159,6 +161,15 @@ void PopupMenu::showPopup(int x, int y, Being *being) mBrowserBox->addRow("unignore", _("Unignore")); mBrowserBox->addRow("disregard", _("Disregard")); mBrowserBox->addRow("ignore", _("Ignore")); + mBrowserBox->addRow("enemy", _("Set as enemy")); + mBrowserBox->addRow("erase", _("Erase")); + break; + + case PlayerRelation::ENEMY2: + mBrowserBox->addRow("unignore", _("Unignore")); + mBrowserBox->addRow("disregard", _("Disregard")); + mBrowserBox->addRow("ignore", _("Ignore")); + mBrowserBox->addRow("blacklist", _("Black list")); mBrowserBox->addRow("erase", _("Erase")); break; @@ -379,6 +390,7 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick) mBrowserBox->addRow("disregard", _("Disregard")); mBrowserBox->addRow("ignore", _("Ignore")); mBrowserBox->addRow("blacklist", _("Black list")); + mBrowserBox->addRow("enemy", _("Set as enemy")); mBrowserBox->addRow("erase", _("Erase")); break; @@ -386,6 +398,7 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick) mBrowserBox->addRow("disregard", _("Disregard")); mBrowserBox->addRow("ignore", _("Ignore")); mBrowserBox->addRow("blacklist", _("Black list")); + mBrowserBox->addRow("enemy", _("Set as enemy")); mBrowserBox->addRow("erase", _("Erase")); break; @@ -393,6 +406,7 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick) mBrowserBox->addRow("unignore", _("Unignore")); mBrowserBox->addRow("disregard", _("Disregard")); mBrowserBox->addRow("ignore", _("Ignore")); + mBrowserBox->addRow("enemy", _("Set as enemy")); mBrowserBox->addRow("erase", _("Erase")); break; @@ -407,6 +421,14 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick) mBrowserBox->addRow("erase", _("Erase")); break; + case PlayerRelation::ENEMY2: + mBrowserBox->addRow("unignore", _("Unignore")); + mBrowserBox->addRow("disregard", _("Disregard")); + mBrowserBox->addRow("ignore", _("Ignore")); + mBrowserBox->addRow("blacklist", _("Black list")); + mBrowserBox->addRow("erase", _("Erase")); + break; + case PlayerRelation::ERASED: mBrowserBox->addRow("unignore", _("Unignore")); mBrowserBox->addRow("disregard", _("Disregard")); @@ -625,6 +647,7 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab) mBrowserBox->addRow("disregard", _("Disregard")); mBrowserBox->addRow("ignore", _("Ignore")); mBrowserBox->addRow("blacklist", _("Black list")); + mBrowserBox->addRow("enemy", _("Set as enemy")); mBrowserBox->addRow("erase", _("Erase")); break; @@ -632,6 +655,7 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab) mBrowserBox->addRow("disregard", _("Disregard")); mBrowserBox->addRow("ignore", _("Ignore")); mBrowserBox->addRow("blacklist", _("Black list")); + mBrowserBox->addRow("enemy", _("Set as enemy")); mBrowserBox->addRow("erase", _("Erase")); break; @@ -639,6 +663,7 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab) mBrowserBox->addRow("unignore", _("Unignore")); mBrowserBox->addRow("disregard", _("Disregard")); mBrowserBox->addRow("ignore", _("Ignore")); + mBrowserBox->addRow("enemy", _("Set as enemy")); mBrowserBox->addRow("erase", _("Erase")); break; @@ -648,6 +673,14 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab) mBrowserBox->addRow("erase", _("Erase")); break; + case PlayerRelation::ENEMY2: + mBrowserBox->addRow("unignore", _("Unignore")); + mBrowserBox->addRow("disregard", _("Disregard")); + mBrowserBox->addRow("ignore", _("Ignore")); + mBrowserBox->addRow("blacklist", _("Black list")); + mBrowserBox->addRow("erase", _("Erase")); + break; + case PlayerRelation::IGNORED: mBrowserBox->addRow("unignore", _("Unignore")); mBrowserBox->addRow("erase", _("Erase")); @@ -895,6 +928,16 @@ void PopupMenu::handleLink(const std::string &link, { player_relations.setRelation(mNick, PlayerRelation::BLACKLISTED); } + else if (link == "enemy" && being && + being->getType() == ActorSprite::PLAYER) + { + player_relations.setRelation(being->getName(), + PlayerRelation::ENEMY2); + } + else if (link == "enemy" && !mNick.empty()) + { + player_relations.setRelation(mNick, PlayerRelation::ENEMY2); + } else if (link == "erase" && being && being->getType() == ActorSprite::PLAYER) { diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 6c57d981e..73fd34e27 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -72,7 +72,8 @@ static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] = N_("Disregarded"), N_("Ignored"), N_("Erased"), - N_("Blacklisted") + N_("Blacklisted"), + N_("Enemy") }; class PlayerRelationListModel : public gcn::ListModel diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index d7532b884..18587a91e 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -108,7 +108,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) diff --git a/src/playerrelations.h b/src/playerrelations.h index 41ca14b40..fbff5a01d 100644 --- a/src/playerrelations.h +++ b/src/playerrelations.h @@ -45,8 +45,9 @@ struct PlayerRelation static const unsigned int TRADE = (1 << 4); static const unsigned int INVISIBLE = (1 << 5); static const unsigned int BLACKLIST = (1 << 6); + static const unsigned int ENEMY = (1 << 7); - static const unsigned int RELATIONS_NR = 6; + static const unsigned int RELATIONS_NR = 7; static const unsigned int RELATION_PERMISSIONS[RELATIONS_NR]; static const unsigned int DEFAULT = EMOTE @@ -61,7 +62,8 @@ struct PlayerRelation DISREGARDED = 2, IGNORED = 3, ERASED = 4, - BLACKLISTED = 5 + BLACKLISTED = 5, + ENEMY2 = 6 }; PlayerRelation(Relation relation); |