Skip to content

Commit

Permalink
fix wrong mapping with preserve when player gets new nation #193 #178 #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Maradonna90 committed Dec 23, 2023
1 parent 0a38bfc commit e2a190e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ def generate_mapping(self, rtf_data, mode, duplicates=False):
if int(player[3]) > 10:
self.logger.info("Ethnic value {} is invalid. Most likely a bug in the view. Skipping player {}".format(player[3], player[0]))
continue
# if player is in config.xml and we use preserver or overwrite handle it properly
if player[0] in xml_data:
if mode == "Preserve":
self.logger.info("Preserve: {} {} {}".format(player[0], xml_data[player[0]]["ethnicity"], xml_data[player[0]]["image"]))
continue
elif mode == "Overwrite":
prf_imgs.remove(xml_data[player[0]]["image"])
del xml_data[player[0]]
if player[3] == "1":
if "Scandinavian" in [n1_ethnic, n2_ethnic]:
p_ethnic = "South American"
Expand Down Expand Up @@ -101,16 +109,8 @@ def generate_mapping(self, rtf_data, mode, duplicates=False):
p_ethnic = "Caucasian"
elif player[3] == "4":
p_ethnic = "MESA"
if player[0] in xml_data:
if mode == "Preserve":
# self.logger.info("Preserve: {} {} {}".format(player[0], p_ethnic, xml_data[player[0]]["image"]))
mapping.append([player[0], p_ethnic, xml_data[player[0]]["image"]])
del xml_data[player[0]]
continue
elif mode == "Overwrite":
# self.logger.info("Overwrite: {} {}".format(player[0], p_ethnic))
prf_imgs.remove(xml_data[player[0]]["image"])
del xml_data[player[0]]

# pick image based on p_ethnic
player_img = self.pick_image(p_ethnic, duplicates)
prf_imgs.append(player_img)
if player_img is None:
Expand Down

0 comments on commit e2a190e

Please sign in to comment.