@@ -49,7 +49,7 @@ static const std::array moraleStringColor
49
49
};
50
50
51
51
52
- PopulationPanel::PopulationPanel () :
52
+ PopulationPanel::PopulationPanel (const Population& pop, const PopulationPool& popPool ) :
53
53
mFont{fontCache.load (constants::FONT_PRIMARY, constants::FontPrimaryNormal)},
54
54
mFontBold {fontCache.load (constants::FONT_PRIMARY_BOLD, constants::FontPrimaryNormal)},
55
55
mIcons {imageCache.load (" ui/icons.png" )},
@@ -64,7 +64,9 @@ PopulationPanel::PopulationPanel() :
64
64
imageCache.load (" ui/skin/window_bottom_left.png" ),
65
65
imageCache.load (" ui/skin/window_bottom_middle.png" ),
66
66
imageCache.load (" ui/skin/window_bottom_right.png" )
67
- }
67
+ },
68
+ mPopulation (pop),
69
+ mPopulationPool(popPool)
68
70
{
69
71
constexpr int linesOfText = 16 ;
70
72
constexpr int edgeBuffer = constants::Margin * 2 ;
@@ -89,16 +91,6 @@ PopulationPanel::PopulationPanel() :
89
91
size ({windowWidth, windowHeight});
90
92
}
91
93
92
- void PopulationPanel::population (Population* pop)
93
- {
94
- mPopulation = pop;
95
- }
96
-
97
- void PopulationPanel::populationPool (PopulationPool* popPool)
98
- {
99
- mPopulationPool = popPool;
100
- }
101
-
102
94
void PopulationPanel::addMoraleReason (const std::string& str, int val)
103
95
{
104
96
if (val == 0 ) { return ; }
@@ -118,7 +110,7 @@ void PopulationPanel::update()
118
110
119
111
// POPULATION Statistics
120
112
renderer.drawText (mFontBold , constants::PopulationBreakdown, position);
121
- const auto & population = mPopulation -> getPopulations ();
113
+ const auto & population = mPopulation . getPopulations ();
122
114
const std::array populationData
123
115
{
124
116
std::tuple{NAS2D::Rectangle<int >{{0 , 96 }, {IconSize, IconSize}}, population.child , std::string (" Children" )},
@@ -149,8 +141,8 @@ void PopulationPanel::update()
149
141
position.y += constants::Margin;
150
142
151
143
const std::array populationAvailablitiyStatistics{
152
- std::tuple{" Available Workers: " , mPopulationPool -> availableWorkers ()},
153
- std::tuple{" Available Scientists: " , mPopulationPool -> availableScientists ()},
144
+ std::tuple{" Available Workers: " , mPopulationPool . availableWorkers ()},
145
+ std::tuple{" Available Scientists: " , mPopulationPool . availableScientists ()},
154
146
};
155
147
156
148
for (const auto & [statisticLabel, personCount] : populationAvailablitiyStatistics)
0 commit comments