Fix scenario editor launch from header.exs finding wrong scen

This commit is contained in:
2025-05-17 08:09:49 -05:00
parent 1e8be3a956
commit 0f79f6fc9f
2 changed files with 10 additions and 5 deletions

View File

@@ -503,6 +503,8 @@ static void handle_scenario_args() {
start_new_game(true); start_new_game(true);
} }
if(univ.party.is_in_scenario()){ if(univ.party.is_in_scenario()){
// This check is correct, because the scen_name field of cScenario is the actual title,
// not header.exs or *.boes as univ.party.scen_name would be
if(univ.scenario.scen_name == scenario.scen_name){ if(univ.scenario.scen_name == scenario.scen_name){
// The party is already in the correct scenario. // The party is already in the correct scenario.
// Ask whether to clear SDFs or not // Ask whether to clear SDFs or not
@@ -519,7 +521,7 @@ static void handle_scenario_args() {
resetting = true; resetting = true;
} }
if(!univ.party.is_in_scenario()){ if(!univ.party.is_in_scenario()){
put_party_in_scen(path.filename().string(), scen_arg_town || scen_arg_out_sec, true); put_party_in_scen(path.string(), scen_arg_town || scen_arg_out_sec, true);
} }
}else{ }else{
std::cerr << "Failed to load scenario: " << *scen_arg_path << std::endl; std::cerr << "Failed to load scenario: " << *scen_arg_path << std::endl;

View File

@@ -146,10 +146,13 @@ void put_party_in_scen(std::string scen_name, bool force, bool allow_unpacked) {
if(item_took) if(item_took)
cChoiceDlog("removed-special-items").show(); cChoiceDlog("removed-special-items").show();
fs::path path = locate_scenario(scen_name, allow_unpacked); fs::path path = scen_name;
if(path.empty()) { if(!path.is_absolute()){
showError("Could not find scenario!"); path = locate_scenario(scen_name, allow_unpacked);
return; if(path.empty()) {
showError("Could not find scenario!");
return;
}
} }
set_cursor(watch_curs); set_cursor(watch_curs);
if(!load_scenario(path, univ.scenario)) if(!load_scenario(path, univ.scenario))