1
0
forked from mirrors/0ad

Remove incorrect default for autostart-players

When not provided, the number of players on autostart was set to 2,
which is incorrect for skirmishes and scenarios. This commit makes this
parameter ignored for non-random maps, as well as the other parameters
specific to random maps.

Furthermore, 2 is already set as a default number of players for random
maps (in the `PlayerCount` gamesettings attribute), setting it in
autostart code is redundant.

Fixes #8325
Refs #7269
This commit is contained in:
Itms
2025-09-07 11:27:27 +02:00
committed by Nicolas Auvray
parent a5b5331fa4
commit 7c51013ef0
2 changed files with 14 additions and 6 deletions
@@ -5,7 +5,6 @@
*
* -autostart="TYPEDIR/MAPNAME" enables autostart and sets MAPNAME;
* TYPEDIR is skirmishes, scenarios, or random
* -autostart-biome=BIOME sets BIOME for a random map
* -autostart-seed=SEED sets randomization seed value (default 0, use -1 for random)
* -autostart-ai=PLAYER:AI sets the AI for PLAYER (e.g. 2:petra)
* -autostart-aidiff=PLAYER:DIFF sets the DIFFiculty of PLAYER's AI
@@ -48,6 +47,7 @@
* -autostart-players=NUMBER sets NUMBER of players on random map
* (default 2)
* -autostart-placement=PLACEMENT sets the placement type for a random map
* -autostart-biome=BIOME sets the biome for a random map
*
* Examples:
* 1) "Bob" will host a 2 player game on the Arcadia map:
@@ -73,9 +73,7 @@ function parseCmdLineArgs(settings, cmdLineArgs)
}[mapType]);
// eslint-disable-next-line dot-notation
settings.map.selectMap("maps/" + cmdLineArgs['autostart']);
settings.mapSize.setSize(+(cmdLineArgs['autostart-size'] ?? 192));
settings.biome.setBiome(cmdLineArgs['autostart-biome'] || "random");
settings.playerPlacement.setValue(cmdLineArgs['autostart-placement']);
if ('autostart-visibility' in cmdLineArgs)
{
switch (cmdLineArgs['autostart-visibility'])
@@ -110,7 +108,17 @@ function parseCmdLineArgs(settings, cmdLineArgs)
}
}
settings.playerCount.setNb(+(cmdLineArgs['autostart-players'] ?? 2));
// Handle options specific to random maps
if (mapType === "random")
{
settings.mapSize.setSize(+(cmdLineArgs['autostart-size'] ?? 192));
settings.biome.setBiome(cmdLineArgs['autostart-biome'] || "random");
settings.playerPlacement.setValue(cmdLineArgs['autostart-placement']);
// If not specified, random maps are generated for 2 players
if (cmdLineArgs['autostart-players'])
settings.playerCount.setNb(+cmdLineArgs['autostart-players']);
}
const getPlayer = (key, i) => {
if (!(('autostart-' + key) in cmdLineArgs))
+1 -1
View File
@@ -8,7 +8,6 @@ Basic gameplay:
Autostart:
-autostart="TYPEDIR/MAPNAME" enables autostart and sets MAPNAME; TYPEDIR is skirmishes, scenarios, or random
-autostart-biome=BIOME sets BIOME for a random map
-autostart-seed=SEED sets randomization seed value (default 0, use -1 for random)
-autostart-ai=PLAYER:AI sets the AI for PLAYER (e.g. 2:petra)
-autostart-aidiff=PLAYER:DIFF sets the DIFFiculty of PLAYER's AI (default 3, 0: sandbox, 5: very hard)
@@ -35,6 +34,7 @@ Multiplayer:
-autostart-size=TILES sets random map size in TILES (default 192)
-autostart-players=NUMBER sets NUMBER of players on random map (default 2)
-autostart-placement=PLACEMENT sets the placement type for a random map
-autostart-biome=BIOME sets the biome for a random map
Examples:
1) "Bob" will host a 2 player game on the Arcadia map: