summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-14 11:27:04 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-14 12:34:23 +0300
commita7d7346b9eb3fa62a8912e31d5c00f8e05390425 (patch)
treeba2d006e8aaac74138eb13ba458d30abf8f01182 /src/resources
parent9569f124d176b4220f28f9a41812c33883737228 (diff)
downloadplus-a7d7346b9eb3fa62a8912e31d5c00f8e05390425.tar.gz
plus-a7d7346b9eb3fa62a8912e31d5c00f8e05390425.tar.bz2
plus-a7d7346b9eb3fa62a8912e31d5c00f8e05390425.tar.xz
plus-a7d7346b9eb3fa62a8912e31d5c00f8e05390425.zip
some more style fixes from cpplint.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/atlasmanager.cpp1
-rw-r--r--src/resources/beinginfo.cpp1
-rw-r--r--src/resources/chardb.cpp2
-rw-r--r--src/resources/cursor.cpp3
-rw-r--r--src/resources/dye.cpp1
-rw-r--r--src/resources/emotedb.cpp4
-rw-r--r--src/resources/iteminfo.cpp2
-rw-r--r--src/resources/mapreader.cpp10
-rw-r--r--src/resources/monsterdb.cpp4
-rw-r--r--src/resources/npcdb.cpp2
-rw-r--r--src/resources/openglimagehelper.cpp2
-rw-r--r--src/resources/resourcemanager.cpp7
-rw-r--r--src/resources/sdlimagehelper.cpp2
-rw-r--r--src/resources/spritedef.cpp3
-rw-r--r--src/resources/wallpaper.cpp4
15 files changed, 21 insertions, 27 deletions
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp
index 0d43d59c8..27ab3053a 100644
--- a/src/resources/atlasmanager.cpp
+++ b/src/resources/atlasmanager.cpp
@@ -102,7 +102,6 @@ void AtlasManager::loadImages(const StringVect &files,
Resource *const res = resman->getTempResource(str);
if (res)
{
- //logger->log("Resource %s already in cache", str.c_str());
// increase counter because in moveToDeleted it will be decreased.
res->incRef();
resman->moveToDeleted(res);
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 9e2f9a395..fc6139e83 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -112,7 +112,6 @@ const std::string &BeingInfo::getSound(const SoundEvent event) const
const Attack *BeingInfo::getAttack(const int id) const
{
-
const Attacks::const_iterator i = mAttacks.find(id);
return (i == mAttacks.end()) ? empty : (*i).second;
}
diff --git a/src/resources/chardb.cpp b/src/resources/chardb.cpp
index 577cdc111..7c741c15c 100644
--- a/src/resources/chardb.cpp
+++ b/src/resources/chardb.cpp
@@ -37,7 +37,7 @@ namespace
unsigned mMaxStat = 0;
unsigned mSumStat = 0;
std::vector<int> mDefaultItems;
-}
+} // namespace
void CharDB::load()
{
diff --git a/src/resources/cursor.cpp b/src/resources/cursor.cpp
index 15fe28e26..5ce5527df 100644
--- a/src/resources/cursor.cpp
+++ b/src/resources/cursor.cpp
@@ -64,5 +64,4 @@ namespace Cursor
}
return CURSOR_POINTER;
}
-
-}
+}// namespace Cursor
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 202ab0675..13b635d45 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -382,7 +382,6 @@ void Dye::instantiate(std::string &target, const std::string &palettes)
{
s << palettes.substr(pal_pos);
s << target.substr(next_pos);
- //pal_pos = std::string::npos;
break;
}
s << palettes.substr(pal_pos, pal_next_pos - pal_pos);
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index 0492cb848..8dc401716 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -62,7 +62,7 @@ void EmoteDB::load()
return;
}
- //iterate <emote>s
+ // iterate <emote>s
for_each_xml_child_node(emoteNode, rootNode)
{
if (!xmlNameEqual(emoteNode, "emote"))
@@ -121,7 +121,7 @@ void EmoteDB::load()
return;
}
- //iterate <emote>s
+ // iterate <emote>s
for_each_xml_child_node(emoteNode, rootNode)
{
if (!xmlNameEqual(emoteNode, "emote"))
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 04be2fc6f..325528d60 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -99,7 +99,7 @@ const std::string &ItemInfo::getSprite(const Gender gender,
void ItemInfo::setAttackAction(std::string attackAction)
{
if (attackAction.empty())
- mAttackAction = SpriteAction::ATTACK; // (Equal to unarmed animation)
+ mAttackAction = SpriteAction::ATTACK; // (Equal to unarmed animation)
else
mAttackAction = attackAction;
}
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 464680620..f74b5ff07 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -60,12 +60,12 @@ static std::string resolveRelativePath(std::string base, std::string relative)
while (relative.substr(0, 3) == "../")
{
relative.erase(0, 3); // Remove "../"
- if (!base.empty()) // If base is already empty, we can't trim anymore
+ if (!base.empty()) // If base is already empty, we can't trim anymore
{
i = base.find_last_of('/');
if (i == std::string::npos)
i = 0;
- base.erase(i, base.length()); // Remove deepest folder in base
+ base.erase(i, base.length()); // Remove deepest folder in base
}
}
@@ -142,7 +142,6 @@ int inflateMemory(unsigned char *const in, const unsigned int inLength,
}
}
while (ret != Z_STREAM_END);
-// assert(strm.avail_in == 0);
outLength = bufferSize - strm.avail_out;
(void) inflateEnd(&strm);
@@ -374,8 +373,8 @@ Map *MapReader::readMap(XmlNodePtr node, const std::string &path)
}
else if (objType == "SPAWN")
{
-// map->addPortal(_("Spawn: ") + objName, MapItem::PORTAL,
-// objX, objY, objW, objH);
+// map->addPortal(_("Spawn: ") + objName, MapItem::PORTAL,
+// objX, objY, objW, objH);
}
else if (objType == "MUSIC")
{
@@ -693,7 +692,6 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map)
// There can be only one data element
break;
}
-
}
Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path,
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index 969cb510d..793fd4d0d 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -69,7 +69,7 @@ void MonsterDB::load()
"offset", OLD_TMWATHENA_OFFSET);
#endif
- //iterate <monster>s
+ // iterate <monster>s
for_each_xml_child_node(monsterNode, rootNode)
{
if (!xmlNameEqual(monsterNode, "monster"))
@@ -124,7 +124,7 @@ void MonsterDB::load()
SpriteDisplay display;
- //iterate <sprite>s and <sound>s
+ // iterate <sprite>s and <sound>s
for_each_xml_child_node(spriteNode, monsterNode)
{
if (xmlNameEqual(spriteNode, "sprite"))
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 9fc8ea73c..7056f1131 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -56,7 +56,7 @@ void NPCDB::load()
return;
}
- //iterate <npc>s
+ // iterate <npc>s
for_each_xml_child_node(npcNode, rootNode)
{
if (!xmlNameEqual(npcNode, "npc"))
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 073835626..9843d5026 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -112,7 +112,7 @@ Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
int v[3];
v[0] = (p) & 255;
v[1] = (p >> 8) & 255;
- v[2] = (p >> 16 ) & 255;
+ v[2] = (p >> 16) & 255;
dye.update(v);
*pixels = (v[0]) | (v[1] << 8) | (v[2] << 16) | (alpha << 24);
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 0cff31f0a..481f74d30 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -244,8 +244,8 @@ bool ResourceManager::cleanOrphans(const bool always)
const ResourceIterator toErase = iter;
++iter;
mOrphanedResources.erase(toErase);
- delete res; // delete only after removal from list,
- // to avoid issues in recursion
+ delete res; // delete only after removal from list,
+ // to avoid issues in recursion
status = true;
}
}
@@ -912,7 +912,8 @@ void ResourceManager::deleteInstance()
{
logger->log("clean orphans start");
instance->cleanProtected();
- while (instance->cleanOrphans(true));
+ while (instance->cleanOrphans(true))
+ continue;
logger->log("clean orphans end");
ResourceIterator iter = instance->mResources.begin();
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index b21f76b7f..44478d297 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -109,7 +109,7 @@ Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
int v[3];
v[0] = (p >> 24) & 255;
v[1] = (p >> 16) & 255;
- v[2] = (p >> 8 ) & 255;
+ v[2] = (p >> 8) & 255;
dye.update(v);
*pixels = (v[0] << 24) | (v[1] << 16) | (v[2] << 8) | alpha;
}
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index b417345fd..8420c806d 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -327,7 +327,6 @@ void SpriteDef::loadAnimation(const XmlNodePtr animationNode,
{
continue;
}
-
}
else
{
@@ -386,7 +385,7 @@ void SpriteDef::loadAnimation(const XmlNodePtr animationNode,
if (!name.empty())
animation->addGoto(name, rand);
}
- } // for frameNode
+ } // for frameNode
}
void SpriteDef::includeSprite(const XmlNodePtr includeNode)
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 4b7219e7b..5067bbcc8 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -46,7 +46,7 @@ struct WallpaperData
static bool wallpaperCompare(const WallpaperData &a, const WallpaperData &b);
static std::vector<WallpaperData> wallpaperData;
-static bool haveBackup; // Is the backup (no size given) version available?
+static bool haveBackup; // Is the backup (no size given) version available?
static std::string wallpaperPath;
static std::string wallpaperFile;
@@ -154,7 +154,7 @@ std::string Wallpaper::getWallpaper(const int width, const int height)
// Return randomly a wallpaper between vector[0] and
// vector[vector.size() - 1]
srand(static_cast<unsigned>(time(nullptr)));
- return wallPaperVector[int(static_cast<double>(
+ return wallPaperVector[static_cast<int>(static_cast<double>(
wallPaperVector.size()) * rand() / (RAND_MAX + 1.0))];
}