From 3420babbbc6d10f1fc5be7ff7b895e618acd5f0e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 19 Oct 2015 15:44:14 +0300 Subject: Allow support for different horses riding. --- src/being/being.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'src/being/being.cpp') diff --git a/src/being/being.cpp b/src/being/being.cpp index 03e67f327..96c94cc92 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1249,7 +1249,7 @@ void Being::fireMissile(Being *const victim, const std::string &particle) const std::string Being::getSitAction() const { - if (mRiding) + if (mHorseId != 0) return SpriteAction::SITRIDE; if (mMap) { @@ -1267,7 +1267,7 @@ std::string Being::getSitAction() const std::string Being::getMoveAction() const { - if (mRiding) + if (mHorseId != 0) return SpriteAction::RIDE; if (mMap) { @@ -1285,7 +1285,7 @@ std::string Being::getWeaponAttackAction(const ItemInfo *const weapon) const if (!weapon) return SpriteAction::ATTACK; - if (mRiding) + if (mHorseId != 0) return weapon->getRideAttackAction(); if (mMap) { @@ -1317,7 +1317,7 @@ std::string Being::getAttackAction(const Attack *const attack1) const #define getSpriteAction(func, action) \ std::string Being::get##func##Action() const \ { \ - if (mRiding) \ + if (mHorseId != 0) \ return SpriteAction::action##RIDE; \ if (mMap) \ { \ @@ -4055,14 +4055,27 @@ void Being::removeHorse() void Being::setRiding(const bool b) { - if (b == mRiding) + if (serverFeatures->haveExtendedRiding()) return; - mRiding = b; + + if (b == (mHorseId != 0)) + return; + if (b) + setHorse(1); + else + setHorse(0); +} + +void Being::setHorse(const int horseId) +{ + if (mHorseId == horseId) + return; + mHorseId = horseId; setAction(mAction, 0); removeHorse(); - if (b) + if (mHorseId != 0) { - mHorseInfo = HorseDB::get(1); + mHorseInfo = HorseDB::get(horseId); if (mHorseInfo) { FOR_EACH (SpriteRefs, it, mHorseInfo->downSprites) -- cgit v1.2.3-70-g09d2