diff --git a/source/options.h b/source/options.h index 1c9422f..2628556 100644 --- a/source/options.h +++ b/source/options.h @@ -2,16 +2,16 @@ #include // Para SDL_ScaleMode -#include // Para copy -#include // Para array -#include // Para size_t -#include // Para exception -#include // Para basic_ostream, operator<<, basic_ofstream, basic_ostream::operator<<, ofstream -#include // Para shared_ptr, swap -#include // Para out_of_range, invalid_argument -#include // Para char_traits, string, allocator, operator==, swap, operator<<, basic_string, stoi -#include // Para string_view -#include // Para vector +#include // Para copy +#include // Para array +#include // Para size_t +#include // Para exception +#include // Para basic_ostream, operator<<, basic_ofstream, basic_ostream::operator<<, ofstream +#include // Para shared_ptr, swap +#include // Para out_of_range, invalid_argument +#include // Para char_traits, string, allocator, operator==, swap, operator<<, basic_string, stoi +#include // Para string_view +#include // Para vector #include "difficulty.h" // Para Code #include "input.h" // Para Input @@ -158,11 +158,15 @@ class GamepadManager { std::swap(gamepads_[0].path, gamepads_[1].path); } - // Para serialización/deserialización void saveToFile(std::ofstream& file) const { for (size_t i = 0; i < MAX_PLAYERS; ++i) { const auto& gamepad = gamepads_[i]; - file << "controller." << i << ".name=" << gamepad.name << "\n"; + // Guardar el nombre solo si hay path (mando real asignado) + if (!gamepad.path.empty()) { + file << "controller." << i << ".name=" << gamepad.name << "\n"; + } else { + file << "controller." << i << ".name=\n"; // vacío + } file << "controller." << i << ".path=" << gamepad.path << "\n"; file << "controller." << i << ".player=" << static_cast(gamepad.player_id) << "\n"; }