From ccd52b8b13fd44147092160a5f7bfc459a59aec9 Mon Sep 17 00:00:00 2001 From: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:33:57 -0500 Subject: [PATCH] Add game option which controls geography scaling --- data/core/game_balance.json | 7 +++ src/overmap.cpp | 92 +++++++++++++++++++------------------ 2 files changed, 55 insertions(+), 44 deletions(-) diff --git a/data/core/game_balance.json b/data/core/game_balance.json index 628d09254f79c..842e5f63f993f 100644 --- a/data/core/game_balance.json +++ b/data/core/game_balance.json @@ -300,6 +300,13 @@ "stype": "bool", "value": true }, + { + "type": "EXTERNAL_OPTION", + "name": "OVERMAP_GEOGRAPHY_CHANGE", + "info": "Controls whether or not density of forests and urban areas will be modified with distance from the 0,0 overmap. False disables this scaling completely.", + "stype": "bool", + "value": true + }, { "type": "EXTERNAL_OPTION", "name": "OVERMAP_FOREST_INCREASE_NORTH", diff --git a/src/overmap.cpp b/src/overmap.cpp index 7a130197f0c30..32581272a9279 100644 --- a/src/overmap.cpp +++ b/src/overmap.cpp @@ -5333,17 +5333,19 @@ void overmap::calculate_forestosity() float western_forest_increase = get_option( "OVERMAP_FOREST_INCREASE_WEST" ); float southern_forest_increase = get_option( "OVERMAP_FOREST_INCREASE_SOUTH" ); const point_abs_om this_om = pos(); - if( western_forest_increase != 0 && this_om.x() < 0 ) { - forest_size_adjust -= this_om.x() * western_forest_increase; - } - if( northern_forest_increase != 0 && this_om.y() < 0 ) { - forest_size_adjust -= this_om.y() * northern_forest_increase; - } - if( eastern_forest_increase != 0 && this_om.x() > 0 ) { - forest_size_adjust += this_om.x() * eastern_forest_increase; - } - if( southern_forest_increase != 0 && this_om.y() > 0 ) { - forest_size_adjust += this_om.y() * southern_forest_increase; + if( get_option( "OVERMAP_GEOGRAPHY_CHANGE" ) ) { + if( western_forest_increase != 0 && this_om.x() < 0 ) { + forest_size_adjust -= this_om.x() * western_forest_increase; + } + if( northern_forest_increase != 0 && this_om.y() < 0 ) { + forest_size_adjust -= this_om.y() * northern_forest_increase; + } + if( eastern_forest_increase != 0 && this_om.x() > 0 ) { + forest_size_adjust += this_om.x() * eastern_forest_increase; + } + if( southern_forest_increase != 0 && this_om.y() > 0 ) { + forest_size_adjust += this_om.y() * southern_forest_increase; + } } forestosity = forest_size_adjust * 25.0f; //debugmsg( "forestosity = %1.2f at OM %i, %i", forestosity, this_om.x(), this_om.y() ); @@ -5370,42 +5372,44 @@ void overmap::calculate_urbanity() float urbanity_adj = 0.0f; const point_abs_om this_om = pos(); - if( northern_urban_increase != 0 && this_om.y() < 0 ) { - urbanity_adj -= this_om.y() * northern_urban_increase / 10.0f; - // add some falloff to the sides, keeping cities larger but breaking up the megacity a bit. - // Doesn't apply if we expect megacity in those directions as well. - if( this_om.x() < 0 && western_urban_increase == 0 ) { - urbanity_adj /= std::max( this_om.x() / -2.0f, 1.0f ); - } - if( this_om.x() > 0 && eastern_urban_increase == 0 ) { - urbanity_adj /= std::max( this_om.x() / 2.0f, 1.0f ); - } - } - if( eastern_urban_increase != 0 && this_om.x() > 0 ) { - urbanity_adj += this_om.x() * eastern_urban_increase / 10.0f; - if( this_om.y() < 0 && northern_urban_increase == 0 ) { - urbanity_adj /= std::max( this_om.y() / -2.0f, 1.0f ); - } - if( this_om.y() > 0 && southern_urban_increase == 0 ) { - urbanity_adj /= std::max( this_om.y() / 2.0f, 1.0f ); - } - } - if( western_urban_increase != 0 && this_om.x() < 0 ) { - urbanity_adj -= this_om.x() * western_urban_increase / 10.0f; - if( this_om.y() < 0 && northern_urban_increase == 0 ) { - urbanity_adj /= std::max( this_om.y() / -2.0f, 1.0f ); + if( get_option( "OVERMAP_GEOGRAPHY_CHANGE" ) ) { + if( northern_urban_increase != 0 && this_om.y() < 0 ) { + urbanity_adj -= this_om.y() * northern_urban_increase / 10.0f; + // add some falloff to the sides, keeping cities larger but breaking up the megacity a bit. + // Doesn't apply if we expect megacity in those directions as well. + if( this_om.x() < 0 && western_urban_increase == 0 ) { + urbanity_adj /= std::max( this_om.x() / -2.0f, 1.0f ); + } + if( this_om.x() > 0 && eastern_urban_increase == 0 ) { + urbanity_adj /= std::max( this_om.x() / 2.0f, 1.0f ); + } } - if( this_om.y() > 0 && southern_urban_increase == 0 ) { - urbanity_adj /= std::max( this_om.y() / 2.0f, 1.0f ); + if( eastern_urban_increase != 0 && this_om.x() > 0 ) { + urbanity_adj += this_om.x() * eastern_urban_increase / 10.0f; + if( this_om.y() < 0 && northern_urban_increase == 0 ) { + urbanity_adj /= std::max( this_om.y() / -2.0f, 1.0f ); + } + if( this_om.y() > 0 && southern_urban_increase == 0 ) { + urbanity_adj /= std::max( this_om.y() / 2.0f, 1.0f ); + } } - } - if( southern_urban_increase != 0 && this_om.y() > 0 ) { - urbanity_adj += this_om.y() * southern_urban_increase / 10.0f; - if( this_om.x() < 0 && western_urban_increase == 0 ) { - urbanity_adj /= std::max( this_om.x() / -2.0f, 1.0f ); + if( western_urban_increase != 0 && this_om.x() < 0 ) { + urbanity_adj -= this_om.x() * western_urban_increase / 10.0f; + if( this_om.y() < 0 && northern_urban_increase == 0 ) { + urbanity_adj /= std::max( this_om.y() / -2.0f, 1.0f ); + } + if( this_om.y() > 0 && southern_urban_increase == 0 ) { + urbanity_adj /= std::max( this_om.y() / 2.0f, 1.0f ); + } } - if( this_om.x() > 0 && eastern_urban_increase == 0 ) { - urbanity_adj /= std::max( this_om.x() / 2.0f, 1.0f ); + if( southern_urban_increase != 0 && this_om.y() > 0 ) { + urbanity_adj += this_om.y() * southern_urban_increase / 10.0f; + if( this_om.x() < 0 && western_urban_increase == 0 ) { + urbanity_adj /= std::max( this_om.x() / -2.0f, 1.0f ); + } + if( this_om.x() > 0 && eastern_urban_increase == 0 ) { + urbanity_adj /= std::max( this_om.x() / 2.0f, 1.0f ); + } } } urbanity = static_cast( urbanity_adj );