From ee91c1097bf7e6d2ec0fdb0706f21214a403238c Mon Sep 17 00:00:00 2001 From: wvpm <24685035+wvpm@users.noreply.github.com> Date: Mon, 11 May 2026 17:02:00 +0200 Subject: [PATCH] Use format for decimals --- src/headless/main.cpp | 30 +++++++++---------- .../military/UnitInstanceGroup.cpp | 6 ++-- src/openvic-simulation/misc/GameAction.cpp | 4 +-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/headless/main.cpp b/src/headless/main.cpp index e0c079a12..1c1114576 100644 --- a/src/headless/main.cpp +++ b/src/headless/main.cpp @@ -72,18 +72,18 @@ static void print_rgo(ProvinceInstance const& province) { SPDLOG_INFO( "\tgood: {}, " "production_type: {}, " - "size_multiplier: {}, " - "output_quantity_yesterday: {}, " - "revenue_yesterday: {}, " - "total owner income: {}, " - "total employee income: {}", + "size_multiplier: {:.3}, " + "output_quantity_yesterday: {:.3}, " + "revenue_yesterday: {:.3}, " + "total owner income: {:.3}, " + "total employee income: {:.3}", production_type.output_good, // production_type, // - rgo.get_size_multiplier().to_string(3), // - rgo.get_output_quantity_yesterday().to_string(3), // - rgo.get_revenue_yesterday().to_string(3), // - rgo.get_total_owner_income_cache().to_string(3), // - rgo.get_total_employee_income_cache().to_string(3) + rgo.get_size_multiplier(), // + rgo.get_output_quantity_yesterday(), // + rgo.get_revenue_yesterday(), // + rgo.get_total_owner_income_cache(), // + rgo.get_total_employee_income_cache() ); bool logged_employees = false; @@ -264,12 +264,12 @@ static bool run_headless(fs::path const& root, memory::vector& m memory::string countries_str; for (CountryInstance& country : countries) { countries_str += fmt::format( - "\n\t{} - Total #{} ({}), Prestige #{} ({}), Industry #{} ({}), Military #{} ({})", // + "\n\t{} - Total #{} ({:.1}), Prestige #{} ({:.1}), Industry #{} ({:.1}), Military #{} ({:.1})", // country, // - country.get_total_rank(), country.total_score.get_untracked().to_string(1), // - country.get_prestige_rank(), country.get_prestige_untracked().to_string(1), - country.get_industrial_rank(), country.get_industrial_power_untracked().to_string(1), - country.get_military_rank(), country.military_power.get_untracked().to_string(1) + country.get_total_rank(), country.total_score.get_untracked(), // + country.get_prestige_rank(), country.get_prestige_untracked(), + country.get_industrial_rank(), country.get_industrial_power_untracked(), + country.get_military_rank(), country.military_power.get_untracked() ); } SPDLOG_INFO("{}:{}", title, countries_str); diff --git a/src/openvic-simulation/military/UnitInstanceGroup.cpp b/src/openvic-simulation/military/UnitInstanceGroup.cpp index 6bb28d70f..c649a633e 100644 --- a/src/openvic-simulation/military/UnitInstanceGroup.cpp +++ b/src/openvic-simulation/military/UnitInstanceGroup.cpp @@ -513,11 +513,11 @@ bool UnitInstanceManager::create_leader( const fixed_point_t leader_creation_cost = military_defines.get_leader_recruit_cost(); if (country.get_leadership_point_stockpile() < leader_creation_cost) { spdlog::error_s( - "Country \"{}\" does not have enough leadership points ({}) to create a {} (cost: {})", + "Country \"{}\" does not have enough leadership points ({:.2}) to create a {} (cost: {:.2})", country, - country.get_leadership_point_stockpile().to_string(2), + country.get_leadership_point_stockpile(), get_branched_leader_name(branch), - leader_creation_cost.to_string(2) + leader_creation_cost ); return false; } diff --git a/src/openvic-simulation/misc/GameAction.cpp b/src/openvic-simulation/misc/GameAction.cpp index 87dbca5b0..01d146802 100644 --- a/src/openvic-simulation/misc/GameAction.cpp +++ b/src/openvic-simulation/misc/GameAction.cpp @@ -309,8 +309,8 @@ bool GameActionManager::VariantVisitor::operator() (create_leader_argument_t con if (country->get_create_leader_count() < 1) { spdlog::error_s( - "GAME_ACTION_CREATE_LEADER called for country \"{}\" without enough leadership points ({}) to create any leaders!", - *country, country->get_leadership_point_stockpile().to_string(2) + "GAME_ACTION_CREATE_LEADER called for country \"{}\" without enough leadership points ({:.2}) to create any leaders!", + *country, country->get_leadership_point_stockpile() ); return false; }