GamepadManager::saveToFile() no guarda el nom del mando si no existeix
This commit is contained in:
@@ -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];
|
||||
// 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<int>(gamepad.player_id) << "\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user