Civ6: Fix issue with names including civ-breaking characters (#5204)

This commit is contained in:
Carter Hesterman
2025-11-29 11:02:15 -07:00
committed by GitHub
parent d089b00ad5
commit 360a1384f2

View File

@@ -44,9 +44,10 @@ class CivVIContainer(APPlayerContainer):
opened_zipfile.writestr(filename, yml) opened_zipfile.writestr(filename, yml)
super().write_contents(opened_zipfile) super().write_contents(opened_zipfile)
def sanitize_value(value: str) -> str: def sanitize_value(value: str) -> str:
"""Removes values that can cause issues in XML""" """Removes values that can cause issues in XML"""
return value.replace('"', "'").replace('&', 'and') return value.replace('"', "'").replace('&', 'and').replace('{', '').replace('}', '')
def get_cost(world: 'CivVIWorld', location: CivVILocationData) -> int: def get_cost(world: 'CivVIWorld', location: CivVILocationData) -> int:
@@ -87,8 +88,10 @@ def generate_new_items(world: 'CivVIWorld') -> str:
boost_civics = [] boost_civics = []
if world.options.boostsanity: if world.options.boostsanity:
boost_techs = [location for location in locations if location.location_type == CivVICheckType.BOOST and location.name.split("_")[1] == "TECH"] boost_techs = [location for location in locations if location.location_type ==
boost_civics = [location for location in locations if location.location_type == CivVICheckType.BOOST and location.name.split("_")[1] == "CIVIC"] CivVICheckType.BOOST and location.name.split("_")[1] == "TECH"]
boost_civics = [location for location in locations if location.location_type ==
CivVICheckType.BOOST and location.name.split("_")[1] == "CIVIC"]
techs += boost_techs techs += boost_techs
civics += boost_civics civics += boost_civics