Codechange: use setting name instead of index for HandleOldDiffCustom() (#9311)
This commit is contained in:
		@@ -15,6 +15,7 @@
 | 
			
		||||
 | 
			
		||||
[pre-amble]
 | 
			
		||||
static const uint GAME_DIFFICULTY_NUM = 18;
 | 
			
		||||
static const std::array<std::string, GAME_DIFFICULTY_NUM> _old_diff_settings{"max_no_competitors", "competitor_start_time", "number_towns", "industry_density", "max_loan", "initial_interest", "vehicle_costs", "competitor_speed", "competitor_intelligence", "vehicle_breakdowns", "subsidy_multiplier", "construction_cost", "terrain_type", "quantity_sea_lakes", "economy", "line_reverse_mode", "disasters", "town_council_tolerance"};
 | 
			
		||||
static uint16 _old_diff_custom[GAME_DIFFICULTY_NUM];
 | 
			
		||||
uint8 _old_diff_level;                                 ///< Old difficulty level from old savegames
 | 
			
		||||
uint8 _old_units;                                      ///< Old units from old savegames
 | 
			
		||||
 
 | 
			
		||||
@@ -94,7 +94,7 @@ startup  = false
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
; Saved settings variables.
 | 
			
		||||
; Do not ADD or REMOVE something in this "difficulty.XXX" table or before it. It breaks savegame compatibility.
 | 
			
		||||
; The next 18 entries are important for savegame compatibility. Do NOT remove those. See HandleOldDiffCustom() for more details.
 | 
			
		||||
[SDT_VAR]
 | 
			
		||||
var      = difficulty.max_no_competitors
 | 
			
		||||
type     = SLE_UINT8
 | 
			
		||||
@@ -106,10 +106,14 @@ interval = 1
 | 
			
		||||
post_cb  = MaxNoAIsChange
 | 
			
		||||
cat      = SC_BASIC
 | 
			
		||||
 | 
			
		||||
[SDT_NULL]
 | 
			
		||||
length   = 1
 | 
			
		||||
[SDT_VAR]
 | 
			
		||||
var      = difficulty.competitor_start_time
 | 
			
		||||
type     = SLE_UINT8
 | 
			
		||||
from     = SLV_97
 | 
			
		||||
to       = SLV_110
 | 
			
		||||
def      = 2
 | 
			
		||||
min      = 0
 | 
			
		||||
max      = 3
 | 
			
		||||
 | 
			
		||||
[SDT_VAR]
 | 
			
		||||
var      = difficulty.number_towns
 | 
			
		||||
@@ -192,10 +196,14 @@ strhelp  = STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT
 | 
			
		||||
strval   = STR_AI_SPEED_VERY_SLOW
 | 
			
		||||
cat      = SC_BASIC
 | 
			
		||||
 | 
			
		||||
[SDT_NULL]
 | 
			
		||||
length   = 1
 | 
			
		||||
[SDT_VAR]
 | 
			
		||||
var      = difficulty.competitor_intelligence
 | 
			
		||||
type     = SLE_UINT8
 | 
			
		||||
from     = SLV_97
 | 
			
		||||
to       = SLV_110
 | 
			
		||||
def      = 0
 | 
			
		||||
min      = 0
 | 
			
		||||
max      = 2
 | 
			
		||||
 | 
			
		||||
[SDT_VAR]
 | 
			
		||||
var      = difficulty.vehicle_breakdowns
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user