Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to prevent save scum on death #39798

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,16 @@ bool game::cleanup_at_end()
int iNameLine = 0;
int iInfoLine = 0;

bool bPreventSaveScum = get_option<bool>( "PREVENT_SAVE_SCUM" );
std::vector<std::string> characters = list_active_characters();
std::vector<std::string>::iterator curchar = std::find( characters.begin(),
characters.end(), u.name );

if( curchar != characters.end() && bPreventSaveScum == true ) {
characters.erase( curchar );
move_save_to_graveyard();
}

if( u.has_amount( "holybook_bible1", 1 ) || u.has_amount( "holybook_bible2", 1 ) ||
u.has_amount( "holybook_bible3", 1 ) ) {
if( !( u.has_trait( trait_id( "CANNIBAL" ) ) || u.has_trait( trait_id( "PSYCHOPATH" ) ) ) ) {
Expand Down Expand Up @@ -1234,14 +1244,15 @@ bool game::cleanup_at_end()
const bool is_suicide = uquit == QUIT_SUICIDE;
events().send<event_type::game_over>( is_suicide, sLastWords );
// Struck the save_player_data here to forestall Weirdness
move_save_to_graveyard();
if( bPreventSaveScum == false ) {
move_save_to_graveyard();
}

write_memorial_file( sLastWords );
memorial().clear();
std::vector<std::string> characters = list_active_characters();

// remove current player from the active characters list, as they are dead
std::vector<std::string>::iterator curchar = std::find( characters.begin(),
characters.end(), u.name );
if( curchar != characters.end() ) {
if( curchar != characters.end() && bPreventSaveScum == false ) {
characters.erase( curchar );
}

Expand Down
7 changes: 7 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,13 @@ void options_manager::add_options_general()

add_empty_line();

add( "PREVENT_SAVE_SCUM", "general", translate_marker( "Delete character before memorial" ),
translate_marker( "If true, your character will be deleted before the memorial appears. Turn this on if you want to enforce permadeath." ),
false
);

add_empty_line();

add( "AUTOSAVE", "general", translate_marker( "Autosave" ),
translate_marker( "If true, game will periodically save the map. Autosaves occur based on in-game turns or real-time minutes, whichever is larger." ),
true
Expand Down