Skip to content

Commit 7a8a027

Browse files
authored
Implement new region settings (#83033)
* set default region external options * remove highways in aftershock, isolation-protocol neither mod should have them, aftershock because of intersection generation over ravines * region settings c++: replace old classes/structs with new * add finalization for weather_generator
1 parent 3181775 commit 7a8a027

29 files changed

+318
-210
lines changed

data/mods/Backrooms/modinfo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,11 @@
1010
"conflicts": [ "desertpack", "tropicata" ],
1111
"dependencies": [ "dda" ],
1212
"version": "0.1"
13+
},
14+
{
15+
"type": "EXTERNAL_OPTION",
16+
"name": "DEFAULT_REGION",
17+
"stype": "string_input",
18+
"value": "default_backrooms"
1319
}
1420
]

data/mods/Isolation-Protocol/modinfo.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,17 @@
99
"category": "total_conversion",
1010
"dependencies": [ "dda" ],
1111
"conflicts": [ "generic_guns", "aftershock_exoplanet", "innawood", "skyisland", "backrooms", "defense_mode", "MA", "tropicata" ]
12+
},
13+
{
14+
"type": "EXTERNAL_OPTION",
15+
"name": "DEFAULT_REGION",
16+
"stype": "string_input",
17+
"value": "default_isolation"
18+
},
19+
{
20+
"type": "EXTERNAL_OPTION",
21+
"name": "OVERMAP_PLACE_HIGHWAYS",
22+
"stype": "bool",
23+
"value": false
1224
}
1325
]

data/mods/TropiCataclysm/modinfo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,11 @@
2929
"name": "OVERMAP_PLACE_HIGHWAYS",
3030
"stype": "bool",
3131
"value": false
32+
},
33+
{
34+
"type": "EXTERNAL_OPTION",
35+
"name": "DEFAULT_REGION",
36+
"stype": "string_input",
37+
"value": "default_tropicataclysm"
3238
}
3339
]

data/mods/aftershock_exoplanet/modinfo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,11 @@
1010
"dependencies": [ "dda" ],
1111
"conflicts": [ "mindovermatter", "generic_guns", "skyisland" ],
1212
"loading_images": [ "aftershock.png" ]
13+
},
14+
{
15+
"type": "EXTERNAL_OPTION",
16+
"name": "DEFAULT_REGION",
17+
"stype": "string_input",
18+
"value": "default_aftershock"
1319
}
1420
]

data/mods/aftershock_exoplanet/options.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,11 @@
3434
"name": "CAPITALISM",
3535
"stype": "bool",
3636
"value": true
37+
},
38+
{
39+
"type": "EXTERNAL_OPTION",
40+
"name": "OVERMAP_PLACE_HIGHWAYS",
41+
"stype": "bool",
42+
"value": false
3743
}
3844
]

data/mods/classic_zombies/modinfo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,11 @@
101101
"name": "OVERMAP_URBAN_INCREASE_SOUTH",
102102
"stype": "int",
103103
"value": 0
104+
},
105+
{
106+
"type": "EXTERNAL_OPTION",
107+
"name": "DEFAULT_REGION",
108+
"stype": "string_input",
109+
"value": "default_classiczombies"
104110
}
105111
]

data/mods/desert_region/modinfo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,11 @@
3030
"name": "OVERMAP_PLACE_HIGHWAYS",
3131
"stype": "bool",
3232
"value": false
33+
},
34+
{
35+
"type": "EXTERNAL_OPTION",
36+
"name": "DEFAULT_REGION",
37+
"stype": "string_input",
38+
"value": "default_desert"
3339
}
3440
]

data/mods/innawood/modinfo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,11 @@
1010
"dependencies": [ "dda" ],
1111
"loading_images": [ "innawoods1.png" ],
1212
"obsolete": false
13+
},
14+
{
15+
"type": "EXTERNAL_OPTION",
16+
"name": "DEFAULT_REGION",
17+
"stype": "string_input",
18+
"value": "default_innawood"
1319
}
1420
]

src/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ void DynamicDataLoader::finalize_loaded_data()
821821
{ _( "Damage info orders" ), &damage_info_order::finalize_all },
822822
{ _( "Diseases" ), &disease_type::finalize_all },
823823
{ _( "Weather types" ), &weather_types::finalize_all },
824+
{ _( "Weather generators" ), &weather_generator::finalize_all },
824825
{ _( "Effect on conditions" ), &effect_on_conditions::finalize_all },
825826
{ _( "Field types" ), &field_types::finalize_all },
826827
{ _( "Ammo effects" ), &ammo_effects::finalize_all },

src/map_extras.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ static const mtype_id mon_fungaloid_queen( "mon_fungaloid_queen" );
104104

105105
static const oter_type_str_id oter_type_road( "road" );
106106

107+
static const region_settings_id region_settings_default( "default" );
108+
107109
static const relic_procgen_id relic_procgen_data_alien_reality( "alien_reality" );
108110

109111
static const ter_str_id ter_t_coast_rock_surf( "t_coast_rock_surf" );
@@ -1210,10 +1212,12 @@ void debug_spawn_test()
12101212
{
12111213
uilist mx_menu;
12121214
std::vector<std::string> mx_names;
1213-
for( std::pair<const std::string, map_extras> &region_extra :
1214-
region_settings_map["default"].region_extras ) {
1215-
mx_menu.addentry( -1, true, -1, region_extra.first );
1216-
mx_names.push_back( region_extra.first );
1215+
const region_settings_map_extras &settings_map_extras =
1216+
region_settings_default->get_settings_map_extras();
1217+
for( const map_extra_collection_id &region_extra : settings_map_extras.extras ) {
1218+
const std::string &mx_name = region_extra.str();
1219+
mx_menu.addentry( -1, true, -1, mx_name );
1220+
mx_names.push_back( mx_name );
12171221
}
12181222

12191223
mx_menu.text = _( "Test which map extra list?" );
@@ -1228,9 +1232,13 @@ void debug_spawn_test()
12281232
map_extra_id mx_null = map_extra_id::NULL_ID();
12291233

12301234
for( size_t a = 0; a < 32400; a++ ) {
1231-
map_extras ex = region_settings_map["default"].region_extras[mx_names[index]];
1235+
auto mx_iter = settings_map_extras.extras.find( map_extra_collection_id( mx_names[index] ) );
1236+
if( mx_iter == settings_map_extras.extras.end() ) {
1237+
continue;
1238+
}
1239+
const map_extra_collection &ex = **mx_iter;
12321240
if( ex.chance > 0 && one_in( ex.chance ) ) {
1233-
map_extra_id *extra = ex.values.pick();
1241+
const map_extra_id *extra = ex.values.pick();
12341242
if( extra == nullptr ) {
12351243
results[mx_null]++;
12361244
} else {

0 commit comments

Comments
 (0)