From 327d88925dc04fe70caa8af9362c63aacaf0b392 Mon Sep 17 00:00:00 2001 From: Angel Yankov Date: Sat, 14 Sep 2024 16:48:29 +0300 Subject: [PATCH 1/2] Update meson to default C++17. we need std::filesystem --- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index c7164df7..eadf9bdb 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,8 @@ project('2048', 'cpp', - default_options : ['cpp_std=c++14', 'warning_level=2']) + default_options : ['cpp_std=c++17', 'warning_level=2']) main_target_name = '2048' + sources = ['src/2048.cpp', 'src/gameboard.cpp', 'src/gameboard-graphics.cpp', 'src/game.cpp', 'src/game-input.cpp', 'src/game-graphics.cpp', 'src/game-pregamemenu.cpp', 'src/global.cpp', 'src/loadresource.cpp', 'src/menu.cpp', 'src/menu-graphics.cpp', 'src/saveresource.cpp', 'src/scores.cpp', 'src/scores-graphics.cpp', 'src/statistics.cpp', 'src/statistics-graphics.cpp', 'src/tile.cpp', 'src/tile-graphics.cpp'] hdrs = include_directories('src/headers') From 9018f4c69381dbda75f9265c05a6f2cfcd64910d Mon Sep 17 00:00:00 2001 From: Angel Yankov Date: Sat, 14 Sep 2024 23:06:06 +0300 Subject: [PATCH 2/2] Fix statistics and scores at game over. The returned Gameboard object was not being updated. --- src/game.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index 7206e61e..3cdc9795 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -463,10 +463,11 @@ GameBoard endlessGameLoop(ull currentBestScore, competition_mode_t cm, while (loop_again && ((mainmenustatus[FLAG_START_GAME] == true) || (mainmenustatus[FLAG_CONTINUE_GAME] == true))) { std::tie(loop_again, currentgamestatus) = soloGameLoop(currentgamestatus); } + auto properGameboard = std::get(currentgamestatus); DrawAlways(std::cout, DataSuppliment(currentgamestatus, drawEndGameLoopGraphics)); - return gb; + return properGameboard; } Scoreboard::Score make_finalscore_from_game_session(double duration,