summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-20 21:20:20 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-20 21:20:20 +0300
commit8fb2c062cd1c03f032b99f4a7e7663c0653ba837 (patch)
tree0bb3cd9a01f0158822ae58a0d56b8b1808cb9bbc /src/resources
parenta9f6959a96395edc64ff57bf5ba1d75cca8e86c3 (diff)
downloadplus-8fb2c062cd1c03f032b99f4a7e7663c0653ba837.tar.gz
plus-8fb2c062cd1c03f032b99f4a7e7663c0653ba837.tar.bz2
plus-8fb2c062cd1c03f032b99f4a7e7663c0653ba837.tar.xz
plus-8fb2c062cd1c03f032b99f4a7e7663c0653ba837.zip
Add missing const in resources directory.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/chatobject.cpp4
-rw-r--r--src/resources/db/avatardb.cpp2
-rw-r--r--src/resources/db/badgesdb.cpp6
-rw-r--r--src/resources/db/commandsdb.cpp2
-rw-r--r--src/resources/db/horsedb.cpp8
-rw-r--r--src/resources/db/itemdb.cpp2
-rw-r--r--src/resources/db/moddb.cpp2
-rw-r--r--src/resources/db/npcdialogdb.cpp4
-rw-r--r--src/resources/db/palettedb.cpp3
-rw-r--r--src/resources/dye/dye.cpp4
-rw-r--r--src/resources/dye/dyepalette.cpp8
-rw-r--r--src/resources/inventory/complexinventory.cpp4
-rw-r--r--src/resources/inventory/inventory.cpp3
-rw-r--r--src/resources/iteminfo.cpp2
-rw-r--r--src/resources/wallpaper.cpp2
15 files changed, 29 insertions, 27 deletions
diff --git a/src/resources/chatobject.cpp b/src/resources/chatobject.cpp
index a601a3c69..3a8ac56f8 100644
--- a/src/resources/chatobject.cpp
+++ b/src/resources/chatobject.cpp
@@ -53,7 +53,7 @@ void ChatObject::update()
ChatObject *ChatObject::findByName(const std::string &name)
{
- std::map<std::string, ChatObject*>::iterator it = chatNameMap.find(name);
+ const std::map<std::string, ChatObject*>::iterator it = chatNameMap.find(name);
if (it == chatNameMap.end())
return nullptr;
else
@@ -62,7 +62,7 @@ ChatObject *ChatObject::findByName(const std::string &name)
ChatObject *ChatObject::findById(const int id)
{
- std::map<int, ChatObject*>::iterator it = chatIdMap.find(id);
+ const std::map<int, ChatObject*>::iterator it = chatIdMap.find(id);
if (it == chatIdMap.end())
return nullptr;
else
diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp
index 5b377b173..b62d13bbf 100644
--- a/src/resources/db/avatardb.cpp
+++ b/src/resources/db/avatardb.cpp
@@ -133,7 +133,7 @@ void AvatarDB::unload()
BeingInfo *AvatarDB::get(const BeingTypeId id)
{
- BeingInfoIterator i = mAvatarInfos.find(id);
+ const BeingInfoIterator i = mAvatarInfos.find(id);
if (i == mAvatarInfos.end())
return BeingInfo::unknown;
else
diff --git a/src/resources/db/badgesdb.cpp b/src/resources/db/badgesdb.cpp
index 1aa6167e2..059a22112 100644
--- a/src/resources/db/badgesdb.cpp
+++ b/src/resources/db/badgesdb.cpp
@@ -82,7 +82,7 @@ void BadgesDB::unload()
const std::string BadgesDB::getPartyBadge(const std::string &name)
{
- BadgesInfosIter it = mParties.find(name);
+ const BadgesInfosIter it = mParties.find(name);
if (it == mParties.end())
return std::string();
return (*it).second;
@@ -90,7 +90,7 @@ const std::string BadgesDB::getPartyBadge(const std::string &name)
const std::string BadgesDB::getNameBadge(const std::string &name)
{
- BadgesInfosIter it = mNames.find(name);
+ const BadgesInfosIter it = mNames.find(name);
if (it == mNames.end())
return std::string();
return (*it).second;
@@ -98,7 +98,7 @@ const std::string BadgesDB::getNameBadge(const std::string &name)
const std::string BadgesDB::getGuildBadge(const std::string &name)
{
- BadgesInfosIter it = mGuilds.find(name);
+ const BadgesInfosIter it = mGuilds.find(name);
if (it == mGuilds.end())
return std::string();
return (*it).second;
diff --git a/src/resources/db/commandsdb.cpp b/src/resources/db/commandsdb.cpp
index 335627c53..2c9d44705 100644
--- a/src/resources/db/commandsdb.cpp
+++ b/src/resources/db/commandsdb.cpp
@@ -85,7 +85,7 @@ void CommandsDB::loadXmlFile(const std::string &fileName)
if (id == -1)
continue;
- CommandsMapIter it = mCommands.find(id);
+ const CommandsMapIter it = mCommands.find(id);
if (it != mCommands.end())
{
logger->log("Commands database: duplicate id: %d", id);
diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp
index 27987c657..8ede4ca3a 100644
--- a/src/resources/db/horsedb.cpp
+++ b/src/resources/db/horsedb.cpp
@@ -49,10 +49,10 @@ namespace
}
static void loadDownSprites(XmlNodePtrConst parentNode,
- HorseInfo *currentInfo);
+ HorseInfo *const currentInfo);
static void loadUpSprites(XmlNodePtrConst parentNode,
- HorseInfo *currentInfo);
+ HorseInfo *const currentInfo);
void HorseDB::load()
{
@@ -157,7 +157,7 @@ void HorseDB::loadXmlFile(const std::string &fileName)
}
static void loadDownSprites(XmlNodePtrConst parentNode,
- HorseInfo *currentInfo)
+ HorseInfo *const currentInfo)
{
for_each_xml_child_node(spriteNode, parentNode)
{
@@ -170,7 +170,7 @@ static void loadDownSprites(XmlNodePtrConst parentNode,
}
static void loadUpSprites(XmlNodePtrConst parentNode,
- HorseInfo *currentInfo)
+ HorseInfo *const currentInfo)
{
for_each_xml_child_node(spriteNode, parentNode)
{
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index e953aa433..3b942797d 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -301,7 +301,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
const std::string typeStr = XML::getProperty(node, "type", "");
int weight = XML::getProperty(node, "weight", 0);
int view = XML::getProperty(node, "view", 0);
- int cardColor = XML::getProperty(node, "cardColor", -1);
+ const int cardColor = XML::getProperty(node, "cardColor", -1);
const int inherit = XML::getProperty(node, "inherit", -1);
std::string name = XML::langProperty(node, "name", "");
diff --git a/src/resources/db/moddb.cpp b/src/resources/db/moddb.cpp
index 3a803a9af..c76bb8352 100644
--- a/src/resources/db/moddb.cpp
+++ b/src/resources/db/moddb.cpp
@@ -103,7 +103,7 @@ void ModDB::unload()
ModInfo *ModDB::get(const std::string &name)
{
- ModInfoIterator i = mModInfos.find(name);
+ const ModInfoIterator i = mModInfos.find(name);
if (i == mModInfos.end())
return nullptr;
else
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp
index 772a64a45..8b2e19d48 100644
--- a/src/resources/db/npcdialogdb.cpp
+++ b/src/resources/db/npcdialogdb.cpp
@@ -187,7 +187,7 @@ void NpcDialogDB::loadXmlFile(const std::string &fileName)
void NpcDialogDB::deleteDialog(const std::string &name)
{
- DialogsIter it = mDialogs.find(name);
+ const DialogsIter it = mDialogs.find(name);
if (it == mDialogs.end())
return;
@@ -218,7 +218,7 @@ void NpcDialogDB::unload()
NpcDialogInfo *NpcDialogDB::getDialog(const std::string &name)
{
- DialogsIter it = mDialogs.find(name);
+ const DialogsIter it = mDialogs.find(name);
if (it == mDialogs.end())
return nullptr;
return (*it).second;
diff --git a/src/resources/db/palettedb.cpp b/src/resources/db/palettedb.cpp
index a3c1fe4a4..cc27fa292 100644
--- a/src/resources/db/palettedb.cpp
+++ b/src/resources/db/palettedb.cpp
@@ -115,7 +115,8 @@ void PaletteDB::unload()
const DyeColor *PaletteDB::getColor(const std::string &name)
{
- std::map<std::string, DyeColor>::const_iterator it = mColors.find(name);
+ const std::map<std::string, DyeColor>::const_iterator it =
+ mColors.find(name);
if (it != mColors.end())
return &(*it).second;
else
diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp
index 129756673..a5dd44221 100644
--- a/src/resources/dye/dye.cpp
+++ b/src/resources/dye/dye.cpp
@@ -211,7 +211,7 @@ endlabel:{}
#else // ENABLE_CILKPLUS
- for (uint32_t *p_end = pixels + CAST_SIZE(bufSize);
+ for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++ pixels)
{
@@ -330,7 +330,7 @@ endlabel:{}
#else // ENABLE_CILKPLUS
- for (uint32_t *p_end = pixels + CAST_SIZE(bufSize);
+ for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++ pixels)
{
diff --git a/src/resources/dye/dyepalette.cpp b/src/resources/dye/dyepalette.cpp
index 6ec85a399..401eaf7ca 100644
--- a/src/resources/dye/dyepalette.cpp
+++ b/src/resources/dye/dyepalette.cpp
@@ -277,7 +277,7 @@ void DyePalette::replaceSColor(uint32_t *restrict pixels,
}
#else // ENABLE_CILKPLUS
- for (uint32_t *p_end = pixels + CAST_SIZE(bufSize);
+ for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++ pixels)
{
@@ -377,7 +377,7 @@ void DyePalette::replaceAColor(uint32_t *restrict pixels,
#else // ENABLE_CILKPLUS
- for (uint32_t *p_end = pixels + CAST_SIZE(bufSize);
+ for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
{
@@ -470,7 +470,7 @@ void DyePalette::replaceSOGLColor(uint32_t *restrict pixels,
#else // ENABLE_CILKPLUS
- for (uint32_t *p_end = pixels + CAST_SIZE(bufSize);
+ for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
{
@@ -562,7 +562,7 @@ void DyePalette::replaceAOGLColor(uint32_t *restrict pixels,
#else // ENABLE_CILKPLUS
- for (uint32_t *p_end = pixels + CAST_SIZE(bufSize);
+ for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
{
diff --git a/src/resources/inventory/complexinventory.cpp b/src/resources/inventory/complexinventory.cpp
index 5264406cb..60f6092e6 100644
--- a/src/resources/inventory/complexinventory.cpp
+++ b/src/resources/inventory/complexinventory.cpp
@@ -52,7 +52,7 @@ bool ComplexInventory::addVirtualItem(const Item *const item,
ComplexItem *citem = nullptr;
if (mItems[index] != nullptr)
{
- Item *const item2 = mItems[index];
+ const Item *const item2 = mItems[index];
if (item->getId() != item2->getId() ||
item->getColor() != item2->getColor())
{ // not same id or color
@@ -132,7 +132,7 @@ void ComplexInventory::setItem(const int index,
return;
}
- Item *const item1 = mItems[index];
+ const Item *const item1 = mItems[index];
if (!item1 && id > 0)
{
ComplexItem *const item = new ComplexItem(id,
diff --git a/src/resources/inventory/inventory.cpp b/src/resources/inventory/inventory.cpp
index f7f6dcaee..efcea0f55 100644
--- a/src/resources/inventory/inventory.cpp
+++ b/src/resources/inventory/inventory.cpp
@@ -229,7 +229,8 @@ bool Inventory::contains(const Item *const item) const
int Inventory::getFreeSlot() const
{
- Item **const i = std::find_if(mItems, mItems + mSize,
+ Item *const *const i = std::find_if(mItems,
+ mItems + mSize,
std::not1(SlotUsed()));
return (i == mItems + mSize) ? -1
: CAST_S32(i - mItems);
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 133242567..79f0e04b5 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -287,7 +287,7 @@ const SpriteToItemMap *ItemInfo::getSpriteToItemReplaceMap(const int direction)
if (direction < 0 || direction >= 10)
return nullptr;
- SpriteToItemMap *const spMap = mSpriteToItemReplaceMap[direction];
+ const SpriteToItemMap *const spMap = mSpriteToItemReplaceMap[direction];
if (spMap)
return spMap;
if (direction == SpriteDirection::UPLEFT
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index e7a1b8253..1f33c70ae 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -83,7 +83,7 @@ void Wallpaper::loadWallpapers()
initDefaultWallpaperPaths();
char **const imgs = PhysFs::enumerateFiles(wallpaperPath.c_str());
- for (char **i = imgs; *i; i++)
+ for (char *const *i = imgs; *i; i++)
{
// If the backup file is found, we tell it.
if (strncmp (*i, wallpaperFile.c_str(), strlen(*i)) == 0)