1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 23:23:52 +00:00

AITravel Cleanup - Removed unnecessary includes and other varius cleanups.

This commit is contained in:
Torben Carrington 2013-05-24 18:16:35 -07:00
parent b1a8dc35e0
commit 56b1384c90
2 changed files with 70 additions and 82 deletions

View file

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

View file

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