2017-07-19 19:54:26 -07:00
|
|
|
#include "../common/seperator.h"
|
|
|
|
|
#include "client.h"
|
2017-07-18 00:01:59 -07:00
|
|
|
#include "pathfinder_null.h"
|
|
|
|
|
#include "pathfinder_nav_mesh.h"
|
|
|
|
|
#include "pathfinder_waypoint.h"
|
2017-07-19 19:54:26 -07:00
|
|
|
#include <fmt/format.h>
|
|
|
|
|
#include <sys/stat.h>
|
2017-07-18 00:01:59 -07:00
|
|
|
|
|
|
|
|
IPathfinder *IPathfinder::Load(const std::string &zone) {
|
2017-07-19 19:54:26 -07:00
|
|
|
struct stat statbuffer;
|
2018-05-10 04:19:43 -05:00
|
|
|
std::string navmesh_path = fmt::format("maps/nav/{0}.nav", zone);
|
2017-07-29 00:11:57 -07:00
|
|
|
if (stat(navmesh_path.c_str(), &statbuffer) == 0) {
|
|
|
|
|
return new PathfinderNavmesh(navmesh_path);
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-18 00:01:59 -07:00
|
|
|
return new PathfinderNull();
|
2017-07-19 19:54:26 -07:00
|
|
|
}
|