|
|
|
@ -1,42 +1,33 @@
|
|
|
|
|
#include "aitravel.hpp"
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
#include "character.hpp"
|
|
|
|
|
#include "movement.hpp"
|
|
|
|
|
|
|
|
|
|
#include "../mwworld/class.hpp"
|
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
|
#include "movement.hpp"
|
|
|
|
|
#include "../mwworld/player.hpp"
|
|
|
|
|
|
|
|
|
|
#include <boost/graph/astar_search.hpp>
|
|
|
|
|
#include <boost/graph/adjacency_list.hpp>
|
|
|
|
|
#include "boost/tuple/tuple.hpp"
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
float sgn(float a)
|
|
|
|
|
{
|
|
|
|
|
if(a>0) return 1.;
|
|
|
|
|
if(a > 0) return 1.;
|
|
|
|
|
else return -1.;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace MWMechanics
|
|
|
|
|
MWMechanics::AiTravel::AiTravel(float x, float y, float z)
|
|
|
|
|
: mX(x),mY(y),mZ(z),mPathFinder()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AiTravel::AiTravel(float x, float y, float z)
|
|
|
|
|
: mX(x),mY(y),mZ(z),mPathFinder()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AiTravel * AiTravel::clone() const
|
|
|
|
|
{
|
|
|
|
|
MWMechanics::AiTravel *MWMechanics::AiTravel::clone() const
|
|
|
|
|
{
|
|
|
|
|
return new AiTravel(*this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AiTravel::execute (const MWWorld::Ptr& actor)
|
|
|
|
|
{
|
|
|
|
|
bool MWMechanics::AiTravel::execute (const MWWorld::Ptr& actor)
|
|
|
|
|
{
|
|
|
|
|
const ESM::Pathgrid *pathgrid =
|
|
|
|
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*actor.getCell()->mCell);
|
|
|
|
|
|
|
|
|
@ -89,6 +80,7 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
mPathFinder.buildPath(start,dest,pathgrid,xCell,yCell);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(mPathFinder.checkIfNextPointReached(pos.pos[0],pos.pos[1],pos.pos[2]))
|
|
|
|
|
{
|
|
|
|
|
MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 0;
|
|
|
|
@ -100,11 +92,9 @@ namespace MWMechanics
|
|
|
|
|
MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 1;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AiTravel::getTypeId() const
|
|
|
|
|
{
|
|
|
|
|
int MWMechanics::AiTravel::getTypeId() const
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|