Yaribz/SPADS

nbTeams:16-32 causes spads to crash

Closed this issue · 3 comments

So I had a strange setting:

I had this setting on:

[ffa]
description:FFA Game Global Settings
battlePreset:ffa
autoBalance:advanced|off|on
nbTeams:16-32

And this caused the spads error below

NOTICE   - [SpringLobbyInterface] Connecting to server3.beyondallreason.info:8200
NOTICE   - [SpringLobbyInterface] TLS enabled (TLSv1_3,TLS_AES_256_GCM_SHA384)
ERROR    - [SPADS] PERL WARNING: Argument "16-32" isn't numeric in multiplication (*) at ../spads.pl line 2413.
ERROR    - [SPADS] PERL WARNING:         main::getTargetBattleInfo called at ../spads.pl line 2464
ERROR    - [SPADS] PERL WARNING:         main::updateBattleInfoIfNeeded called at ../spads.pl line 6195
ERROR    - [SPADS] PERL WARNING:         main::applySettingChange called at ../spads.pl line 6264
ERROR    - [SPADS] PERL WARNING:         main::applyAllSettings called at ../spads.pl line 6276
ERROR    - [SPADS] PERL WARNING:         main::applyPreset called at ../spads.pl line 10259
ERROR    - [SPADS] PERL WARNING:         main::hPreset called at ../spads.pl line 3082
ERROR    - [SPADS] PERL WARNING:         main::executeCommand called at ../spads.pl line 3009
ERROR    - [SPADS] PERL WARNING:         main::handleRequest called at ../spads.pl line 13806
ERROR    - [SPADS] PERL WARNING:         ...
WARNING  - [SPADS] Unable to update battle skill of player AKU for new game type, no cached skill available!

Changing this to

[ffa]
description:FFA Game Global Settings
battlePreset:ffa
autoBalance:advanced|off|on
nbTeams:16|16-32

Made things work, and also allowed me to set 17+ players in FFA mode.

Thank you for spads <3

Yes, the first value after the setting name is the default value. So putting nbTeams:16-32 in SPADS conf actually makes nbTeams have 16-32 as initial value, which is not correct as nbTeams is supposed to be an integer. The integer range syntax x-y can only be used in the "other allowed values" part of settings declaration, i.e. after the pipe character (like in your fixed version).
I will make SPADS detect such invalid setting declarations at start to avoid confusion.
Thanks for the report.

I will wait for confirmation that your config files are fixed before deploying this new version on the unstable SPADS branch, as it would prevent instances having nbTeams:16-32 in their config files from starting.

Thank you, I updated the git configs, but it might take a day to propagate to all hosts (but at least 3 hours)