From a7d7346b9eb3fa62a8912e31d5c00f8e05390425 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 14 Apr 2013 11:27:04 +0300 Subject: some more style fixes from cpplint. --- src/resources/atlasmanager.cpp | 1 - src/resources/beinginfo.cpp | 1 - src/resources/chardb.cpp | 2 +- src/resources/cursor.cpp | 3 +-- src/resources/dye.cpp | 1 - src/resources/emotedb.cpp | 4 ++-- src/resources/iteminfo.cpp | 2 +- src/resources/mapreader.cpp | 10 ++++------ src/resources/monsterdb.cpp | 4 ++-- src/resources/npcdb.cpp | 2 +- src/resources/openglimagehelper.cpp | 2 +- src/resources/resourcemanager.cpp | 7 ++++--- src/resources/sdlimagehelper.cpp | 2 +- src/resources/spritedef.cpp | 3 +-- src/resources/wallpaper.cpp | 4 ++-- 15 files changed, 21 insertions(+), 27 deletions(-) (limited to 'src/resources') 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 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 s + // iterate s for_each_xml_child_node(emoteNode, rootNode) { if (!xmlNameEqual(emoteNode, "emote")) @@ -121,7 +121,7 @@ void EmoteDB::load() return; } - //iterate s + // iterate 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 s + // iterate s for_each_xml_child_node(monsterNode, rootNode) { if (!xmlNameEqual(monsterNode, "monster")) @@ -124,7 +124,7 @@ void MonsterDB::load() SpriteDisplay display; - //iterate s and s + // iterate s and 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 s + // iterate 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; -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(time(nullptr))); - return wallPaperVector[int(static_cast( + return wallPaperVector[static_cast(static_cast( wallPaperVector.size()) * rand() / (RAND_MAX + 1.0))]; } -- cgit v1.2.3-60-g2f50