1
0
Fork 0

(svn r2339) - Fix: on a dedicated server, after the joining of a player, the player was set to player 0 instead of remaining OWNER_SPECTATOR. Fix this, and allow the dedicated server to execute commands (so 'patch <value>') now works and not only when a client is connected.

release/0.4.5
Darkvater 2005-05-17 18:22:59 +00:00
parent 166c1badc9
commit 54b7fb0203
3 changed files with 6 additions and 6 deletions

View File

@ -413,8 +413,9 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
_error_message_2 = cmd >> 16; _error_message_2 = cmd >> 16;
_additional_cash_required = 0; _additional_cash_required = 0;
// spectator has no rights. /** Spectator has no rights except for the dedicated server which
if (_current_player == OWNER_SPECTATOR) { * is a spectator but is the server, so can do anything */
if (_current_player == OWNER_SPECTATOR && !_network_dedicated) {
ShowErrorMessage(_error_message, _error_message_2, x, y); ShowErrorMessage(_error_message, _error_message_2, x, y);
_cmd_text = NULL; _cmd_text = NULL;
return false; return false;

View File

@ -1036,12 +1036,11 @@ void NetworkServer_HandleChat(NetworkAction action, DestType desttype, int dest,
NetworkTextMessage(action, GetDrawStringPlayerColor(ci->client_playas-1), false, ci->client_name, "%s", msg); NetworkTextMessage(action, GetDrawStringPlayerColor(ci->client_playas-1), false, ci->client_name, "%s", msg);
if (from_index == NETWORK_SERVER_INDEX) if (from_index == NETWORK_SERVER_INDEX)
show_local = false; show_local = false;
ci_to = ci; ci_to = ci_own;
} }
/* There is no such player */ /* There is no such player */
if (ci_to == NULL) if (ci_to == NULL) break;
break;
// Display the message locally (so you know you have sent it) // Display the message locally (so you know you have sent it)
if (ci != NULL && show_local) { if (ci != NULL && show_local) {

View File

@ -674,7 +674,7 @@ int32 CmdPlayerCtrl(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (p != NULL) { if (p != NULL) {
if (_local_player == OWNER_SPECTATOR) { if (_local_player == OWNER_SPECTATOR) {
/* Check if we do not want to be a spectator in network */ /* Check if we do not want to be a spectator in network */
if (!_networking || _network_server || _network_playas != OWNER_SPECTATOR) { if (!_networking || (_network_server && !_network_dedicated) || _network_playas != OWNER_SPECTATOR) {
_local_player = p->index; _local_player = p->index;
MarkWholeScreenDirty(); MarkWholeScreenDirty();
} }