From 42f47e483da19079a937c4801ca94bd62d8dc970 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 21 Aug 2017 22:44:29 +0300 Subject: Remove useless else. --- src/net/tmwa/guildmanager.cpp | 57 ++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/guildmanager.cpp b/src/net/tmwa/guildmanager.cpp index 168f4cdea..5484f1b51 100644 --- a/src/net/tmwa/guildmanager.cpp +++ b/src/net/tmwa/guildmanager.cpp @@ -428,45 +428,42 @@ bool GuildManager::process(std::string msg) guild->removeMember(msg); return true; } - else if (msg == "You have been removed from the Guild" - || msg == "You have left the Guild") + else if (msg == "You have been removed from the Guild" || + msg == "You have left the Guild") { return afterRemove(); } - else + Guild *const guild = createGuild(); + if (guild == nullptr) + return false; + if (mTab == nullptr) { - Guild *const guild = createGuild(); - if (guild == nullptr) - return false; - if (mTab == nullptr) - { - createTab(guild); - } - if (mTab != nullptr) + createTab(guild); + } + if (mTab != nullptr) + { + const size_t pos = msg.find(": ", 0); + if (pos != std::string::npos) { - const size_t pos = msg.find(": ", 0); - if (pos != std::string::npos) - { - const std::string sender_name = msg.substr(0, pos); - if (guild->getMember(sender_name) == nullptr) - { - mTab->chatLog(msg, ChatMsgType::BY_SERVER); - return true; - } - - msg.erase(0, pos + 2); - if (msg.size() > 3 && msg[0] == '#' && msg[1] == '#') - msg.erase(0, 3); - - trim(msg); - mTab->chatLog(sender_name, msg); - } - else + const std::string sender_name = msg.substr(0, pos); + if (guild->getMember(sender_name) == nullptr) { mTab->chatLog(msg, ChatMsgType::BY_SERVER); + return true; } - return true; + + msg.erase(0, pos + 2); + if (msg.size() > 3 && msg[0] == '#' && msg[1] == '#') + msg.erase(0, 3); + + trim(msg); + mTab->chatLog(sender_name, msg); + } + else + { + mTab->chatLog(msg, ChatMsgType::BY_SERVER); } + return true; } return false; } -- cgit v1.2.3-70-g09d2