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
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
|
Detailsadds 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
Sunday, 17 May 2009, 20:52 GMT
Reason for closing: Implemented
Additional comments about closing: Somewhere a while ago, I think, or so
* 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
using this patch, reset_company can be performed even if a company has clients, simply by moving all clients in that company to Spectator :-)
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!
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
btw. could some admin please change "Reported Version" for me? it's not 0.5.3 :-)
https://wiki.openttd.org/index.php/Coding_style#Variables
-> Declare variables upon first usage.
But if the client isn't responding to the request, the move gets executed without client confirmation.
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.