summaryrefslogtreecommitdiff
path: root/src/resources/spritedef.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-20 20:43:54 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-20 23:48:07 +0300
commit2744e4fa8f39cd06bfe557a5a3881830bd11501c (patch)
tree2ec96c6ee820cfe0e5e76480fe828501bf555a4b /src/resources/spritedef.cpp
parent531433248fbad49e2b8e9d90de9855f3ea9b2257 (diff)
downloadmanaplus-2744e4fa8f39cd06bfe557a5a3881830bd11501c.tar.gz
manaplus-2744e4fa8f39cd06bfe557a5a3881830bd11501c.tar.bz2
manaplus-2744e4fa8f39cd06bfe557a5a3881830bd11501c.tar.xz
manaplus-2744e4fa8f39cd06bfe557a5a3881830bd11501c.zip
Last part with FOR_EACH changes.
Diffstat (limited to 'src/resources/spritedef.cpp')
-rw-r--r--src/resources/spritedef.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 28eeb00ed..4af25c8cf 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -62,8 +62,7 @@ Action *SpriteDef::getAction(const std::string &action,
unsigned SpriteDef::findNumber(const unsigned num) const
{
unsigned min = 101;
- for (Actions::const_iterator it = mActions.begin(),
- it_end = mActions.end(); it != it_end; ++ it)
+ FOR_EACH (Actions::const_iterator, it, mActions)
{
const unsigned n = (*it).first;
if (n >= num && n < min)
@@ -107,8 +106,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, const int variant)
void SpriteDef::fixDeadAction()
{
- for (ActionsIter it = mActions.begin(), it_end = mActions.end();
- it != it_end; ++ it)
+ FOR_EACH (ActionsIter, it, mActions)
{
ActionMap *const d = (*it).second;
if (!d)
@@ -123,8 +121,7 @@ void SpriteDef::fixDeadAction()
void SpriteDef::substituteAction(std::string complete, std::string with)
{
- for (ActionsConstIter it = mActions.begin(), it_end = mActions.end();
- it != it_end; ++ it)
+ FOR_EACH (ActionsConstIter, it, mActions)
{
ActionMap *const d = (*it).second;
if (!d)
@@ -330,8 +327,7 @@ void SpriteDef::loadAnimation(const XmlNodePtr animationNode,
{
StringVect vals;
splitToStringVector(vals, value, ',');
- for (StringVectCIter it = vals.begin(), it_end = vals.end();
- it != it_end; ++ it)
+ FOR_EACH (StringVectCIter, it, vals)
{
std::string str = *it;
const size_t idx = str.find("-");
@@ -419,27 +415,19 @@ SpriteDef::~SpriteDef()
{
// Actions are shared, so ensure they are deleted only once.
std::set<Action*> actions;
- for (Actions::iterator i = mActions.begin(),
- i_end = mActions.end(); i != i_end; ++i)
+ FOR_EACH (Actions::iterator, i, mActions)
{
- for (ActionMap::iterator it = (*i).second->begin(),
- it_end = (*i).second->end(); it != it_end; ++ it)
- {
+ FOR_EACHP (ActionMap::iterator, it, (*i).second)
actions.insert(it->second);
- }
delete (*i).second;
}
- for (std::set<Action*>::const_iterator i = actions.begin(),
- i_end = actions.end(); i != i_end; ++i)
- {
+ FOR_EACH (std::set<Action*>::const_iterator, i, actions)
delete *i;
- }
mActions.clear();
- for (ImageSetIterator i = mImageSets.begin();
- i != mImageSets.end(); ++i)
+ FOR_EACH (ImageSetIterator, i, mImageSets)
{
if (i->second)
{
@@ -447,6 +435,7 @@ SpriteDef::~SpriteDef()
i->second = nullptr;
}
}
+ mImageSets.clear();
}
SpriteDirection SpriteDef::makeSpriteDirection(const std::string &direction)