<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40254 >

When a user connected to a server with some
AI players created by aifill, they were attached
to an existing AI player but AI mode was not
reset. So when the game started the player's
units moved on their own. This patch fixes that
problem by cancelling AI mode in the attached
player if AI mode is on and the server is in
the pregame state.


----------------------------------------------------------------------
直すことができる?
>From 5f7a1c0ce248246575d6916b1ea36e5e1f8c2511 Mon Sep 17 00:00:00 2001
From: Madeline Book <[EMAIL PROTECTED]>
Date: Thu, 29 May 2008 19:23:28 -0400
Subject: [PATCH] Cancel AI mode when attaching to aifill player.

When a user connected to a server with some
AI players created by aifill, they were attached
to an existing AI player but AI mode was not
reset. So when the game started the player's
units moved on their own. This patch fixes that
problem by cancelling AI mode in the attached
player if AI mode is on and the server is in
the pregame state.
---
 server/connecthand.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/server/connecthand.c b/server/connecthand.c
index 9d17dbd..de0c432 100644
--- a/server/connecthand.c
+++ b/server/connecthand.c
@@ -493,6 +493,11 @@ bool attach_connection_to_player(struct connection *pconn,
     sz_strlcpy(pplayer->username, pconn->username);
     pplayer->user_turns = 0; /* reset for a new user */
     pplayer->is_connected = TRUE;
+
+    if (server_state() == S_S_INITIAL && pplayer->ai.control) {
+      pplayer->ai.control = FALSE;
+      sz_strlcpy(pplayer->name, pplayer->username);
+    }
   }
 
   pconn->observer = observing;
-- 
1.5.5.1

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to