From 81517373aa2eed68fc9901c7c71f22a18040cd51 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 28 Jan 2017 00:00:26 +0300 Subject: Fix code style. Remove some useless checks. --- src/actions/commands.cpp | 9 +++------ src/being/being.cpp | 11 ++++------- src/gui/widgets/browserbox.cpp | 5 ----- src/utils/stringutils_unittest.cc | 10 +++++----- 4 files changed, 12 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index c02d2ef39..c7633972b 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -93,12 +93,9 @@ static std::string getNick(const InputEvent &event) WhisperTab *const whisper = static_cast(event.tab); if (whisper->getNick().empty()) { - if (event.tab) - { - // TRANSLATORS: change relation - event.tab->chatLog(_("Please specify a name."), - ChatMsgType::BY_SERVER); - } + // TRANSLATORS: change relation + event.tab->chatLog(_("Please specify a name."), + ChatMsgType::BY_SERVER); return std::string(); } args = whisper->getNick(); diff --git a/src/being/being.cpp b/src/being/being.cpp index 911951789..817fcca70 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1739,14 +1739,11 @@ void Being::nextTile() restrict2 if (mX != pos.x || mY != pos.y) { - if (mMap) + mOldHeight = mMap->getHeightOffset(mX, mY); + if (mReachable == Reachable::REACH_NO && + mMap->getBlockMask(mX, mY) != mMap->getBlockMask(pos.x, pos.y)) { - mOldHeight = mMap->getHeightOffset(mX, mY); - if (mReachable == Reachable::REACH_NO && - mMap->getBlockMask(mX, mY) != mMap->getBlockMask(pos.x, pos.y)) - { - mReachable = Reachable::REACH_UNKNOWN; - } + mReachable = Reachable::REACH_UNKNOWN; } } mX = pos.x; diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index be3f006f6..0c35b63d4 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -621,11 +621,6 @@ int BrowserBox::calcHeight() // "Tokenize" the string at control sequences if (mUseLinksAndUserColors) idx1 = row.find("##", start + 1); - if (idx1 < idx2) - end = idx1; - else - end = idx2; - if (start == 0 || mUseLinksAndUserColors) { // Check for color change in format "##x", x = [L,P,0..9] diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc index 309bf1ee9..cc1b2da69 100644 --- a/src/utils/stringutils_unittest.cc +++ b/src/utils/stringutils_unittest.cc @@ -611,7 +611,7 @@ TEST_CASE("stringuntils splitToIntSet 1") { std::set tokens; splitToIntSet(tokens, "", ','); - REQUIRE(tokens.size() == 0); + REQUIRE(tokens.empty() == true); tokens.clear(); splitToIntSet(tokens, "10z,aa,-1", ','); @@ -652,7 +652,7 @@ TEST_CASE("stringuntils splitToIntList 1") { std::list tokens; tokens = splitToIntList("", ','); - REQUIRE(tokens.size() == 0); + REQUIRE(tokens.empty() == true); tokens.clear(); tokens = splitToIntList("10z,a,-1", ','); @@ -707,7 +707,7 @@ TEST_CASE("stringuntils splitToStringSet 1") { std::set tokens; splitToStringSet(tokens, "", ','); - REQUIRE(tokens.size() == 0); + REQUIRE(tokens.empty() == true); tokens.clear(); splitToStringSet(tokens, "10q,2w,30e", ','); @@ -754,7 +754,7 @@ TEST_CASE("stringuntils splitToIntVector 1") { std::vector tokens; splitToIntVector(tokens, "", ','); - REQUIRE(tokens.size() == 0); + REQUIRE(tokens.empty() == true); tokens.clear(); splitToIntVector(tokens, "10,2,30", ','); @@ -801,7 +801,7 @@ TEST_CASE("stringuntils splitToStringVector 1") { std::vector tokens; splitToStringVector(tokens, "", ','); - REQUIRE(tokens.size() == 0); + REQUIRE(tokens.empty() == true); tokens.clear(); splitToStringVector(tokens, "t,line,zz", ','); -- cgit v1.2.3-70-g09d2