From 3ce39d2b497ab5356290a22b324181386af51c51 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Tue, 5 Mar 2024 10:13:15 +0100 Subject: 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 --- src/resources/spritedef.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/resources/spritedef.cpp') 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; } -- cgit v1.2.3-70-g09d2