Added input validation for team nations.

This commit is contained in:
2026-04-28 17:36:27 +02:00
parent 54653282aa
commit fbb434563d

View File

@@ -90,6 +90,8 @@ def server_command_builder(
required_apoints: int = 0,
cataclysm: int = 0,
):
available_nations = get_nations()
if (not ((random_map == 0) ^ (mapfile == ""))) or random_map not in {0, 10, 15, 20}:
return "ERROR_MAP"
@@ -120,6 +122,8 @@ def server_command_builder(
if team_game:
for team in teams:
# TODO Check valid inputs
if team[0] not in available_nations[era]:
return "ERROR_INVALID_NATION"
command.append(
" --team " + str(team[0]) + " " + str(team[1]) + " " + str(team[2])
)