2020#include " openvic-simulation/modifier/ModifierEffectCache.hpp"
2121#include " openvic-simulation/pop/PopValuesFromProvince.hpp"
2222#include " openvic-simulation/types/fixed_point/FixedPoint.hpp"
23+ #include " openvic-simulation/utility/Logger.hpp"
2324#include " openvic-simulation/utility/Utility.hpp"
2425
2526using namespace OpenVic ;
@@ -108,7 +109,6 @@ void Pop::setup_pop_test_values(IssueManager const& issue_manager) {
108109 return (rand () % 256 ) * max / 256 ;
109110 };
110111
111- unemployment = test_range ();
112112 cash = test_range (20 );
113113 income = test_range (5 );
114114 expenses = test_range (5 );
@@ -353,6 +353,7 @@ void Pop::pop_tick_without_cleanup(PopValuesFromProvince& shared_values) {
353353 DO_FOR_ALL_TYPES_OF_POP_EXPENSES (SET_TO_ZERO)
354354 #undef SET_TO_ZERO
355355 income = expenses = fixed_point_t::_0 ();
356+ employed = 0 ;
356357
357358 auto & [
358359 reusable_map_0,
@@ -543,6 +544,18 @@ void Pop::report_artisanal_produce(const fixed_point_t quantity) {
543544 artisanal_produce_left_to_sell = quantity;
544545}
545546
547+ void Pop::hire (pop_size_t count) {
548+ if (OV_unlikely (count <= 0 )) {
549+ Logger::warning (" Tried employing non-positive number of pops. " , count, " Context" , get_pop_context_text ().str ());
550+ }
551+ employed += count;
552+ if (OV_unlikely (employed > size)) {
553+ Logger::error (" Employed count became greater than pop size. " , employed, " Context" , get_pop_context_text ().str ());
554+ } else if (OV_unlikely (employed < 0 )) {
555+ Logger::error (" Employed count became negative. " , employed ," Context" , get_pop_context_text ().str ());
556+ }
557+ }
558+
546559#undef DO_FOR_ALL_TYPES_OF_POP_INCOME
547560#undef DO_FOR_ALL_TYPES_OF_POP_EXPENSES
548561#undef DO_FOR_ALL_NEED_CATEGORIES
0 commit comments