summaryrefslogtreecommitdiff
path: root/src/resources/monsterinfo.cpp
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2010-02-10 23:46:49 -0500
committerChuck Miller <shadowmil@gmail.com>2010-02-10 23:50:23 -0500
commit85e7f2a79477712bf3082cb82e6a73c51361abb0 (patch)
treec8a42adb06e0c5ba416bd30fcd1808c1e4f26ddc /src/resources/monsterinfo.cpp
parent3a761a242436e521c7fa8ef3746551ac7b746308 (diff)
downloadmana-85e7f2a79477712bf3082cb82e6a73c51361abb0.tar.gz
mana-85e7f2a79477712bf3082cb82e6a73c51361abb0.tar.bz2
mana-85e7f2a79477712bf3082cb82e6a73c51361abb0.tar.xz
mana-85e7f2a79477712bf3082cb82e6a73c51361abb0.zip
Adds missile-particle attribute to items and monster attacks
To use simply add something like: missile-particle="graphics/particles/arrow.particle.xml" to the item's or monster's xml entry This will only work on equipped weapons, and on specified monster attacks. This patch also fixes a memory leak with target particles
Diffstat (limited to 'src/resources/monsterinfo.cpp')
-rw-r--r--src/resources/monsterinfo.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/resources/monsterinfo.cpp b/src/resources/monsterinfo.cpp
index 2d788a72..fbb93ec1 100644
--- a/src/resources/monsterinfo.cpp
+++ b/src/resources/monsterinfo.cpp
@@ -62,6 +62,14 @@ const std::string &MonsterInfo::getAttackParticleEffect(int attackType) const
return (i == mMonsterAttacks.end()) ? empty : (*i).second->particleEffect;
}
+const std::string &MonsterInfo::getAttackMissileParticle(int attackType) const
+{
+ static std::string empty("");
+ std::map<int, MonsterAttack*>::const_iterator i =
+ mMonsterAttacks.find(attackType);
+ return (i == mMonsterAttacks.end()) ? empty : (*i).second->missileParticle;
+}
+
SpriteAction MonsterInfo::getAttackAction(int attackType) const
{
std::map<int, MonsterAttack*>::const_iterator i =
@@ -71,10 +79,12 @@ SpriteAction MonsterInfo::getAttackAction(int attackType) const
void MonsterInfo::addMonsterAttack(int id,
const std::string &particleEffect,
- SpriteAction action)
+ SpriteAction action,
+ const std::string &missileParticle)
{
MonsterAttack *a = new MonsterAttack;
a->particleEffect = particleEffect;
+ a->missileParticle = missileParticle;
a->action = action;
mMonsterAttacks[id] = a;
}