Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions openage/convert/processor/conversion/aoc/tech_subprocessor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2023 the openage authors. See copying.md for legal info.
# Copyright 2020-2026 the openage authors. See copying.md for legal info.
#
# pylint: disable=too-many-locals,too-many-statements,too-many-branches
#
Expand Down Expand Up @@ -241,7 +241,13 @@ def attribute_modify_effect(
else:
return patches

upgrade_func = AoCTechSubprocessor.upgrade_attribute_funcs[attribute_type]
try:
upgrade_func = AoCTechSubprocessor.upgrade_attribute_funcs[attribute_type]
except KeyError as exc:
raise KeyError(
f"No subprocessor function found for handling upgrade of "
f"unit attribute: {attribute_type}"
) from exc
for affected_entity in affected_entities:
patches.extend(upgrade_func(converter_group, affected_entity, value, operator, team))

Expand Down Expand Up @@ -284,7 +290,13 @@ def resource_modify_effect(
# 21 = tech count (unused)
return patches

upgrade_func = AoCTechSubprocessor.upgrade_resource_funcs[resource_id]
try:
upgrade_func = AoCTechSubprocessor.upgrade_resource_funcs[resource_id]
except KeyError as exc:
raise KeyError(
f"No subprocessor function found for handling upgrade of "
f"resource: {resource_id}"
) from exc
patches.extend(upgrade_func(converter_group, value, operator, team))

return patches
Expand Down
18 changes: 15 additions & 3 deletions openage/convert/processor/conversion/de2/tech_subprocessor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024 the openage authors. See copying.md for legal info.
# Copyright 2020-2026 the openage authors. See copying.md for legal info.
#
# pylint: disable=too-many-locals,too-many-branches

Expand Down Expand Up @@ -303,7 +303,13 @@ def attribute_modify_effect(
else:
return patches

upgrade_func = DE2TechSubprocessor.upgrade_attribute_funcs[attribute_type]
try:
upgrade_func = DE2TechSubprocessor.upgrade_attribute_funcs[attribute_type]
except KeyError as exc:
raise KeyError(
f"No DE2 subprocessor function found for handling upgrade of "
f"unit attribute: {attribute_type}"
) from exc
for affected_entity in affected_entities:
patches.extend(upgrade_func(converter_group, affected_entity, value, operator, team))

Expand Down Expand Up @@ -346,7 +352,13 @@ def resource_modify_effect(
# 21 = tech count (unused)
return patches

upgrade_func = DE2TechSubprocessor.upgrade_resource_funcs[resource_id]
try:
upgrade_func = DE2TechSubprocessor.upgrade_resource_funcs[resource_id]
except KeyError as exc:
raise KeyError(
f"No DE2 subprocessor function found for handling upgrade of "
f"civ resource: {resource_id}"
) from exc
patches.extend(upgrade_func(converter_group, value, operator, team))

return patches
Loading