summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-28 00:00:26 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-28 00:00:26 +0300
commit81517373aa2eed68fc9901c7c71f22a18040cd51 (patch)
tree44228d7cf59a07cc209c607b1492c3dd305e9d43
parentec0216cdd13aa89aba5da22bad3ef723fa27f6fb (diff)
downloadmanaverse-81517373aa2eed68fc9901c7c71f22a18040cd51.tar.gz
manaverse-81517373aa2eed68fc9901c7c71f22a18040cd51.tar.bz2
manaverse-81517373aa2eed68fc9901c7c71f22a18040cd51.tar.xz
manaverse-81517373aa2eed68fc9901c7c71f22a18040cd51.zip
Fix code style. Remove some useless checks.
-rw-r--r--src/actions/commands.cpp9
-rw-r--r--src/being/being.cpp11
-rw-r--r--src/gui/widgets/browserbox.cpp5
-rw-r--r--src/utils/stringutils_unittest.cc10
4 files changed, 12 insertions, 23 deletions
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<WhisperTab* const>(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<int> 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<int> 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<std::string> 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<int> 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<std::string> tokens;
splitToStringVector(tokens, "", ',');
- REQUIRE(tokens.size() == 0);
+ REQUIRE(tokens.empty() == true);
tokens.clear();
splitToStringVector(tokens, "t,line,zz", ',');