mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 07:21:48 +00:00
Fix map loading logic so that case sensitive checks are made in the following order: maps, Maps, and if neither of those two exist, then <maps> value would take precedence.
- Added some log messages for what version of map is being loaded versus MMF
This commit is contained in:
parent
b3842ba72a
commit
e7e379c71b
21
zone/map.cpp
21
zone/map.cpp
@ -268,8 +268,23 @@ bool Map::CheckLoS(glm::vec3 myloc, glm::vec3 oloc) const {
|
|||||||
return !imp->rm->raycast((const RmReal*)&myloc, (const RmReal*)&oloc, nullptr, nullptr, nullptr);
|
return !imp->rm->raycast((const RmReal*)&myloc, (const RmReal*)&oloc, nullptr, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool file_exists(const std::string& name) {
|
||||||
|
std::ifstream f(name.c_str());
|
||||||
|
return f.good();
|
||||||
|
}
|
||||||
|
|
||||||
Map *Map::LoadMapFile(std::string file) {
|
Map *Map::LoadMapFile(std::string file) {
|
||||||
std::string filename = Config->MapDir;
|
|
||||||
|
std::string filename = "";
|
||||||
|
if (file_exists("maps")) {
|
||||||
|
filename = "maps";
|
||||||
|
}
|
||||||
|
else if (file_exists("Maps")) {
|
||||||
|
filename = "Maps";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
filename = Config->MapDir;
|
||||||
|
}
|
||||||
std::transform(file.begin(), file.end(), file.begin(), ::tolower);
|
std::transform(file.begin(), file.end(), file.begin(), ::tolower);
|
||||||
filename += file;
|
filename += file;
|
||||||
filename += ".map";
|
filename += ".map";
|
||||||
@ -287,7 +302,7 @@ Map *Map::LoadMapFile(std::string file) {
|
|||||||
bool Map::Load(std::string filename, bool force_mmf_overwrite)
|
bool Map::Load(std::string filename, bool force_mmf_overwrite)
|
||||||
{
|
{
|
||||||
if (LoadMMF(filename, force_mmf_overwrite)) {
|
if (LoadMMF(filename, force_mmf_overwrite)) {
|
||||||
Log.Out(Logs::General, Logs::Zone_Server, "Zone map mmf found - using it in lieu of '%s'", filename.c_str());
|
Log.Out(Logs::General, Logs::Zone_Server, "Loaded .MMF Map File in place of '%s'", filename.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -304,6 +319,7 @@ bool Map::Load(std::string filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(version == 0x01000000) {
|
if(version == 0x01000000) {
|
||||||
|
Log.Out(Logs::General, Logs::Zone_Server, "Loaded V1 Map File :: '%s'", filename.c_str());
|
||||||
bool v = LoadV1(f);
|
bool v = LoadV1(f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
@ -314,6 +330,7 @@ bool Map::Load(std::string filename)
|
|||||||
|
|
||||||
return v;
|
return v;
|
||||||
} else if(version == 0x02000000) {
|
} else if(version == 0x02000000) {
|
||||||
|
Log.Out(Logs::General, Logs::Zone_Server, "Loaded V2 Map File :: '%s'", filename.c_str());
|
||||||
bool v = LoadV2(f);
|
bool v = LoadV2(f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user