Skip to content

Commit

Permalink
Add warning if attempting to keep world (#36107)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMooney authored and kevingranade committed Dec 23, 2019
1 parent 92a57de commit 1c67f59
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
45 changes: 29 additions & 16 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,22 +1173,35 @@ bool game::cleanup_at_end()
bool queryReset = false;

if( get_option<std::string>( "WORLD_END" ) == "query" ) {
uilist smenu;
smenu.allow_cancel = false;
smenu.addentry( 0, true, 'k', "%s", _( "Keep world" ) );
smenu.addentry( 1, true, 'r', "%s", _( "Reset world" ) );
smenu.addentry( 2, true, 'd', "%s", _( "Delete world" ) );
smenu.query();

switch( smenu.ret ) {
case 0:
break;
case 1:
queryReset = true;
break;
case 2:
queryDelete = true;
break;
bool decided = false;
std::string buffer = _( "Warning: NPC interactions and some other global flags "
"will not all reset when starting a new character in an "
"already-played world. This can lead to some strange "
"behavior.\n\n"
"Are you sure you wish to keep this world?"
);

while( !decided ) {
uilist smenu;
smenu.allow_cancel = false;
smenu.addentry( 0, true, 'r', "%s", _( "Reset world" ) );
smenu.addentry( 1, true, 'd', "%s", _( "Delete world" ) );
smenu.addentry( 2, true, 'k', "%s", _( "Keep world" ) );
smenu.query();

switch( smenu.ret ) {
case 0:
queryReset = true;
decided = true;
break;
case 1:
queryDelete = true;
decided = true;
break;
case 2:
decided = query_yn( buffer );
break;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1940,9 +1940,9 @@ void options_manager::add_options_world_default()

add( "WORLD_END", "world_default", translate_marker( "World end handling" ),
translate_marker( "Handling of game world when last character dies." ), {
{ "keep", translate_marker( "Keep" ) }, { "reset", translate_marker( "Reset" ) },
{ "delete", translate_marker( "Delete" ) }, { "query", translate_marker( "Query" ) }
}, "keep"
{ "reset", translate_marker( "Reset" ) }, { "delete", translate_marker( "Delete" ) },
{ "query", translate_marker( "Query" ) }, { "keep", translate_marker( "Keep" ) }
}, "reset"
);

mOptionsSort["world_default"]++;
Expand Down

0 comments on commit 1c67f59

Please sign in to comment.