From 7f299fa18a883f5e7392b00764aa1c4d2c41b212 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 3 Mar 2015 18:01:57 +0300 Subject: Add rideattack-action into item db. --- src/resources/db/itemdb.cpp | 3 +++ src/resources/iteminfo.cpp | 9 +++++++++ src/resources/iteminfo.h | 6 ++++++ 3 files changed, 18 insertions(+) (limited to 'src/resources') diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 189288bf1..11b6f47f4 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -286,6 +286,8 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) node, "skyattack-action", ""); std::string waterAttackAction = XML::getProperty( node, "waterattack-action", ""); + std::string rideAttackAction = XML::getProperty( + node, "rideattack-action", ""); std::string drawBefore = XML::getProperty(node, "drawBefore", ""); std::string drawAfter = XML::getProperty(node, "drawAfter", ""); const int pet = XML::getProperty(node, "pet", 0); @@ -386,6 +388,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) itemInfo->setAttackAction(attackAction); itemInfo->setSkyAttackAction(skyAttackAction); itemInfo->setWaterAttackAction(waterAttackAction); + itemInfo->setRideAttackAction(rideAttackAction); itemInfo->setAttackRange(attackRange); itemInfo->setMissileParticleFile(missileParticle); itemInfo->setHitEffectId(hitEffectId); diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index abea2c605..c115320cb 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -55,6 +55,7 @@ ItemInfo::ItemInfo() : mAttackAction(SpriteAction::INVALID), mSkyAttackAction(SpriteAction::INVALID), mWaterAttackAction(SpriteAction::INVALID), + mRideAttackAction(SpriteAction::INVALID), mAttackRange(0), mMissileParticle(), mAnimationFiles(), @@ -134,6 +135,14 @@ void ItemInfo::setWaterAttackAction(const std::string &attackAction) mWaterAttackAction = attackAction; } +void ItemInfo::setRideAttackAction(const std::string &attackAction) +{ + if (attackAction.empty()) + mRideAttackAction = SpriteAction::ATTACKRIDE; + else + mRideAttackAction = attackAction; +} + void ItemInfo::addSound(const ItemSoundEvent::Type event, const std::string &filename, const int delay) { diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 78ecf13d3..4d69b5c36 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -135,6 +135,8 @@ class ItemInfo final void setWaterAttackAction(const std::string &attackAction); + void setRideAttackAction(const std::string &attackAction); + // Handlers for seting and getting the string // used for particles when attacking void setMissileParticleFile(const std::string &s) @@ -170,6 +172,9 @@ class ItemInfo final const std::string &getWaterAttackAction() const { return mWaterAttackAction; } + const std::string &getRideAttackAction() const + { return mRideAttackAction; } + int getAttackRange() const A_WARN_UNUSED { return mAttackRange; } @@ -299,6 +304,7 @@ class ItemInfo final std::string mAttackAction; std::string mSkyAttackAction; std::string mWaterAttackAction; + std::string mRideAttackAction; int mAttackRange; /**< Attack range, will be zero if non weapon. */ // Particle to be shown when weapon attacks -- cgit v1.2.3-70-g09d2