1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 12:54:00 +00:00

AiEscortCell complains if no cell was given or cell does not exist

This commit is contained in:
scrawl 2015-12-06 23:40:03 +01:00
parent 965bea45c0
commit 65b5cbe3f7

View File

@ -1,5 +1,8 @@
#include "aiextensions.hpp"
#include <stdexcept>
#include <iostream>
#include <components/compiler/extensions.hpp>
#include <components/compiler/opcodes.hpp>
@ -8,6 +11,7 @@
#include <components/interpreter/opcodes.hpp>
#include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/aiactivate.hpp"
@ -18,13 +22,11 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "interpretercontext.hpp"
#include "ref.hpp"
#include <iostream>
#include "../mwbase/mechanicsmanager.hpp"
namespace MWScript
{
@ -144,6 +146,11 @@ namespace MWScript
// discard additional arguments (reset), because we have no idea what they mean.
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
if (cellID.empty())
throw std::runtime_error("AiEscortCell: no cell ID given");
MWBase::Environment::get().getWorld()->getStore().get<ESM::Cell>().find(cellID);
MWMechanics::AiEscort escortPackage(actorID, cellID, static_cast<int>(duration), x, y, z);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(escortPackage, ptr);