Fix some issues with loading saved games
This commit is contained in:
@@ -282,6 +282,7 @@ bool load_party_v1(fs::path file_to_load, cUniverse& univ, bool town_restore, bo
|
||||
return true;
|
||||
}
|
||||
|
||||
extern fs::path scenDir;
|
||||
bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bool in_scen, bool maps_there){
|
||||
if(!fs::exists(tempDir)) fs::create_directories(tempDir);
|
||||
fs::path tempPath = tempDir/"loadtemp.exg";
|
||||
@@ -354,7 +355,9 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bo
|
||||
|
||||
if(in_scen) {
|
||||
fs::path path;
|
||||
path = progDir/"Blades of Exile Scenarios"/univ.party.scen_name;
|
||||
path = scenDir/univ.party.scen_name;
|
||||
if(!fs::exists(path))
|
||||
path = progDir/"Blades of Exile Scenarios"/univ.party.scen_name;
|
||||
|
||||
if(!load_scenario(path, univ.scenario))
|
||||
return false;
|
||||
|
@@ -64,14 +64,14 @@ bool load_scenario(fs::path file_to_load, cScenario& scenario, bool only_header)
|
||||
// Before loading a scenario, we may need to pop scenario resource paths.
|
||||
fs::path graphics_path = ResMgr::popPath<ImageRsrc>();
|
||||
for(auto p : graphics_path) {
|
||||
if(p.string() == "graphics") {
|
||||
if(p.string() == "data") {
|
||||
ResMgr::pushPath<ImageRsrc>(graphics_path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fs::path sounds_path = ResMgr::popPath<SoundRsrc>();
|
||||
for(auto p : sounds_path) {
|
||||
if(p.string() == "sounds") {
|
||||
if(p.string() == "data") {
|
||||
ResMgr::pushPath<SoundRsrc>(sounds_path);
|
||||
break;
|
||||
}
|
||||
@@ -80,7 +80,10 @@ bool load_scenario(fs::path file_to_load, cScenario& scenario, bool only_header)
|
||||
std::string fname = file_to_load.filename().string();
|
||||
std::transform(fname.begin(), fname.end(), fname.begin(), tolower);
|
||||
size_t dot = fname.find_last_of('.');
|
||||
try {
|
||||
if(dot == std::string::npos) {
|
||||
showError("That is not a Blades of Exile scenario.");
|
||||
return false;
|
||||
} else try {
|
||||
if(fname.substr(dot) == ".boes")
|
||||
return load_scenario_v2(file_to_load, scenario, only_header);
|
||||
else if(fname.substr(dot) == ".exs")
|
||||
|
Reference in New Issue
Block a user