Added duplicate Ai check.
This commit is contained in:
@@ -222,9 +222,12 @@ def server_command_builder(
|
||||
if not hwrap:
|
||||
command.append(" --nohwrap")
|
||||
if ai_slots:
|
||||
added_ais = []
|
||||
for ai in ai_slots:
|
||||
if ai[0] not in available_nations[str(era)]:
|
||||
return "ERROR_INVALID_NATION"
|
||||
if ai[0] in added_ais:
|
||||
return "ERROR_DUPLICATE_AI"
|
||||
match ai[1]:
|
||||
case 1:
|
||||
command.append(" --easyai " + str(ai[0]))
|
||||
@@ -240,6 +243,7 @@ def server_command_builder(
|
||||
command.append(" --impai " + str(ai[0]))
|
||||
case _:
|
||||
return "ERROR_INVALID_AI"
|
||||
added_ais.append(ai[0])
|
||||
|
||||
return "".join(command)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user