11#include " replay_game.hpp"
22#include " ../single_player_game/game_over.hpp"
33#include " ../single_player_game/pause.hpp"
4+ #include " game/layout.hpp"
45#include " helper/constants.hpp"
56#include " helper/graphic_utils.hpp"
67#include " helper/music_utils.hpp"
@@ -21,21 +22,7 @@ namespace scenes {
2122 auto [parameters, information] = input::get_game_parameters_for_replay (service_provider, recording_path);
2223
2324
24- std::vector<ui::Layout> layouts{};
25- layouts.reserve (parameters.size ());
26-
27- if (parameters.empty ()) {
28- throw std::runtime_error (" An empty recording file isn't supported" );
29- } else if (parameters.size () == 1 ) { // NOLINT(readability-else-after-return,llvm-else-after-return)
30- layouts.push_back (ui::RelativeLayout{ layout, 0.02 , 0.01 , 0.96 , 0.98 });
31- } else if (parameters.size () == 2 ) {
32- layouts.push_back (ui::RelativeLayout{ layout, 0.02 , 0.01 , 0.46 , 0.98 });
33- layouts.push_back (ui::RelativeLayout{ layout, 0.52 , 0.01 , 0.46 , 0.98 });
34- } else {
35-
36- // TODO(Totto): support bigger layouts than just 2
37- throw std::runtime_error (" At the moment only replays from up to two players are supported" );
38- }
25+ std::vector<ui::Layout> layouts = game::get_layouts_for (parameters.size (), layout);
3926
4027 u32 simulation_frequency = constants::simulation_frequency;
4128 if (const auto stored_simulation_frequency = information.get_if <u32 >(" simulation_frequency" );
0 commit comments