1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-15 18:39:51 +00:00

final warnings removal

This commit is contained in:
mrcheko 2014-01-17 20:33:49 +02:00
parent 7df8273d71
commit 46a4790cb1
2 changed files with 45 additions and 42 deletions

View File

@ -26,6 +26,10 @@ namespace
return 1.0;
return -1.0;
}
void determineAttackType(const MWWorld::Ptr& actor, MWMechanics::Movement &movement);
//chooses an attack depending on probability to avoid uniformity
void chooseBestAttack(const ESM::Weapon* weapon, MWMechanics::Movement &movement);
}
namespace MWMechanics
@ -256,7 +260,7 @@ namespace MWMechanics
//less than in time of playing weapon anim from 'start' to 'hit' tags (t_swing)
//then start attacking
float speed1 = cls.getSpeed(actor);
float speed2 = cls.getSpeed(mTarget);
float speed2 = mTarget.getClass().getSpeed(mTarget);
if(actor.getClass().getMovementSettings(mTarget).mPosition[0] == 0
&& actor.getClass().getMovementSettings(mTarget).mPosition[1] == 0)
speed2 = 0;
@ -357,19 +361,22 @@ namespace MWMechanics
{
return new AiCombat(*this);
}
}
void determineAttackType(const MWWorld::Ptr& actor, MWMechanics::Movement &movement)
{
namespace
{
void determineAttackType(const MWWorld::Ptr& actor, MWMechanics::Movement &movement)
{
if (movement.mPosition[0] && !movement.mPosition[1]) //sideway
actor.getClass().getCreatureStats(actor).setAttackType(MWMechanics::CreatureStats::AT_Slash);
else if (movement.mPosition[1]) //forward
actor.getClass().getCreatureStats(actor).setAttackType(MWMechanics::CreatureStats::AT_Thrust);
else
actor.getClass().getCreatureStats(actor).setAttackType(MWMechanics::CreatureStats::AT_Chop);
}
}
void chooseBestAttack(const ESM::Weapon* weapon, MWMechanics::Movement &movement)
{
void chooseBestAttack(const ESM::Weapon* weapon, MWMechanics::Movement &movement)
{
//the more damage attackType deals the more probability it has
if (weapon == NULL)
@ -402,6 +409,6 @@ namespace MWMechanics
else if(roll <= (static_cast<float>(slash) + static_cast<float>(thrust))/total)
movement.mPosition[1] = 1;
//else chop
}
}
}

View File

@ -45,10 +45,6 @@ namespace MWMechanics
void buildNewPath(const MWWorld::Ptr& actor);
};
static void determineAttackType(const MWWorld::Ptr& actor, MWMechanics::Movement &movement);
//chooses an attack depending on probability to avoid uniformity
static void chooseBestAttack(const ESM::Weapon* weapon, MWMechanics::Movement &movement);
}
#endif