summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-01-27 18:48:37 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-02-02 15:27:56 +0100
commit7cc504d993fa948ae2e10848993f4552b2d6daaa (patch)
tree4d3b583fa8a9f732c0b71f3905e821a297e9a000
parent2e70a4a4412f44934b3d2055c5b46c441dd0d132 (diff)
downloadmana-7cc504d993fa948ae2e10848993f4552b2d6daaa.tar.gz
mana-7cc504d993fa948ae2e10848993f4552b2d6daaa.tar.bz2
mana-7cc504d993fa948ae2e10848993f4552b2d6daaa.tar.xz
mana-7cc504d993fa948ae2e10848993f4552b2d6daaa.zip
Fixed the use of custom particle effects for attacks.
The tA beingmanager was wrongly using the attack type in the Being::handleAttack() function, which is in fact used to set the attack id. Thus, breaking the attack id given and all its attack parameters. I noticed that while updating the client data for TMW. Reviewed-by: Thorbjørn Lindeijer
-rw-r--r--src/net/tmwa/beinghandler.cpp5
-rw-r--r--src/resources/beinginfo.cpp9
2 files changed, 7 insertions, 7 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index b74ab3e7..bcfb335f 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -361,7 +361,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
if (dstBeing)
dstBeing->takeDamage(srcBeing, param1, Being::HIT); // Perhaps a new skill attack type should be created and used?
if (srcBeing)
- srcBeing->handleAttack(dstBeing, param1, Being::HIT);
+ srcBeing->handleAttack(dstBeing, param1);
break;
}
case SMSG_BEING_ACTION:
@@ -386,8 +386,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
dstBeing->takeDamage(srcBeing, param1,
(Being::AttackType)type);
if (srcBeing)
- srcBeing->handleAttack(dstBeing, param1,
- (Being::AttackType)type);
+ srcBeing->handleAttack(dstBeing, param1);
break;
case 0x02: // Sit
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 33af8980..8683e7bc 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -99,16 +99,17 @@ const Attack *BeingInfo::getAttack(int id) const
paths.getIntValue("criticalHitEffectId"),
std::string());
- Attacks::const_iterator i = mAttacks.find(id);
- return (i == mAttacks.end()) ? empty : (*i).second;
+ Attacks::const_iterator it = mAttacks.find(id);
+ return (it == mAttacks.end()) ? empty : it->second;
}
void BeingInfo::addAttack(int id, std::string action, int effectId,
int hitEffectId, int criticalHitEffectId,
const std::string &missileParticleFilename)
{
- if (mAttacks[id])
- delete mAttacks[id];
+ Attacks::iterator it = mAttacks.find(id);
+ if (it != mAttacks.end())
+ delete it->second;
mAttacks[id] = new Attack(action, effectId, hitEffectId,
criticalHitEffectId, missileParticleFilename);