|
|
@@ -561,6 +561,43 @@ void load_region_settings( JsonObject &jo ) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ( ! jo.has_object("map_extras") ) { |
|
|
|
if ( strict ) { |
|
|
|
jo.throw_error("\"map_extras\": { ... } required for default"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
JsonObject pjo = jo.get_object("map_extras"); |
|
|
|
|
|
|
|
std::set<std::string> zones = pjo.get_member_names(); |
|
|
|
for( const auto &zone : zones ) { |
|
|
|
if( zone != "//" ) { |
|
|
|
JsonObject zjo = pjo.get_object(zone); |
|
|
|
map_extras extras(0); |
|
|
|
|
|
|
|
if ( ! zjo.read("chance", extras.chance) && strict ) { |
|
|
|
zjo.throw_error("chance required for default"); |
|
|
|
} |
|
|
|
|
|
|
|
if ( ! zjo.has_object("extras") ) { |
|
|
|
if ( strict ) { |
|
|
|
zjo.throw_error("\"extras\": { ... } required for default"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
JsonObject exjo = zjo.get_object("extras"); |
|
|
|
|
|
|
|
std::set<std::string> keys = exjo.get_member_names(); |
|
|
|
for( const auto &key : keys ) { |
|
|
|
if(key != "//" ) { |
|
|
|
extras.extras.add(key, exjo.get_int(key, 0)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
new_region.region_extras[zone] = extras; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ( ! jo.has_object("city") ) { |
|
|
|
if ( strict ) { |
|
|
|
jo.throw_error("\"city\": { ... } required for default"); |
|
|
@@ -720,6 +757,27 @@ void apply_region_overlay(JsonObject &jo, regional_settings ®ion) |
|
|
|
fieldjo.throw_error("boost_chance > 0 requires boosted_other { ... }"); |
|
|
|
} |
|
|
|
|
|
|
|
JsonObject mapextrajo = jo.get_object("map_extras"); |
|
|
|
std::set<std::string> extrazones = mapextrajo.get_member_names(); |
|
|
|
for( const auto &zone : extrazones ) { |
|
|
|
if( zone != "//" ) { |
|
|
|
JsonObject zonejo = mapextrajo.get_object(zone); |
|
|
|
|
|
|
|
int tmpval = 0; |
|
|
|
if (zonejo.read("chance", tmpval)) { |
|
|
|
region.region_extras[zone].chance = tmpval; |
|
|
|
} |
|
|
|
|
|
|
|
JsonObject extrasjo = zonejo.get_object("extras"); |
|
|
|
std::set<std::string> extrakeys = extrasjo.get_member_names(); |
|
|
|
for( const auto &key : extrakeys ) { |
|
|
|
if( key != "//" ) { |
|
|
|
region.region_extras[zone].extras.add_or_replace(key, extrasjo.get_int(key)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
JsonObject cityjo = jo.get_object("city"); |
|
|
|
|
|
|
|
cityjo.read("shop_radius", region.city_spec.shop_radius); |
|
|
|
0 comments on commit
327ec05