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

Merge remote-tracking branch 'torben/aitravelcleanup'

This commit is contained in:
Marc Zinnschlag 2013-05-25 12:35:00 +02:00
commit 81cd1c6e30
2 changed files with 70 additions and 82 deletions

View file

@ -1,18 +1,12 @@
#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)
@ -22,20 +16,17 @@ namespace
}
}
namespace MWMechanics
{
AiTravel::AiTravel(float x, float y, float z)
MWMechanics::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;
@ -102,9 +94,7 @@ namespace MWMechanics
return false;
}
int AiTravel::getTypeId() const
int MWMechanics::AiTravel::getTypeId() const
{
return 1;
}
}

View file

@ -2,6 +2,7 @@
#define GAME_MWMECHANICS_AITRAVEL_H
#include "aipackage.hpp"
#include "pathfinding.hpp"
namespace MWMechanics
@ -25,10 +26,7 @@ namespace MWMechanics
int cellX;
int cellY;
//bool isPathConstructed;
//std::list<ESM::Pathgrid::Point> mPath;
PathFinder mPathFinder;
};
}