summaryrefslogtreecommitdiff
path: root/players.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-11-22 15:55:38 +0000
committertruelight <truelight@openttd.org>2005-11-22 15:55:38 +0000
commite4cb8ed4570f53fc26367371e8d680882f0e70e6 (patch)
tree6702beccddba7217fe3ad311ffda9285b6719e5d /players.c
parent28df667ceb7fa74a1146a2bede0a908bc9dd3eb4 (diff)
downloadopenttd-e4cb8ed4570f53fc26367371e8d680882f0e70e6.tar.xz
(svn r3226) -Fix: GPMI implementation had minor glitches
-Fix: the AI speed control is done by the AI-core, individual AIs don't have to do it (so, AIs were delayed twice ;) -Add: Support for AI-network-clients (an AI, connecting to a remote server) -Fix: minor AI-core problems
Diffstat (limited to 'players.c')
-rw-r--r--players.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/players.c b/players.c
index ecb54aeee..b53ea1c27 100644
--- a/players.c
+++ b/players.c
@@ -806,10 +806,20 @@ int32 CmdPlayerCtrl(int x, int y, uint32 flags, uint32 p1, uint32 p2)
#endif /* ENABLE_NETWORK */
if (p != NULL) {
- if (_local_player == OWNER_SPECTATOR) {
+ if (_local_player == OWNER_SPECTATOR && (!_ai.network_client || _ai.network_playas == OWNER_SPECTATOR)) {
/* Check if we do not want to be a spectator in network */
- if (!_networking || (_network_server && !_network_dedicated) || _network_playas != OWNER_SPECTATOR) {
- _local_player = p->index;
+ if (!_networking || (_network_server && !_network_dedicated) || _network_playas != OWNER_SPECTATOR || _ai.network_client) {
+ if (_ai.network_client) {
+ /* As ai-network-client, we have our own rulez (disable GUI and stuff) */
+ _ai.network_playas = p->index;
+ _local_player = OWNER_SPECTATOR;
+ if (_ai.network_playas != OWNER_SPECTATOR) {
+ /* If we didn't join the game as a spectator, activate the AI */
+ AI_StartNewAI(_ai.network_playas);
+ }
+ } else {
+ _local_player = p->index;
+ }
MarkWholeScreenDirty();
}
} else if (p->index == _local_player) {