1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-23 00:09:42 +00:00

ToggleAI: Report current status on toggle

This commit is contained in:
scrawl 2014-03-26 19:55:52 +01:00
parent 688415ce54
commit 793649c854
4 changed files with 10 additions and 4 deletions

View file

@ -156,7 +156,7 @@ namespace MWBase
/// paused we may want to do it manually (after equipping permanent enchantment)
virtual void updateMagicEffects (const MWWorld::Ptr& ptr) = 0;
virtual void toggleAI() = 0;
virtual bool toggleAI() = 0;
virtual bool isAIActive() = 0;
virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects) = 0;

View file

@ -750,9 +750,10 @@ namespace MWMechanics
mActors.updateMagicEffects(ptr);
}
void MechanicsManager::toggleAI()
bool MechanicsManager::toggleAI()
{
mAI = !mAI;
return mAI;
}
bool MechanicsManager::isAIActive()

View file

@ -137,7 +137,7 @@ namespace MWMechanics
virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor);
virtual void toggleAI();
virtual bool toggleAI();
virtual bool isAIActive();
virtual void playerLoaded();

View file

@ -464,7 +464,12 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
MWBase::Environment::get().getMechanicsManager()->toggleAI();
InterpreterContext& context
= static_cast<InterpreterContext&> (runtime.getContext());
bool enabled = MWBase::Environment::get().getMechanicsManager()->toggleAI();
context.report (enabled ? "AI -> On" : "AI -> Off");
}
};