Core/Maps: Restored DataDir functionality accidendally removed earlier

This commit is contained in:
Shauren
2015-05-09 00:10:56 +02:00
parent 347e954086
commit 7e801595f4
2 changed files with 7 additions and 7 deletions

View File

@@ -24,8 +24,8 @@
namespace MMAP
{
static char const* const MAP_FILE_NAME_FORMAT = "mmaps/%04i.mmap";
static char const* const TILE_FILE_NAME_FORMAT = "mmaps/%04i%02i%02i.mmtile";
static char const* const MAP_FILE_NAME_FORMAT = "%smmaps/%04i.mmap";
static char const* const TILE_FILE_NAME_FORMAT = "%smmaps/%04i%02i%02i.mmtile";
// ######################## MMapManager ########################
MMapManager::~MMapManager()
@@ -44,7 +44,7 @@ namespace MMAP
return true;
// load and init dtNavMesh - read parameters from file
std::string fileName = Trinity::StringFormat(MAP_FILE_NAME_FORMAT, mapId);
std::string fileName = Trinity::StringFormat(MAP_FILE_NAME_FORMAT, sWorld->GetDataPath().c_str(), mapId);
FILE* file = fopen(fileName.c_str(), "rb");
if (!file)
{
@@ -100,7 +100,7 @@ namespace MMAP
return false;
// load this tile :: mmaps/MMMMXXYY.mmtile
std::string fileName = Trinity::StringFormat(TILE_FILE_NAME_FORMAT, mapId, x, y);
std::string fileName = Trinity::StringFormat(TILE_FILE_NAME_FORMAT, sWorld->GetDataPath().c_str(), mapId, x, y);
FILE* file = fopen(fileName.c_str(), "rb");
if (!file)
{
@@ -161,7 +161,7 @@ namespace MMAP
PhasedTile* MMapManager::LoadTile(uint32 mapId, int32 x, int32 y)
{
// load this tile :: mmaps/MMMXXYY.mmtile
std::string fileName = Trinity::StringFormat(TILE_FILE_NAME_FORMAT, mapId, x, y);
std::string fileName = Trinity::StringFormat(TILE_FILE_NAME_FORMAT, sWorld->GetDataPath().c_str(), mapId, x, y);
FILE* file = fopen(fileName.c_str(), "rb");
if (!file)
{

View File

@@ -78,7 +78,7 @@ Map::~Map()
bool Map::ExistMap(uint32 mapid, int gx, int gy)
{
std::string fileName = Trinity::StringFormat("maps/%04u_%02u_%02u.map", mapid, gx, gy);
std::string fileName = Trinity::StringFormat("%smaps/%04u_%02u_%02u.map", sWorld->GetDataPath().c_str(), mapid, gx, gy);
bool ret = false;
FILE* file = fopen(fileName.c_str(), "rb");
@@ -187,7 +187,7 @@ void Map::LoadMap(int gx, int gy, bool reload)
}
// map file name
std::string fileName = Trinity::StringFormat("maps/%04u_%02u_%02u.map", GetId(), gx, gy);
std::string fileName = Trinity::StringFormat("%smaps/%04u_%02u_%02u.map", sWorld->GetDataPath().c_str(), GetId(), gx, gy);
TC_LOG_DEBUG("maps", "Loading map %s", fileName.c_str());
// loading data
GridMaps[gx][gy] = new GridMap();