all launch types can reset story
This commit is contained in:
10
rsrc/dialogs/reset-story.xml
Normal file
10
rsrc/dialogs/reset-story.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
|
||||
<dialog defbtn='reset'>
|
||||
<button name='reset' type='regular' top='50' left='246'>Reset</button>
|
||||
<button name='keep' type='regular' top='50' left='180'>Keep</button>
|
||||
<pict type='dlog' num='19' top='8' left='8'/>
|
||||
<text top='3' left='50' width='254' height='45'>
|
||||
This party is already in the correct scenario. Reset story progress?
|
||||
</text>
|
||||
</dialog>
|
@@ -83,7 +83,7 @@ std::string scenario_temp_dir_name = "scenario";
|
||||
extern fs::path tempDir;
|
||||
std::vector<fs::path> extra_scen_dirs;
|
||||
boost::optional<std::string> scen_arg_path;
|
||||
bool scen_arg_restart = false;
|
||||
bool scen_arg_start = false;
|
||||
boost::optional<short> scen_arg_town, scen_arg_town_entrance;
|
||||
boost::optional<location> scen_arg_out_sec, scen_arg_loc;
|
||||
|
||||
@@ -313,7 +313,7 @@ static void process_args(int argc, char* argv[]) {
|
||||
// Loading and entering a scenario has to happen after other initialization steps,
|
||||
// so we just save these options for later.
|
||||
cli |= clara::Opt(scen_arg_path, "scen-path")["--scenario"]("Launch a scenario, with the default party if no party is loaded.");
|
||||
cli |= clara::Opt(scen_arg_restart)["--restart"]("Restart of the scenario if the party is already in it. (SDFs will be cleared.)");
|
||||
cli |= clara::Opt(scen_arg_start)["--start"]("Put the party at the starting location of the scenario.");
|
||||
cli |= clara::Opt(scen_arg_town, "town")["--town"]("Put the party in a town.");
|
||||
cli |= clara::Opt(cParseEntrance(scen_arg_town_entrance), "entrance")["--entrance"]("Put the party at a town entrance point.");
|
||||
cli |= clara::Opt(cParseLocation(scen_arg_out_sec), "x,y")["--out-sec"]("Put the party in an outdoor section.");
|
||||
@@ -386,6 +386,7 @@ static void process_args(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
static void handle_scenario_args() {
|
||||
bool resetting = false;
|
||||
if(scen_arg_path){
|
||||
fs::path path = *scen_arg_path;
|
||||
|
||||
@@ -402,8 +403,13 @@ static void handle_scenario_args() {
|
||||
start_new_game(true);
|
||||
}
|
||||
if(univ.party.is_in_scenario()){
|
||||
if(univ.scenario.scen_name == scenario.scen_name && !scen_arg_restart){
|
||||
// The party is already in the correct scenario and doesn't need to restart
|
||||
if(univ.scenario.scen_name == scenario.scen_name){
|
||||
// The party is already in the correct scenario.
|
||||
// Ask whether to clear SDFs or not
|
||||
if(cChoiceDlog("reset-story",{"reset","keep"}).show() == "reset"){
|
||||
resetting = true;
|
||||
handle_victory(true);
|
||||
}
|
||||
}else{
|
||||
// The party is in a different scenario.
|
||||
// TODO maybe the player should be warned before they're removed from it?
|
||||
@@ -483,6 +489,11 @@ static void handle_scenario_args() {
|
||||
std::cerr << "--x and --y are required when loading a scenario outdoors" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}else if(scen_arg_start){
|
||||
// If restarting the scenario completely, this isn't needed:
|
||||
if(!resetting){
|
||||
debug_return_to_start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -169,7 +169,7 @@ void launch_scenario(eLaunchType type) {
|
||||
return;
|
||||
}
|
||||
}else if(type == eLaunchType::START){
|
||||
args.push_back("--restart");
|
||||
args.push_back("--start");
|
||||
}
|
||||
|
||||
// allow specifying a debug party path as an editor preference
|
||||
|
Reference in New Issue
Block a user