diff options
author | rtk0c <[email protected]> | 2022-04-10 23:00:36 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-04-10 23:00:36 -0700 |
commit | 17d5b091c9b2901ac96f5eee0da6af07228ae690 (patch) | |
tree | c210229c4bee1d3f56a64eacf1f976dfd8f971a7 /source/Player.cpp | |
parent | a849c199d970e153580c312a24cfdfa099bc7b69 (diff) |
Changeset: 5 Add shader and corresponding editor components
Diffstat (limited to 'source/Player.cpp')
-rw-r--r-- | source/Player.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/Player.cpp b/source/Player.cpp index 2fa8d0d..47c3ccc 100644 --- a/source/Player.cpp +++ b/source/Player.cpp @@ -1,6 +1,7 @@ #include "Player.hpp" #include "AppConfig.hpp" +#include "ScopeGuard.hpp" #include "Utils.hpp" #include <cstdio> @@ -80,21 +81,21 @@ static FILE* OpenPlayerConfigFile(Player* player, Utils::IoMode mode) { bool Player::LoadFromFile() { auto file = OpenPlayerConfigFile(this, Utils::Read); if (!file) return false; + DEFER { fclose(file); }; // TODO input validation PLAYERKEYBINDS_DO_IO(fscanf, &); - fclose(file); return true; } bool Player::SaveToFile() { auto file = OpenPlayerConfigFile(this, Utils::WriteTruncate); if (!file) return false; + DEFER { fclose(file); }; PLAYERKEYBINDS_DO_IO(fprintf, ); - fclose(file); return true; } #pragma macro_pop("PLAYERKEYBINDS_DO_IO") |