diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-05 10:13:15 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-06 21:49:14 +0000 |
commit | 3ce39d2b497ab5356290a22b324181386af51c51 (patch) | |
tree | 1b923b8be7e4d2ce8ff70768dc7fff596487935c /src/resources/spritedef.cpp | |
parent | a9df89bda908e3b3d443db7f3ca865b6f12c75e5 (diff) | |
download | mana-3ce39d2b497ab5356290a22b324181386af51c51.tar.gz mana-3ce39d2b497ab5356290a22b324181386af51c51.tar.bz2 mana-3ce39d2b497ab5356290a22b324181386af51c51.tar.xz mana-3ce39d2b497ab5356290a22b324181386af51c51.zip |
General code cleanups
* Use final for all message handlers, Client, LocalPlayer,
Being::getType, Being::setPosition and Being::setMap.
(avoids some warnings about virtual dispatch in constructors)
* Use auto in more places
* Use emplace_back instead of push_back in some places
* Use default member initializers
* Less else after return
* Removed superfluous .c_str()
* Removed type aliases that are only used once
* Removed more unused includes
Diffstat (limited to 'src/resources/spritedef.cpp')
-rw-r--r-- | src/resources/spritedef.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index 3a5195cc..ec41aec0 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -75,10 +75,8 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, int variant) { return load(errorFile, 0); } - else - { - return nullptr; - } + + return nullptr; } auto *def = new SpriteDef; @@ -162,7 +160,7 @@ void SpriteDef::loadImageSet(xmlNodePtr node, const std::string &palettes) if (!imageSet) { logger->error(strprintf("Couldn't load imageset (%s)!", - imageSrc.c_str()).c_str()); + imageSrc.c_str())); } imageSet->setOffsetX(XML::getProperty(node, "offsetX", 0)); @@ -341,14 +339,14 @@ SpriteDirection SpriteDef::makeSpriteDirection(const std::string &direction) { if (direction.empty() || direction == "default") return DIRECTION_DEFAULT; - else if (direction == "up") + if (direction == "up") return DIRECTION_UP; - else if (direction == "left") + if (direction == "left") return DIRECTION_LEFT; - else if (direction == "right") + if (direction == "right") return DIRECTION_RIGHT; - else if (direction == "down") + if (direction == "down") return DIRECTION_DOWN; - else - return DIRECTION_INVALID; + + return DIRECTION_INVALID; } |