diff options
author | Darkvater <darkvater@openttd.org> | 2006-10-15 23:48:34 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-10-15 23:48:34 +0000 |
commit | d5baf25923869c6ec06ed31f387d8e59bf76066d (patch) | |
tree | b6419eb336f33a543168cce79ecd4086674ed9c6 /console_cmds.c | |
parent | 7cac86186e8333fc98d2cd7eb863c6a7e5a58378 (diff) | |
download | openttd-d5baf25923869c6ec06ed31f387d8e59bf76066d.tar.xz |
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
new player instead of a 0.
Diffstat (limited to 'console_cmds.c')
-rw-r--r-- | console_cmds.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/console_cmds.c b/console_cmds.c index f49537ff0..eccf45258 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -739,7 +739,8 @@ DEF_CONSOLE_CMD(ConNetworkConnect) if (argc == 0) { IConsoleHelp("Connect to a remote OTTD server and join the game. Usage: 'connect <ip>'"); - IConsoleHelp("IP can contain port and player: 'IP#Player:Port', eg: 'server.ottd.org#2:443'"); + IConsoleHelp("IP can contain port and player: 'IP[[#Player]:Port]', eg: 'server.ottd.org#2:443'"); + IConsoleHelp("Player #0 is new company, #255 is spectator all others are a certain company"); return true; } @@ -749,14 +750,25 @@ DEF_CONSOLE_CMD(ConNetworkConnect) NetworkDisconnect(); ip = argv[1]; + /* Default settings: default port and new company */ rport = NETWORK_DEFAULT_PORT; + _network_playas = PLAYER_NEW_COMPANY; ParseConnectionString(&player, &port, ip); IConsolePrintF(_icolour_def, "Connecting to %s...", ip); if (player != NULL) { _network_playas = atoi(player); - IConsolePrintF(_icolour_def, " player-no: %s", player); + IConsolePrintF(_icolour_def, " player-no: %d", _network_playas); + + /* From a user pov 0 is a new player, internally it's different and all + * players are offset by one to ease up on users (eg players 1-8 not 0-7) */ + if (_network_playas == 0) _network_playas = PLAYER_NEW_COMPANY; + if (!IsValidPlayer(_network_playas - 1) && + (_network_playas != PLAYER_SPECTATOR && + _network_playas != PLAYER_NEW_COMPANY)) { + return false; + } } if (port != NULL) { rport = atoi(port); |