Change map loading paths - maps/base/*.map - maps/water/*.wtr - maps/nav/*.nav

This commit is contained in:
Akkadius 2018-05-10 04:19:43 -05:00
parent 95043d637c
commit d504397593
4 changed files with 16 additions and 8 deletions

View File

@ -217,12 +217,13 @@ Map *Map::LoadMapFile(std::string file) {
else {
filename = Config->MapDir;
}
std::transform(file.begin(), file.end(), file.begin(), ::tolower);
filename += "/";
filename += "/base/";
filename += file;
filename += ".map";
Log(Logs::General, Logs::Status, "Attempting to load Map File :: '%s'", filename.c_str());
Log(Logs::General, Logs::Status, "Attempting to load Map File '%s'", filename.c_str());
auto m = new Map();
if (m->Load(filename)) {
@ -254,7 +255,7 @@ bool Map::Load(std::string filename)
}
if(version == 0x01000000) {
Log(Logs::General, Logs::Status, "Loaded V1 Map File :: '%s'", filename.c_str());
Log(Logs::General, Logs::Status, "Loaded V1 Map File '%s'", filename.c_str());
bool v = LoadV1(f);
fclose(f);
@ -265,7 +266,7 @@ bool Map::Load(std::string filename)
return v;
} else if(version == 0x02000000) {
Log(Logs::General, Logs::Status, "Loaded V2 Map File :: '%s'", filename.c_str());
Log(Logs::General, Logs::Status, "Loaded V2 Map File '%s'", filename.c_str());
bool v = LoadV2(f);
fclose(f);

View File

@ -9,7 +9,7 @@
IPathfinder *IPathfinder::Load(const std::string &zone) {
struct stat statbuffer;
std::string waypoint_path = fmt::format("maps/{0}.path", zone);
std::string navmesh_path = fmt::format("maps/{0}.nav", zone);
std::string navmesh_path = fmt::format("maps/nav/{0}.nav", zone);
if (stat(navmesh_path.c_str(), &statbuffer) == 0) {
return new PathfinderNavmesh(navmesh_path);
}

View File

@ -281,6 +281,8 @@ void PathfinderNavmesh::Load(const std::string &path)
m_impl->nav_mesh->addTile(data, data_size, DT_TILE_FREE_DATA, tile_ref, 0);
}
Log(Logs::General, Logs::Status, "Loaded Navmesh V%u file %s", version, path.c_str());
}
}

View File

@ -3,6 +3,7 @@
#include "water_map.h"
#include "water_map_v1.h"
#include "water_map_v2.h"
#include "../common/eqemu_logsys.h"
#include <algorithm>
#include <cctype>
@ -12,7 +13,7 @@
WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower);
std::string file_path = Config->MapDir + zone_name + std::string(".wtr");
std::string file_path = Config->MapDir + "water/" + zone_name + std::string(".wtr");
FILE *f = fopen(file_path.c_str(), "rb");
if(f) {
char magic[10];
@ -38,7 +39,9 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
delete wm;
wm = nullptr;
}
Log(Logs::General, Logs::Status, "Loaded Water Map V%u file %s", version, file_path.c_str());
fclose(f);
return wm;
} else if(version == 2) {
@ -47,7 +50,9 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
delete wm;
wm = nullptr;
}
Log(Logs::General, Logs::Status, "Loaded Water Map V%u file %s", version, file_path.c_str());
fclose(f);
return wm;
} else {