summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2020-02-23 09:30:51 +0300
committerAndrei Karas <akaras@inbox.ru>2020-02-23 09:30:51 +0300
commit1e2a88e975019929c4c7e3154537865cc09550a6 (patch)
treeae8bc68ad3a3f6b61a5e2d511d7fc17daa22bd0e /src/resources
parent6941fd4eeb1dce20aba8c42fd030c2690c37b731 (diff)
downloadplus-1e2a88e975019929c4c7e3154537865cc09550a6.tar.gz
plus-1e2a88e975019929c4c7e3154537865cc09550a6.tar.bz2
plus-1e2a88e975019929c4c7e3154537865cc09550a6.tar.xz
plus-1e2a88e975019929c4c7e3154537865cc09550a6.zip
Fix some code style issues
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/itemdb.cpp3
-rw-r--r--src/resources/mapreader.cpp14
-rw-r--r--src/resources/memorymanager.cpp2
-rw-r--r--src/resources/sdlgfxblitfunc.cpp2
-rw-r--r--src/resources/sdlgfxblitfunc.h2
5 files changed, 11 insertions, 12 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index e5b13f9bb..e6e3cc323 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -988,12 +988,11 @@ static void loadSoundRef(ItemInfo *const itemInfo, XmlNodeConstPtr node)
return;
}
const std::string event = XML::getProperty(node, "event", "");
- const int delay = XML::getProperty(node, "delay", 0);
-
const std::map<std::string, ItemSoundEvent::Type>::const_iterator
it = mSoundNames.find(event);
if (it != mSoundNames.end())
{
+ const int delay = XML::getProperty(node, "delay", 0);
const std::string filename = XmlChildContent(node);
itemInfo->addSound((*it).second, filename, delay);
}
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index d697dc215..e8f1927b8 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -1196,10 +1196,10 @@ Tileset *MapReader::readTileset(XmlNodePtr node,
haveAnimation = true;
const std::string name = XML::getProperty(
propertyNode, "name", "");
- const int value = XML::getProperty(
- propertyNode, "value", 0);
if (!name.empty())
{
+ const int value = XML::getProperty(
+ propertyNode, "value", 0);
tileProperties[name] = value;
logger->log("Tile Prop of %d \"%s\" = \"%d\"",
tileGID, name.c_str(), value);
@@ -1241,13 +1241,13 @@ Tileset *MapReader::readTileset(XmlNodePtr node,
if (!xmlNameEqual(frameNode, "frame"))
continue;
- const int tileId = XML::getProperty(
- frameNode, "tileid", 0);
- const int duration = XML::getProperty(
- frameNode, "duration", 0) / 10;
-
if (set != nullptr)
{
+ const int tileId = XML::getProperty(
+ frameNode, "tileid", 0);
+ const int duration = XML::getProperty(
+ frameNode, "duration", 0) / 10;
+
ani->addFrame(set->get(tileId),
duration,
0, 0, 100);
diff --git a/src/resources/memorymanager.cpp b/src/resources/memorymanager.cpp
index ff68a7835..233fb709d 100644
--- a/src/resources/memorymanager.cpp
+++ b/src/resources/memorymanager.cpp
@@ -88,9 +88,9 @@ void MemoryManager::printAllMemory(ChatTab *const tab A_DYECMD_UNUSED)
ResourceManager::calcMemory(0);
#else // DYECMD
- int sz = ResourceManager::calcMemory(0);
if (tab != nullptr)
{
+ int sz = ResourceManager::calcMemory(0);
// TRANSLATORS: memory usage chat message
tab->chatLog(strprintf(_("Calculated memory usage: %d"), sz),
ChatMsgType::BY_SERVER,
diff --git a/src/resources/sdlgfxblitfunc.cpp b/src/resources/sdlgfxblitfunc.cpp
index 6c0b9fa08..9aa45e2e7 100644
--- a/src/resources/sdlgfxblitfunc.cpp
+++ b/src/resources/sdlgfxblitfunc.cpp
@@ -433,7 +433,7 @@ static int _SDL_gfxBlitRGBACall(const SDL_Surface *const src,
return 0;
}
-int SDLgfxBlitRGBA(SDL_Surface *const src,
+int SDLgfxBlitRGBA(const SDL_Surface *const src,
const SDL_Rect *const srcrect,
SDL_Surface *const dst,
const SDL_Rect *const dstrect)
diff --git a/src/resources/sdlgfxblitfunc.h b/src/resources/sdlgfxblitfunc.h
index b01627dc8..298d04b70 100644
--- a/src/resources/sdlgfxblitfunc.h
+++ b/src/resources/sdlgfxblitfunc.h
@@ -34,7 +34,7 @@ struct SDL_Rect;
// src surface can be any format (most time 32 bit surface with any masks)
// dst surface always correct 32 sufraces (shared format for all)
-int SDLgfxBlitRGBA(SDL_Surface *const src,
+int SDLgfxBlitRGBA(const SDL_Surface *const src,
const SDL_Rect *const srcrect,
SDL_Surface *const dst,
const SDL_Rect *const dstrect);