From 5d00b67cace42eb87ba7f818fb5fccc30e9fd667 Mon Sep 17 00:00:00 2001
From: HampusM <hampus@hampusmat.com>
Date: Sun, 12 Jun 2022 15:00:52 +0200
Subject: refactor: move set section lengths to game

---
 src/game/game.cpp           | 18 ++++++++++++++++++
 src/game/status_manager.cpp |  9 ---------
 2 files changed, 18 insertions(+), 9 deletions(-)

(limited to 'src/game')

diff --git a/src/game/game.cpp b/src/game/game.cpp
index 4b63c5a..ad95bd4 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -49,6 +49,24 @@ void Game::on_start() noexcept
 	std::shared_ptr<IStatusLine> statusline =
 		_statusline_factory(Bounds({.width = scene_size.get_width(), .height = 1}));
 
+	const auto statusline_section_a_length = 5;
+	const auto statusline_section_b_length = 15;
+	const auto statusline_section_c_length = 15;
+	const auto statusline_section_d_length = 20;
+	const auto statusline_section_e_length = 25;
+	const auto statusline_section_f_length = 30;
+	const auto statusline_section_g_length = 30;
+	const auto statusline_section_h_length = 20;
+
+	statusline->set_section_length(StatusLineSection::A, statusline_section_a_length);
+	statusline->set_section_length(StatusLineSection::B, statusline_section_b_length);
+	statusline->set_section_length(StatusLineSection::C, statusline_section_c_length);
+	statusline->set_section_length(StatusLineSection::D, statusline_section_d_length);
+	statusline->set_section_length(StatusLineSection::E, statusline_section_e_length);
+	statusline->set_section_length(StatusLineSection::F, statusline_section_f_length);
+	statusline->set_section_length(StatusLineSection::G, statusline_section_g_length);
+	statusline->set_section_length(StatusLineSection::H, statusline_section_h_length);
+
 	_scene->register_component(statusline, Vector2({.x = 0, .y = 1}));
 
 	_status_manager->bind(statusline);
diff --git a/src/game/status_manager.cpp b/src/game/status_manager.cpp
index b30bd82..36add4c 100644
--- a/src/game/status_manager.cpp
+++ b/src/game/status_manager.cpp
@@ -7,15 +7,6 @@
 void StatusManager::bind(const std::shared_ptr<IStatusLine> &statusline) noexcept
 {
 	_statusline = statusline;
-
-	_statusline->set_section_length(StatusLineSection::A, 5);
-	_statusline->set_section_length(StatusLineSection::B, 15);
-	_statusline->set_section_length(StatusLineSection::C, 15);
-	_statusline->set_section_length(StatusLineSection::D, 20);
-	_statusline->set_section_length(StatusLineSection::E, 25);
-	_statusline->set_section_length(StatusLineSection::F, 30);
-	_statusline->set_section_length(StatusLineSection::G, 30);
-	_statusline->set_section_length(StatusLineSection::H, 20);
 }
 
 void StatusManager::set_section_title(
-- 
cgit v1.2.3-18-g5258