From 873229df9f38ff19eb23018fd522bb313e511085 Mon Sep 17 00:00:00 2001 From: wvpm <24685035+wvpm@users.noreply.github.com> Date: Sun, 22 Sep 2024 20:44:08 +0200 Subject: Refactored RGO into part of ProvinceInstance --- src/headless/main.cpp | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'src/headless') diff --git a/src/headless/main.cpp b/src/headless/main.cpp index 85c0ce2..3c9fc8b 100644 --- a/src/headless/main.cpp +++ b/src/headless/main.cpp @@ -26,37 +26,32 @@ static void print_help(std::ostream& stream, char const* program_name) { } static void print_rgo(ProvinceInstance const& province) { - ResourceGatheringOperation const* const rgo = province.get_rgo(); - if(rgo == nullptr) { - Logger::info("\n ", province.get_identifier(), " - rgo: nullptr"); + ResourceGatheringOperation const& rgo = province.get_rgo(); + ProductionType const* const production_type = rgo.get_production_type(); + if (production_type == nullptr) { + Logger::error( + "\n ", province.get_identifier(), + " - production_type: nullptr" + ); } else { - ProductionType const* const production_type = rgo->get_production_type(); - if (production_type == nullptr) { + GoodDefinition const* const output_good = production_type->get_output_good(); + if(output_good == nullptr) { Logger::error( "\n ", province.get_identifier(), - " - production_type: nullptr" + " - good: nullptr", + ", production_type: ", production_type->get_identifier() ); } else { - GoodDefinition const* const output_good = production_type->get_output_good(); - if(output_good == nullptr) { - Logger::error( - "\n ", province.get_identifier(), - " - good: nullptr", - ", production_type: ", production_type->get_identifier() - ); - } - else { - Logger::info( - "\n ", province.get_identifier(), - " - good: ", output_good->get_identifier(), - ", production_type: ", production_type->get_identifier(), - ", size_multiplier: ", rgo->get_size_multiplier().to_string(3), - ", output_quantity_yesterday: ", rgo->get_output_quantity_yesterday().to_string(3), - ", revenue_yesterday: ", rgo->get_revenue_yesterday().to_string(3) - ); - } + Logger::info( + "\n ", province.get_identifier(), + " - good: ", output_good->get_identifier(), + ", production_type: ", production_type->get_identifier(), + ", size_multiplier: ", rgo.get_size_multiplier().to_string(3), + ", output_quantity_yesterday: ", rgo.get_output_quantity_yesterday().to_string(3), + ", revenue_yesterday: ", rgo.get_revenue_yesterday().to_string(3) + ); } } } -- cgit v1.2.3-56-ga3b1