OpenTTD

Tasklist

FS#1363 - concolde cmd: move clients between companies (inc. Spectator)

Attached to Project: OpenTTD
Opened by Nathanael Rebsch (dihedral) - Tuesday, 23 October 2007, 14:00 GMT
Last edited by Remko Bijker (Rubidium) - Sunday, 17 May 2009, 20:52 GMT
Type Patch
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version 0.5.3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

adds a console command (move) and a network command (PACKET_CLIENT_MOVE)

console cmd syntax
move <client-id> [<company-id>]
if company-id is omitted, client is made a spectator

thanks to TB for a lot of patience and advise :-)
This task depends upon

Closed by  Remko Bijker (Rubidium)
Sunday, 17 May 2009, 20:52 GMT
Reason for closing:  Implemented
Additional comments about closing:  Somewhere a while ago, I think, or so
Comment by Nathanael Rebsch (dihedral) - Tuesday, 23 October 2007, 14:22 GMT
sorry - not 0.5.3, its patch for r11333
Comment by Nathanael Rebsch (dihedral) - Tuesday, 23 October 2007, 20:34 GMT
changes:
* added comments :-P
* display a message when company-id has been changed for a client
* fix: check against ActivePlayerCount()-1 as player_index starts at 0
* use PLAYER_SPECTATOR instead of 255
Comment by Nathanael Rebsch (dihedral) - Tuesday, 23 October 2007, 20:49 GMT
a thought that just came to me mind:
using this patch, reset_company can be performed even if a company has clients, simply by moving all clients in that company to Spectator :-)
Comment by Nathanael Rebsch (dihedral) - Wednesday, 24 October 2007, 12:26 GMT
this version has even less chances of a client getting disconnected or having an assertion, if the client should manage to 'click' a button or perform an action between moving and the move being processed.

changes:
* use MakeWholeScreenDirty() instead of UpdateWindows(); DeleteAllNonVitalWindows();
* check for PLAYER_NEW_COMPANY and PLAYER_INACTIVE_CLIENT before outputting a message, to prevend messages from clients joining a company normally!
Comment by Nathanael Rebsch (dihedral) - Wednesday, 24 October 2007, 22:20 GMT
found a bug, will update tomorrow...
Comment by Bjarni (Bjarni) - Wednesday, 24 October 2007, 22:28 GMT
My first thought when I see this patch is: what about password protected companies? Isn't this a way to create a backdoor into protected companies?
Comment by Nathanael Rebsch (dihedral) - Thursday, 25 October 2007, 07:00 GMT
it is a server side console command... meaning you need access to the server either directly or via rcon...
i.e. the command is not available to "normal" users

attached version fixes 2 bugs:
1. it was possible to move a client into a non existant company, causing desyncs, money overflows
2. when resetting one of the companies between min and currently max available, it was not possible to move a client to the max available company!

added: when a client should ever receive a packet about moving a client to a non existant company which is still IsValidPlayer(), the client is moved to spectator
Comment by Benedikt Br├╝ggemeier (skidd13) - Monday, 29 October 2007, 22:48 GMT
I'm wondering if the patch is AI safe. Hmm how would an AI react if it is moved to spectator? :D
Comment by Nathanael Rebsch (dihedral) - Tuesday, 30 October 2007, 07:58 GMT
would it even notice?

btw. could some admin please change "Reported Version" for me? it's not 0.5.3 :-)
Comment by Bjarni (Bjarni) - Tuesday, 30 October 2007, 19:44 GMT
"Reported Version" is the only thing I can't change so it's the only thing were you aren't allowed at all to put incorrect info :P
Comment by Nathanael Rebsch (dihedral) - Tuesday, 30 October 2007, 19:50 GMT
not even in the database??
Comment by Benedikt Br├╝ggemeier (skidd13) - Wednesday, 31 October 2007, 22:41 GMT
I may point at some coding style conflicts. ;)
http://wiki.openttd.org/index.php/Coding_style#Variables
-> Declare variables upon first usage.
Comment by Yorick (yorick) - Sunday, 09 March 2008, 19:36 GMT
I've made a version of the patch which asks the client for confirmation first, before moving.
But if the client isn't responding to the request, the move gets executed without client confirmation.
Comment by Ammler (Ammler) - Friday, 18 April 2008, 16:23 GMT
Updated to revision r12767.

The idea of the move function is to force the client in an other company. Mostly spectator, so you can stop him building or what else but keep him on the server for further discussing. An admin don't need confirmation of the player.

Loading...