1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 15:15:31 +00:00

Alert the user if trying to play a non-idle animation

Continue to propagate success/failure up the call stack.
This commit is contained in:
Arthur Moore 2015-07-30 08:08:58 -04:00
parent 5e6fcc2aef
commit f69de1f263
2 changed files with 12 additions and 3 deletions

View file

@ -1,6 +1,7 @@
#include "aiwander.hpp"
#include <cfloat>
#include <iostream>
#include <components/misc/rng.hpp>
@ -621,12 +622,17 @@ namespace MWMechanics
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
}
void AiWander::playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect)
bool AiWander::playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect)
{
if ((GroupIndex_MinIdle <= idleSelect) && (idleSelect <= GroupIndex_MaxIdle))
{
const std::string& groupName = sIdleSelectToGroupName[idleSelect - GroupIndex_MinIdle];
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(actor, groupName, 0, 1);
return MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(actor, groupName, 0, 1);
}
else
{
std::cerr<< "Attempted to play out of range idle animation \""<<idleSelect<<"\" for " << actor.getCellRef().getRefId() << std::endl;
return false;
}
}

View file

@ -75,7 +75,10 @@ namespace MWMechanics
void init();
void stopWalking(const MWWorld::Ptr& actor, AiWanderStorage& storage);
void playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect);
///Have the given actor play an idle animation
///@return Success or error
bool playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect);
bool checkIdle(const MWWorld::Ptr& actor, unsigned short idleSelect);
short unsigned getRandomIdle();
void setPathToAnAllowedNode(const MWWorld::Ptr& actor, AiWanderStorage& storage, const ESM::Position& actorPos);