Options: afegida opció per a permetre apagar el sistema

This commit is contained in:
2025-06-12 20:11:07 +02:00
parent d2be756741
commit 6c707fa178
9 changed files with 27 additions and 12 deletions

View File

@@ -39,7 +39,8 @@ void initOptions()
options.game.difficulty = GameDifficulty::NORMAL;
options.game.language = lang::Code::VALENCIAN;
options.game.autofire = true;
options.game.clear_last_hi_score_entries();
options.game.shutdown_enabled = false;
options.game.clearLastHiScoreEntries();
// Opciones de control
options.controllers.clear();
@@ -155,6 +156,7 @@ bool saveOptionsFile(std::string file_path)
file << "game.language=" << static_cast<int>(options.game.language) << "\n";
file << "game.difficulty=" << static_cast<int>(options.game.difficulty) << "\n";
file << "game.autofire=" << boolToString(options.game.autofire) << "\n";
file << "game.shutdown_enabled=" << boolToString(options.game.shutdown_enabled) << "\n";
// Opciones de mandos
file << "\n\n## CONTROLLERS\n";
@@ -255,6 +257,10 @@ bool setOptions(const std::string &var, const std::string &value)
{
options.game.autofire = stringToBool(value);
}
else if (var == "game.shutdown_enabled")
{
options.game.shutdown_enabled = stringToBool(value);
}
// Opciones de mandos
else if (var == "controller.0.name")
@@ -379,10 +385,10 @@ int getPlayerWhoUsesKeyboard()
// Aplica los cambios pendientes copiando los valores a sus variables
void applyPendingChanges()
{
if (options.pending_changes.has_pending_changes)
{
options.game.language = options.pending_changes.new_language;
options.game.difficulty = options.pending_changes.new_difficulty;
options.pending_changes.has_pending_changes = false;
}
if (options.pending_changes.has_pending_changes)
{
options.game.language = options.pending_changes.new_language;
options.game.difficulty = options.pending_changes.new_difficulty;
options.pending_changes.has_pending_changes = false;
}
}