Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#7123) [FS#14]
Home

[Freeciv-Dev] (PR#7123) [FS#14]

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: i-freeciv-lists@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#7123) [FS#14]
From: "Per Inge Mathisen" <per@xxxxxxxxxxx>
Date: Wed, 14 Jul 2004 16:14:44 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7123 >

CHANGES
 - updated to cvs
 - removed x11old backend
 - style fixes
 - utility/fs-support -> utility/fdl
 - started on documentation for FDL - Freeciv Direct media Layer ;)
 - added/updated a lot of copyright headers and function headers
 - bugfix: ./configure built fs in addition to whatever client you
   really wanted to build
 - bugfix: compile problems in all other clients caused by fs
   changes removed
 - bugfix: no longer cores when clicking on map canvas in pregame

KNOWN BUGS
 - it sometimes miscalculates the city text box and goes out of rectangle
   bounds (and asserts). hard to reproduce.
 - window size is silently limited to window size, giving stupidities
   like "0: ERROR: There is no theme 'morgan' in resolution '1016x754'."
   when attempting to use a 1024x768 theme.

Still a lot of style fixes left to do, bugs to weed out, and some
functionality missing ;-)

  - Per

Index: configure.ac
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.ac,v
retrieving revision 1.65
diff -u -r1.65 configure.ac
--- configure.ac        1 Jun 2004 04:00:49 -0000       1.65
+++ configure.ac        14 Jul 2004 21:49:30 -0000
@@ -63,7 +63,7 @@
 
 dnl  no=do not compile client,  yes=guess it,  *=use this client or error
 AC_ARG_ENABLE(client,
-[  --enable-client[=no/yes/xaw3d/xaw/gtk/gtk2/win32/sdl]
+[  --enable-client[=no/yes/xaw3d/xaw/gtk/gtk2/win32/sdl/fs/fs:x11/fs:sdl]
                           compile a client [default=yes] (if yes, guess type)],
 [case "${enableval}" in
   yes)   client=yes ;;
@@ -73,6 +73,9 @@
   gtk2)   client=gtk-2.0 ;;
   gtk2.0) client=gtk-2.0 ;;
   gtk20)  client=gtk-2.0 ;;
+  fs)     client=fs:x11 ;;
+  fs:x11) client=fs:x11 ;;
+  fs:sdl) client=fs:sdl ;;
   *)     client="${enableval}"
          if test ! -d "${srcdir}/client/gui-$client" ; then
            AC_MSG_ERROR(bad value ${enableval} for --enable-client)
@@ -330,6 +333,22 @@
   dnl SDL-specific overrides
   FC_SDL_CLIENT
 
+  subclient=""
+
+  if test "$client" = fs:x11 || test "$client" = yes ; then
+       CLIENT_CFLAGS=`freetype-config --cflags`
+       CLIENT_LIBS="-L/usr/X11R6/lib -lX11 -lpng "`freetype-config --libs`
+       client="fs"
+       subclient="x11"
+  fi
+
+  if test "$client" = fs:sdl || test "$client" = yes ; then
+       CLIENT_CFLAGS=`sdl-config --cflags`" "`freetype-config --cflags`
+       CLIENT_LIBS=`sdl-config --libs`" -lpng "`freetype-config --libs`
+       client="fs"
+       subclient="sdl"
+  fi
+
   dnl Xaw-specific overrides
   if test "$client" = xaw || test "$client" = yes ; then
     dnl Checks for X:
@@ -483,6 +502,9 @@
 AM_CONDITIONAL(CLIENT_GUI_BEOS, test "$gui_sources" = "gui-beos")
 AM_CONDITIONAL(CLIENT_GUI_STUB, test "$gui_sources" = "gui-stub")
 AM_CONDITIONAL(CLIENT_GUI_WIN32, test "$gui_sources" = "gui-win32")
+AM_CONDITIONAL(CLIENT_GUI_FS, test "$gui_sources" = "gui-fs")
+AM_CONDITIONAL(CLIENT_GUI_FS_X11, test "$subclient" = "x11")
+AM_CONDITIONAL(CLIENT_GUI_FS_SDL, test "$subclient" = "sdl")
 
 dnl Checks for additional server libraries:
 if test x$server = xtrue; then
@@ -540,7 +562,6 @@
 
 dnl Checks for library functions.
 AC_TYPE_SIGNAL
-AC_FUNC_FORK
 AC_FUNC_STRCOLL
 AC_FUNC_VPRINTF
 AC_FUNC_VSNPRINTF
@@ -685,6 +706,7 @@
          data/nation/Makefile 
          data/history/Makefile 
          utility/Makefile
+         utility/fdl/Makefile 
          common/Makefile 
          common/aicore/Makefile 
          ai/Makefile 
@@ -698,6 +720,7 @@
          client/gui-xaw/Makefile 
          client/gui-win32/Makefile 
          client/gui-stub/Makefile 
+         client/gui-fs/Makefile 
          server/Makefile 
          server/userdb/Makefile
          intl/Makefile
Index: configure.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.in,v
retrieving revision 1.241
diff -u -r1.241 configure.in
--- configure.in        1 Jun 2004 04:00:49 -0000       1.241
+++ configure.in        14 Jul 2004 21:49:30 -0000
@@ -62,7 +62,7 @@
 
 dnl  no=do not compile client,  yes=guess it,  *=use this client or error
 AC_ARG_ENABLE(client,
-[  --enable-client[=no/yes/xaw3d/xaw/gtk/gtk2/win32/sdl]
+[  --enable-client[=no/yes/xaw3d/xaw/gtk/gtk2/win32/sdl/fs/fs:x11/fs:sdl]
                           compile a client [default=yes] (if yes, guess type)],
 [case "${enableval}" in
   yes)   client=yes ;;
@@ -72,6 +72,9 @@
   gtk2)   client=gtk-2.0 ;;
   gtk2.0) client=gtk-2.0 ;;
   gtk20)  client=gtk-2.0 ;;
+  fs)     client=fs:x11 ;;
+  fs:x11) client=fs:x11 ;;
+  fs:sdl) client=fs:sdl ;;
   *)     client="${enableval}"
          if test ! -d "${srcdir}/client/gui-$client" ; then
            AC_MSG_ERROR(bad value ${enableval} for --enable-client)
@@ -323,6 +326,22 @@
   dnl SDL-specific overrides
   FC_SDL_CLIENT
 
+  subclient=""
+
+  if test "$client" = fs:x11 || test "$client" = yes ; then
+       CLIENT_CFLAGS=`freetype-config --cflags`
+       CLIENT_LIBS="-L/usr/X11R6/lib -lX11 -lpng "`freetype-config --libs`
+       client="fs"
+       subclient="x11"
+  fi
+
+  if test "$client" = fs:sdl || test "$client" = yes ; then
+       CLIENT_CFLAGS=`sdl-config --cflags`" "`freetype-config --cflags`
+       CLIENT_LIBS=`sdl-config --libs`" -lpng "`freetype-config --libs`
+       client="fs"
+       subclient="sdl"
+  fi
+
   dnl Xaw-specific overrides
   if test "$client" = xaw || test "$client" = yes ; then
     dnl Checks for X:
@@ -467,6 +486,9 @@
 AM_CONDITIONAL(CLIENT_GUI_BEOS, test "$gui_sources" = "gui-beos")
 AM_CONDITIONAL(CLIENT_GUI_STUB, test "$gui_sources" = "gui-stub")
 AM_CONDITIONAL(CLIENT_GUI_WIN32, test "$gui_sources" = "gui-win32")
+AM_CONDITIONAL(CLIENT_GUI_FS, test "$gui_sources" = "gui-fs")
+AM_CONDITIONAL(CLIENT_GUI_FS_X11, test "$subclient" = "x11")
+AM_CONDITIONAL(CLIENT_GUI_FS_SDL, test "$subclient" = "sdl")
 
 dnl Checks for additional server libraries:
 if test x$server = xtrue; then
@@ -671,6 +693,7 @@
          data/nation/Makefile 
          data/history/Makefile 
          utility/Makefile
+         utility/fdl/Makefile
          common/Makefile 
           common/aicore/Makefile
          ai/Makefile 
@@ -679,6 +702,7 @@
          client/agents/Makefile
          client/include/Makefile 
           client/gui-sdl/Makefile
+          client/gui-fs/Makefile
          client/gui-gtk/Makefile 
          client/gui-gtk-2.0/Makefile
          client/gui-xaw/Makefile 
Index: client/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/Makefile.am,v
retrieving revision 1.57
diff -u -r1.57 Makefile.am
--- client/Makefile.am  2 May 2004 12:13:51 -0000       1.57
+++ client/Makefile.am  14 Jul 2004 21:49:30 -0000
@@ -25,6 +25,9 @@
 if CLIENT_GUI_WIN32
 GUI_SUBDIR = gui-win32
 endif
+if CLIENT_GUI_FS
+GUI_SUBDIR = gui-fs
+endif
 
 ALL_ESD_FILES=audio_esd.c audio_esd.h
 ALL_SDL_FILES=audio_sdl.c audio_sdl.h
@@ -191,10 +194,11 @@
 civclient_LDFLAGS = @CLIENT_LDFLAGS@
 civclient_DEPENDENCIES = @gui_sources@/libguiclient.a \
        ../utility/libcivutility.a ../common/libcivcommon.a agents/libagents.a \
-        ../common/aicore/libaicore.a
+        ../common/aicore/libaicore.a ../utility/fdl/libfssupport.a
 
 civclient_LDADD        = @gui_sources@/libguiclient.a \
        @INTLLIBS@ ../common/aicore/libaicore.a \
         ../utility/libcivutility.a ../common/libcivcommon.a \
         agents/libagents.a ../common/aicore/libaicore.a \
+       ../utility/fdl/libfssupport.a \
        @CLIENT_LIBS@ @SOUND_LIBS@
Index: client/chatline_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/chatline_common.c,v
retrieving revision 1.5
diff -u -r1.5 chatline_common.c
--- client/chatline_common.c    28 Nov 2003 17:37:19 -0000      1.5
+++ client/chatline_common.c    14 Jul 2004 21:49:30 -0000
@@ -19,6 +19,7 @@
 #include <string.h>
 
 #include "astring.h"
+#include "log.h"
 #include "packets.h"
 #include "support.h"
 
@@ -27,6 +28,14 @@
 #include "chatline_common.h"
 #include "clinet.h"
 
+static struct {
+  int lines;
+  struct {
+    char *text;
+    int conn_id;
+  } *line;
+} remaining;
+
 /**************************************************************************
   Send the message as a chat to the server.
 **************************************************************************/
@@ -36,7 +45,6 @@
 }
 
 static int frozen_level = 0;
-static struct astring remaining = ASTRING_INIT;
 
 /**************************************************************************
   Turn on buffering, using a counter so that calls may be nested.
@@ -46,9 +54,7 @@
   frozen_level++;
 
   if (frozen_level == 1) {
-    assert(remaining.str == NULL);
-    astr_minsize(&remaining, 1);
-    remaining.str[0] = '\0';
+    assert(remaining.lines == 0);
   }
 }
 
@@ -63,11 +69,14 @@
   assert(frozen_level >= 0);
 
   if (frozen_level == 0) {
-    if (remaining.n > 2) {
-      /* +1 to skip the initial '\n' */
-      append_output_window(remaining.str + 1);
+    int i;
+
+    for (i = 0; i < remaining.lines; i++) {
+      base_append_output_window(remaining.line[i].text,
+                               remaining.line[i].conn_id);
+      free(remaining.line[i].text);
     }
-    astr_free(&remaining);
+    remaining.lines = 0;
   }
 }
 
@@ -87,20 +96,19 @@
 **************************************************************************/
 void append_output_window(const char *astring)
 {
+  base_append_output_window(astring, -1);
+}
+
+void base_append_output_window(const char *astring, int conn_id)
+{
   if (frozen_level == 0) {
-    real_append_output_window(astring);
+    real_append_output_window(astring, conn_id);
   } else {
-    /* 
-     * len_src doesn't include the trailing '\0'
-     * len_dst does include the trailing '\0'
-     */
-    size_t len_src = strlen(astring), len_dst = remaining.n;
-
-    /* +1 for the "\n" */
-    astr_minsize(&remaining, len_dst + 1 + len_src);
-    remaining.str[len_dst - 1] = '\n';
-
-    /* +1 for the "\0" */
-    memcpy(&remaining.str[len_dst], astring, len_src + 1);
+    remaining.lines++;
+    remaining.line =
+       fc_realloc(remaining.line,
+                  remaining.lines * sizeof(*remaining.line));
+    remaining.line[remaining.lines - 1].text = mystrdup(astring);
+    remaining.line[remaining.lines - 1].conn_id = conn_id;
   }
 }
Index: client/chatline_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/chatline_common.h,v
retrieving revision 1.2
diff -u -r1.2 chatline_common.h
--- client/chatline_common.h    18 Jul 2003 22:02:24 -0000      1.2
+++ client/chatline_common.h    14 Jul 2004 21:49:30 -0000
@@ -17,6 +17,7 @@
 
 void send_chat(const char *message);
 
+void base_append_output_window(const char *astring, int conn_id);
 void append_output_window(const char *astring);
 
 void output_window_freeze(void);
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.134
diff -u -r1.134 climisc.c
--- client/climisc.c    25 Jun 2004 23:35:55 -0000      1.134
+++ client/climisc.c    14 Jul 2004 21:49:30 -0000
@@ -860,7 +860,7 @@
   my_vsnprintf(message, sizeof(message), format, ap);
   va_end(ap);
 
-  handle_chat_msg(message, x, y, event);
+  handle_chat_msg(message, x, y, event, aconnection.id);
 }
 
 /**************************************************************************
Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.137
diff -u -r1.137 control.c
--- client/control.c    25 Jun 2004 23:35:55 -0000      1.137
+++ client/control.c    14 Jul 2004 21:49:30 -0000
@@ -160,6 +160,7 @@
 
   update_unit_info_label(punit);
   update_menus();
+  if(punit) set_focus_tile(punit->x, punit->y);
 }
 
 /**************************************************************************
@@ -238,6 +239,14 @@
     candidate = find_best_focus_candidate(FALSE);
   }
 
+#if 0
+  /* We have to do this ourselves, and not rely on set_unit_focus(),
+   * because above we change punit_focus directly.
+   */
+  if(punit_old_focus && punit_old_focus!=punit_focus)
+    refresh_tile_mapcanvas(punit_old_focus->x, punit_old_focus->y, FALSE);
+#endif
+
   /* Accept current focus unit as last resort. */
   if (!candidate) {
     candidate = find_best_focus_candidate(TRUE);
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.135
diff -u -r1.135 mapview_common.c
--- client/mapview_common.c     25 Jun 2004 16:38:48 -0000      1.135
+++ client/mapview_common.c     14 Jul 2004 21:49:31 -0000
@@ -32,12 +32,15 @@
 #include "climap.h"
 #include "control.h"
 #include "goto.h"
-#include "mapview_common.h"
 #include "tilespec.h"
 
+#include "mapview_common.h"
+
 struct mapview_canvas mapview_canvas;
 struct overview overview;
 
+static struct map_position focus_tile = { -1, -1 };
+
 /* Arbitrary estimated maximums for width and height of a city description
  * text.  Eventually this may be determined dynamically. */
 #define MAX_CITY_DESC_WIDTH 128
@@ -52,6 +55,29 @@
 static void base_canvas_to_map_pos(int *map_x, int *map_y,
                                   int canvas_x, int canvas_y);
 static void center_tile_overviewcanvas(int map_x, int map_y);
+
+static void get_mapview_corners(int x[4], int y[4]);
+
+void set_focus_tile(int x, int y)
+{
+  struct map_position old = focus_tile;
+
+  assert(is_real_map_pos(x, y));
+  focus_tile.x = x;
+  focus_tile.y = y;
+
+  if (is_real_map_pos(old.x, old.x)) {
+    refresh_tile_mapcanvas(old.x, old.y, TRUE);
+  }
+  refresh_tile_mapcanvas(focus_tile.x, focus_tile.y, TRUE);
+}
+
+void get_focus_tile(int *x, int *y)
+{
+    *x=focus_tile.x;
+    *y=focus_tile.y;
+}
+
 static void get_mapview_corners(int x[4], int y[4]);
 static void redraw_overview(void);
 static void dirty_overview(void);
@@ -786,6 +812,53 @@
   }
 }
 
+void put_terrain(int x, int y, struct canvas *pcanvas,
+                int canvas_x, int canvas_y)
+{
+  struct drawn_sprite drawn_sprites[40];
+  int count = fill_terrain_sprite_array(drawn_sprites, x, y);
+  int i;
+  int unit_width = UNIT_TILE_WIDTH;
+  int unit_height = UNIT_TILE_HEIGHT;
+  int unit_offset_x = 0;
+  int unit_offset_y = 0;
+
+  for (i = 0; i < count; i++) {
+    if (drawn_sprites[i].sprite) {
+      int ox = drawn_sprites[i].offset_x, oy = drawn_sprites[i].offset_y;
+
+      canvas_put_sprite(pcanvas, canvas_x + ox, canvas_y + oy,
+                    drawn_sprites[i].sprite,
+                    unit_offset_x - ox, unit_offset_y - oy,
+                    unit_width - ox, unit_height - oy);
+    }
+  }
+}
+
+void put_city(struct city *pcity, struct canvas *pcanvas,
+             int canvas_x, int canvas_y)
+{
+  struct drawn_sprite drawn_sprites[40];
+  bool solid_bg;
+  int count = fill_city_sprite_array(drawn_sprites, pcity, &solid_bg);
+  int i;
+  int unit_width = UNIT_TILE_WIDTH;
+  int unit_height = UNIT_TILE_HEIGHT;
+  int unit_offset_x = 0;
+  int unit_offset_y = 0;
+
+  for (i = 0; i < count; i++) {
+    if (drawn_sprites[i].sprite) {
+      int ox = drawn_sprites[i].offset_x, oy = drawn_sprites[i].offset_y;
+
+      canvas_put_sprite(pcanvas, canvas_x + ox, canvas_y + oy,
+                    drawn_sprites[i].sprite,
+                    unit_offset_x - ox, unit_offset_y - oy,
+                    unit_width - ox, unit_height - oy);
+    }
+  }
+}
+
 /**************************************************************************
   Draw the given unit onto the canvas store at the given location.
 **************************************************************************/
@@ -1325,6 +1398,43 @@
   }
 }
 
+#ifdef NEVER
+static void tile_draw_focus(struct canvas *pcanvas,
+                           int map_x, int map_y,
+                           int canvas_x, int canvas_y,
+                           bool citymode)
+{
+  const int inset = (is_isometric ? 0 : 1);
+  enum direction8 dir;
+
+  if (citymode) {
+    return;
+  }
+
+  for (dir = 0; dir < 8; dir++) {
+    int start_x, start_y, end_x, end_y, adjc_x, adjc_y;
+
+    /* In non-iso view we draw the rectangle with an inset of 1.  This makes
+     * it easy to distinguish from the map grid.
+     *
+     * In iso-view the inset doesn't work perfectly (see comments about
+     * this elsewhere) so we draw without an inset.  This may cover up the
+     * map grid if it is drawn. */
+    if (get_tile_boundaries(dir, inset, 1, &start_x, &start_y, 
+                            &end_x, &end_y)) {
+
+    /** Focus tile **/
+    if ((map_x == focus_tile.x && map_y == focus_tile.y)
+       || (is_isometric && MAPSTEP(adjc_x, adjc_y, map_x, map_y, dir)
+           && (map_x == focus_tile.x && map_y == focus_tile.y))) {
+      canvas_put_line(pcanvas, COLOR_STD_RED, LINE_NORMAL,
+                     canvas_x + start_x, canvas_y + start_y,
+                     end_x - start_x, end_y - start_y);
+      }
+    }
+  }
+}
+#endif
 
 /****************************************************************************
    Draw the grid lines of the given map tile at the given canvas position
@@ -1541,6 +1651,11 @@
 {
   const int dx = max_desc_width - NORMAL_TILE_WIDTH, dy = max_desc_height;
 
+  canvas_x = 0;
+  canvas_y = 0;
+  width = mapview_canvas.width;
+  height = mapview_canvas.height;
+  
   if (!draw_city_names && !draw_city_productions) {
     return;
   }
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.70
diff -u -r1.70 mapview_common.h
--- client/mapview_common.h     25 Jun 2004 13:53:25 -0000      1.70
+++ client/mapview_common.h     14 Jul 2004 21:49:31 -0000
@@ -20,8 +20,9 @@
 #include "colors_g.h"
 
 struct unit;
+struct city;
 
-struct canvas_store;           /* opaque type, real type is gui-dep */
+struct canvas;         /* opaque type, real type is gui-dep */
 
 struct mapview_canvas {
   int gui_x0, gui_y0;
@@ -145,6 +146,10 @@
              int unit_width, int unit_height);
 void put_unit_full(struct unit *punit, struct canvas *pcanvas,
                   int canvas_x, int canvas_y);
+void put_terrain(int x, int y, struct canvas *pcanvas,
+                int canvas_x, int canvas_y);
+void put_city(struct city *pcity, struct canvas *pcanvas,
+             int canvas_x, int canvas_y);
 
 void put_city_tile_output(struct city *pcity, int city_x, int city_y,
                          struct canvas *pcanvas,
@@ -197,7 +202,8 @@
                         int map_x, int map_y);
 void overview_to_map_pos(int *map_x, int *map_y,
                         int overview_x, int overview_y);
-
+void set_focus_tile(int x, int y);
+void get_focus_tile(int *x, int *y);
 void refresh_overview_canvas(void);
 void overview_update_tile(int x, int y);
 void set_overview_dimensions(int width, int height);
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.387
diff -u -r1.387 packhand.c
--- client/packhand.c   12 Jul 2004 17:22:02 -0000      1.387
+++ client/packhand.c   14 Jul 2004 21:49:31 -0000
@@ -850,7 +850,7 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void handle_chat_msg(char *message, int x, int y, enum event_type event)
+void handle_chat_msg(char *message, int x, int y, enum event_type event, int 
conn_id)
 {
   int where = MW_OUTPUT;       /* where to display the message */
   
@@ -862,7 +862,7 @@
   }
 
   if (BOOL_VAL(where & MW_OUTPUT)) {
-    append_output_window(message);
+    base_append_output_window(message,conn_id);
   }
   if (BOOL_VAL(where & MW_MESSAGES)) {
     add_notify_window(message, x, y, event);
@@ -1519,6 +1519,7 @@
   char msg[MAX_LEN_MSG];
   struct player *pplayer = &game.players[pinfo->playerno];
 
+  freelog(LOG_NORMAL,"player_info id=%d name=%s",pinfo->playerno,pinfo->name);
   sz_strlcpy(pplayer->name, pinfo->name);
 
   pplayer->nation=pinfo->nation;
@@ -1641,7 +1642,7 @@
 {
   struct connection *pconn = find_conn_by_id(pinfo->id);
 
-  freelog(LOG_DEBUG, "conn_info id%d used%d est%d plr%d obs%d acc%d",
+  freelog(LOG_NORMAL, "conn_info id%d used%d est%d plr%d obs%d acc%d",
          pinfo->id, pinfo->used, pinfo->established, pinfo->player_num,
          pinfo->observer, (int)pinfo->access_level);
   freelog(LOG_DEBUG, "conn_info \"%s\" \"%s\" \"%s\"",
Index: client/packhand_gen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand_gen.c,v
retrieving revision 1.5
diff -u -r1.5 packhand_gen.c
--- client/packhand_gen.c       6 Jun 2004 21:02:15 -0000       1.5
+++ client/packhand_gen.c       14 Jul 2004 21:49:31 -0000
@@ -102,7 +102,8 @@
       ((struct packet_chat_msg *)packet)->message,
       ((struct packet_chat_msg *)packet)->x,
       ((struct packet_chat_msg *)packet)->y,
-      ((struct packet_chat_msg *)packet)->event);
+      ((struct packet_chat_msg *)packet)->event,
+      ((struct packet_chat_msg *)packet)->conn_id);
     return TRUE;
 
   case PACKET_CITY_REMOVE:
Index: client/packhand_gen.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand_gen.h,v
retrieving revision 1.5
diff -u -r1.5 packhand_gen.h
--- client/packhand_gen.h       6 Jun 2004 21:02:15 -0000       1.5
+++ client/packhand_gen.h       14 Jul 2004 21:49:31 -0000
@@ -34,7 +34,7 @@
 void handle_game_info(struct packet_game_info *packet);
 void handle_map_info(int xsize, int ysize, int topology_id);
 void handle_nuke_tile_info(int x, int y);
-void handle_chat_msg(char *message, int x, int y, enum event_type event);
+void handle_chat_msg(char *message, int x, int y, enum event_type event, int 
conn_id);
 void handle_city_remove(int city_id);
 struct packet_city_info;
 void handle_city_info(struct packet_city_info *packet);
Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.5
diff -u -r1.5 text.c
--- client/text.c       25 Jun 2004 23:35:55 -0000      1.5
+++ client/text.c       14 Jul 2004 21:49:31 -0000
@@ -130,7 +130,7 @@
 ****************************************************************************/
 const char *popup_info_text(int map_x, int map_y)
 {
-  const char *activity_text;
+  const char *activity_text = concat_tile_activity_text(map_x, map_y);
   struct city *pcity = map_get_city(map_x, map_y);
   struct tile *ptile = map_get_tile(map_x, map_y);
   struct unit *punit = find_visible_unit(ptile);
@@ -233,7 +233,6 @@
     add_line(_("Infrastructure: %s"),
             map_get_infrastructure_text(ptile->special));
   }
-  activity_text = concat_tile_activity_text(map_x, map_y);
   if (strlen(activity_text) > 0) {
     add_line(_("Activity: %s"), activity_text);
   }
@@ -704,3 +703,365 @@
           textyear(game.year));
   RETURN;
 }
+
+const char *mapview_get_terrain_tooltip_text(int x, int y)
+{
+  int infrastructure = get_tile_infrastructure_set(map_get_tile(x, y));
+  INIT;
+
+  add_line(_("Location: (%d, %d) [%d]"),
+          x, y, map_get_tile(x, y)->continent);
+  add_line("%s", map_get_tile_info_text(x, y));
+  if (infrastructure) {
+    add_line("%s",
+            map_get_infrastructure_text(infrastructure));
+  }
+  RETURN;
+}
+
+static void calc_effect(enum unit_activity activity, int x, int y, int diff[3])
+{
+  struct tile backup;
+  int stats_before[3], stats_after[3];
+
+  stats_before[0] = get_food_tile(x,y);
+  stats_before[1] = get_shields_tile(x,y);
+  stats_before[2] = get_trade_tile(x,y);
+
+  /* BEWARE UGLY HACK AHEAD */
+
+  memcpy(&backup, map_get_tile(x, y), sizeof(backup));
+
+  switch (activity) {
+  case ACTIVITY_ROAD:
+    map_set_special(x, y, S_ROAD);
+    break;
+  case ACTIVITY_RAILROAD:
+    map_set_special(x, y, S_RAILROAD);
+    break;
+  case ACTIVITY_MINE:
+    map_mine_tile(x, y);
+    break;
+
+  case ACTIVITY_IRRIGATE:
+    map_irrigate_tile(x, y);
+    break;
+
+  case ACTIVITY_TRANSFORM:
+    map_transform_tile(x, y);
+    break;
+  default:
+    assert(0);
+  }
+
+  stats_after[0] = get_food_tile(x,y);
+  stats_after[1] = get_shields_tile(x,y);
+  stats_after[2] = get_trade_tile(x,y);
+
+  memcpy(map_get_tile(x, y), &backup, sizeof(backup));
+
+  /* hopefully everything is now back in place */
+
+  diff[0] = stats_after[0] - stats_before[0];
+  diff[1] = stats_after[1] - stats_before[1];
+  diff[2] = stats_after[2] - stats_before[2];
+}
+
+static const char *format_effect(enum unit_activity activity,
+                                struct unit *punit)
+{
+  char parts[3][25];
+  int diff[3];
+  int n = 0;
+  INIT;
+
+  calc_effect(activity, punit->x, punit->y, diff);
+
+  if (diff[0] != 0) {
+    my_snprintf(parts[n], sizeof(parts[n]), _("%+d food"), diff[0]);
+    n++;
+  }
+
+  if (diff[1] != 0) {
+    my_snprintf(parts[n], sizeof(parts[n]), _("%+d shield"), diff[1]);
+    n++;
+  }
+
+  if (diff[2] != 0) {
+    my_snprintf(parts[n], sizeof(parts[n]), _("%+d trade"), diff[2]);
+    n++;
+  }
+  if (n == 0) {
+    add(_("none"));
+  } else if (n == 1) {
+    add("%s", parts[0]);
+  } else if (n == 2) {
+    add("%s %s", parts[0], parts[1]);
+  } else if (n == 3) {
+    add("%s %s %s", parts[0], parts[1],                parts[2]);
+  } else {
+    assert(0);
+  }
+  RETURN;
+}
+
+const char *mapview_get_unit_action_tooltip(struct unit *punit,
+                                           const char *action,
+                                           const char *shortcut_)
+{
+  char shortcut[256];
+  INIT;
+
+  if (shortcut_) {
+    my_snprintf(shortcut, sizeof(shortcut), " (%s)", shortcut_);
+  } else {
+    my_snprintf(shortcut, sizeof(shortcut), "%s", "");
+  }
+
+  if (strcmp(action, "unit_fortifying") == 0) {
+    add_line(_("Fortify%s"),shortcut);
+    add_line(_("Time: 1 turn, then till changed"));
+    add_line(_("Effect: +50%% defense bonus"));
+  } else if (strcmp(action, "unit_disband") == 0) {
+    add_line(_("Disband%s"),shortcut);
+    add_line(_("Time: instantly, unit is destroyed"));
+  } else if (strcmp(action, "unit_return_nearest") == 0) {
+    add_line(_("Return to nearest city%s"),shortcut);
+    add_line(_("Time: unknown"));
+  } else if (strcmp(action, "unit_sentry") == 0) {
+    add_line(_("Sentry%s"),shortcut);
+    add_line(_("Time: instantly, till changed"));
+    add_line(_("Effect: Unit wakes up if enemy is near"));
+  } else if (strcmp(action, "unit_add_to_city") == 0) {
+    add_line(_("Add to city%s"),shortcut);
+    add_line(_("Time: instantly, unit is destroyed"));
+    add_line(_("Effect: city size +1"));
+  } else if (strcmp(action, "unit_build_city") == 0) {
+    add_line(_("Build city%s"),shortcut);
+    add_line(_("Time: instantly, unit is destroyed"));
+    add_line(_("Effect: create a city of size 1"));
+  } else if (strcmp(action, "unit_road") == 0) {
+    add_line(_("Build road%s"),shortcut);
+    add_line(_("Time: %d turns"),
+            map_get_turns_for_activity(ACTIVITY_ROAD, punit));
+    add_line(_("Effect: %s"),
+            format_effect(ACTIVITY_ROAD, punit));
+  } else if (strcmp(action, "unit_irrigate") == 0) {
+    add_line(_("Build irrigation%s"),shortcut);
+    add_line(_("Time: %d turns"),
+            map_get_turns_for_activity(ACTIVITY_IRRIGATE, punit));
+    add_line(_("Effect: %s"),
+            format_effect(ACTIVITY_IRRIGATE, punit));
+  } else if (strcmp(action, "unit_mine") == 0) {
+    add_line(_("Build mine%s"),shortcut);
+    add_line(_("Time: %d turns"),
+            map_get_turns_for_activity(ACTIVITY_MINE, punit));
+    add_line(_("Effect: %s"),
+            format_effect(ACTIVITY_MINE, punit));
+  } else if (strcmp(action, "unit_auto_settler") == 0) {
+    add_line(_("Auto-Settle%s"),shortcut);
+    add_line(_("Time: unknown"));
+    add_line(_("Effect: the computer performs settler activities"));
+  } else {
+#if 0
+  ttype = map_get_tile(punit->x, punit->y)->terrain;
+  tinfo = get_tile_type(ttype);
+  if ((tinfo->irrigation_result != T_LAST)
+      && (tinfo->irrigation_result != ttype)) {
+    my_snprintf(irrtext, sizeof(irrtext), irrfmt,
+               (get_tile_type(tinfo->irrigation_result))->terrain_name);
+  } else if (map_has_special(punit->x, punit->y, S_IRRIGATION)
+            && player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) {
+    sz_strlcpy(irrtext, _("Bu_ild Farmland"));
+  }
+  if ((tinfo->mining_result != T_LAST) && (tinfo->mining_result != ttype)) {
+    my_snprintf(mintext, sizeof(mintext), minfmt,
+               (get_tile_type(tinfo->mining_result))->terrain_name);
+  }
+  if ((tinfo->transform_result != T_LAST)
+      && (tinfo->transform_result != ttype)) {
+    my_snprintf(transtext, sizeof(transtext), transfmt,
+               (get_tile_type(tinfo->transform_result))->terrain_name);
+  }
+
+  menus_rename("<main>/_Orders/Build _Irrigation", irrtext);
+  menus_rename("<main>/_Orders/Build _Mine", mintext);
+  menus_rename("<main>/_Orders/Transf_orm Terrain", transtext);
+#endif
+    add_line("tooltip for action %s isn't written yet",
+            action);
+    freelog(LOG_NORMAL, "warning: get_unit_action_tooltip: unknown action %s",
+           action);
+  }
+  RETURN;
+}
+
+const char *mapview_get_city_action_tooltip(struct city *pcity,
+                                           const char *action,
+                                           const char *shortcut_)
+{
+  INIT;
+
+  if (strcmp(action, "city_buy") == 0) {
+    const char *name;
+
+    if (pcity->is_building_unit) {
+      name = get_unit_type(pcity->currently_building)->name;
+    } else {
+      name = get_impr_name_ex(pcity, pcity->currently_building);
+    }
+
+    add_line(_("Buy production"));
+    add_line(_("Cost: %d (%d in treasury)"),
+            city_buy_cost(pcity), game.player_ptr->economic.gold);
+    add_line(_("Producting: %s (%d turns)"), name,
+            city_turns_to_build(pcity, pcity->currently_building,
+                                pcity->is_building_unit, TRUE));
+  } else {
+    add_line("tooltip for action %s isn't written yet", action);
+    freelog(LOG_NORMAL,
+           "warning: get_city_action_tooltip: unknown action %s", action);
+  }
+  RETURN;
+}  
+
+/************************************************************************
+Text to popup on middle-click
+************************************************************************/
+const char *mapview_get_terrain_info_text(int map_x, int map_y)
+{
+  const char *activity_text = concat_tile_activity_text(map_x, map_y);
+  struct tile *ptile = map_get_tile(map_x, map_y);
+  const char *diplo_nation_plural_adjectives[DS_LAST] =
+    {Q_("?nation:Neutral"), Q_("?nation:Hostile"),
+     "" /* unused, DS_CEASEFIRE*/,
+     Q_("?nation:Peaceful"), Q_("?nation:Friendly"), 
+     Q_("?nation:Mysterious")};
+  INIT;
+
+  add_line(_("Terrain: %s"),
+          map_get_tile_info_text(map_x, map_y));
+  add_line(_("Food/Prod/Trade: %s"),
+          map_get_tile_fpt_text(map_x, map_y));
+  if (tile_has_special(ptile, S_HUT)) {
+    add_line(_("Minor Tribe Village"));
+  }
+  if (game.borders > 0) {
+    struct player *owner = map_get_owner(map_x, map_y);
+    struct player_diplstate *ds = game.player_ptr->diplstates;
+
+    if (owner == game.player_ptr){
+      add_line(_("Our Territory"));
+    } else if (owner) {
+      if (ds[owner->player_no].type == DS_CEASEFIRE) {
+       int turns = ds[owner->player_no].turns_left;
+
+       add_line(PL_("%s territory (%d turn ceasefire)",
+                                      "%s territory (%d turn ceasefire)",
+                                      turns),
+                get_nation_name(owner->nation), turns);
+      } else {
+       add_line(_("Territory of the %s %s"),
+                diplo_nation_plural_adjectives[ds[owner->player_no].type],
+                get_nation_name_plural(owner->nation));
+      }
+    } else {
+      add_line(_("Unclaimed territory"));
+    }
+  }
+  if (get_tile_infrastructure_set(ptile)) {
+    add_line(_("Infrastructure: %s"),
+            map_get_infrastructure_text(ptile->special));
+  }
+  if (strlen(activity_text)) {
+    add_line(_("Activity: %s"), activity_text);
+  }
+  RETURN;
+}
+
+const char *mapview_get_city_tooltip_text(struct city *pcity)
+{
+  struct player *owner = city_owner(pcity);
+  INIT;
+
+  add_line("%s", pcity->name);
+  add_line("%s", owner->name);
+  RETURN;
+}
+
+const char *mapview_get_city_info_text(struct city *pcity)
+{
+  struct player *owner = city_owner(pcity);
+  INIT;
+
+  add_line(_("City: %s (%s)"), pcity->name,
+          get_nation_name(owner->nation));
+  if (city_got_citywalls(pcity)) {
+    add(_(" with City Walls"));
+  }
+  RETURN;
+}
+
+const char *mapview_get_unit_tooltip_text(struct unit *punit)
+{
+  struct unit_type *ptype = unit_type(punit);
+  struct city *pcity =
+      player_find_city_by_id(game.player_ptr, punit->homecity);
+  INIT;
+
+  add("%s", ptype->name);
+  if (ptype->veteran[punit->veteran].name[0] != '\0') {
+    add(" (%s)", ptype->veteran[punit->veteran].name);
+  }
+  add("\n");
+  add_line("%s", unit_activity_text(punit));
+  if (pcity) {
+    add_line("%s", pcity->name);
+  }
+  RETURN;
+}
+
+const char *mapview_get_unit_info_text(struct unit *punit)
+{
+  int map_x = punit->x;
+  int map_y = punit->y;
+  const char *activity_text = concat_tile_activity_text(map_x, map_y);
+  INIT;
+
+  if (strlen(activity_text)) {
+    add_line(_("Activity: %s"), activity_text);
+  }
+  if (punit) {
+    char tmp[64] = { 0 };
+    struct unit_type *ptype = unit_type(punit);
+
+    if (punit->owner == game.player_idx) {
+      struct city *pcity =
+         player_find_city_by_id(game.player_ptr, punit->homecity);
+
+      if (pcity){
+       my_snprintf(tmp, sizeof(tmp), "/%s", pcity->name);
+      }
+    }
+    add_line(_("Unit: %s(%s%s)"), ptype->name,
+            get_nation_name(unit_owner(punit)->nation), tmp);
+    if (punit->owner != game.player_idx) {
+      struct unit *apunit = get_unit_in_focus();
+
+      if (apunit) {
+       /* chance to win when active unit is attacking the selected unit */
+       int att_chance = unit_win_chance(apunit, punit) * 100;
+       
+       /* chance to win when selected unit is attacking the active unit */
+       int def_chance = (1.0 - unit_win_chance(punit, apunit)) * 100;
+       
+       add_line(_("Chance to win: A:%d%% D:%d%%"), att_chance, def_chance);
+      }
+    }
+    add_line(_("A:%d D:%d FP:%d HP:%d/%d%s"),
+            ptype->attack_strength,
+            ptype->defense_strength, ptype->firepower, punit->hp,
+            ptype->hp, punit->veteran ? _(" V") : "");
+  } 
+  RETURN;
+}
Index: client/text.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.h,v
retrieving revision 1.2
diff -u -r1.2 text.h
--- client/text.h       25 Apr 2004 18:30:00 -0000      1.2
+++ client/text.h       14 Jul 2004 21:49:31 -0000
@@ -40,4 +40,17 @@
 const char *get_ping_time_text(struct player *pplayer);
 const char *get_report_title(const char *report_name);
 
+const char *mapview_get_terrain_tooltip_text(int x, int y);
+const char *mapview_get_unit_action_tooltip(struct unit *punit,
+                                           const char *action,
+                                           const char *shortcut_);
+const char *mapview_get_city_action_tooltip(struct city *pcity,
+                                           const char *action,
+                                           const char *shortcut_);
+const char *mapview_get_terrain_info_text(int map_x, int map_y);
+const char *mapview_get_city_tooltip_text(struct city *pcity);
+const char *mapview_get_city_info_text(struct city *pcity);
+const char *mapview_get_unit_tooltip_text(struct unit *punit);
+const char *mapview_get_unit_info_text(struct unit *punit);
+
 #endif /* FC__TEXT_H */
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.182
diff -u -r1.182 tilespec.c
--- client/tilespec.c   10 Jul 2004 18:48:17 -0000      1.182
+++ client/tilespec.c   14 Jul 2004 21:49:31 -0000
@@ -1766,6 +1766,62 @@
 #define ADD_SPRITE_SIMPLE(s) ADD_SPRITE(s, DRAW_NORMAL, TRUE, 0, 0)
 #define ADD_SPRITE_FULL(s) ADD_SPRITE(s, DRAW_FULL, TRUE, 0, 0)
 
+/**********************************************************************
+  Fill in the sprite array for the city
+***********************************************************************/
+int fill_city_sprite_array(struct drawn_sprite *sprs,
+                          struct city *pcity, bool *solid_bg)
+{
+  struct drawn_sprite *save_sprs = sprs;
+
+  *solid_bg = FALSE;
+
+  if (!solid_color_behind_units) {
+    ADD_SPRITE(get_city_nation_flag_sprite(pcity), DRAW_FULL, TRUE,
+              flag_offset_x, flag_offset_y);
+  } else {
+    *solid_bg = TRUE;
+  }
+
+  if (pcity->client.occupied) {
+    ADD_SPRITE_SIMPLE(get_city_occupied_sprite(pcity));
+  }
+
+  ADD_SPRITE_SIMPLE(get_city_sprite(pcity));
+
+  if (city_got_citywalls(pcity)) {
+    ADD_SPRITE_SIMPLE(get_city_wall_sprite(pcity));
+  }
+
+  if (map_has_special(pcity->x, pcity->y, S_POLLUTION)) {
+    ADD_SPRITE_SIMPLE(sprites.tx.pollution);
+  }
+  if (map_has_special(pcity->x, pcity->y, S_FALLOUT)) {
+    ADD_SPRITE_SIMPLE(sprites.tx.fallout);
+  }
+
+  if (pcity->client.unhappy) {
+    ADD_SPRITE_SIMPLE(sprites.city.disorder);
+  }
+
+  if (tile_get_known(pcity->x, pcity->y) == TILE_KNOWN_FOGGED
+      && draw_fog_of_war) {
+    ADD_SPRITE_SIMPLE(sprites.tx.fog);
+  }
+
+  /* Put the size sprites last, so that they are not obscured
+   * (and because they can be hard to read if fogged).
+   */
+  if (pcity->size >= 10) {
+    assert(pcity->size < 100);
+    ADD_SPRITE_SIMPLE(sprites.city.size_tens[pcity->size / 10]);
+  }
+
+  ADD_SPRITE_SIMPLE(sprites.city.size[pcity->size % 10]);
+
+  return sprs - save_sprs;
+}
+
 /**************************************************************************
   Assemble some data that is used in building the tile sprite arrays.
     (map_x, map_y) : the (normalized) map position
@@ -2303,7 +2359,7 @@
   Add sprites for the base terrain to the sprite list.  This doesn't
   include specials or rivers.
 ****************************************************************************/
-static int fill_terrain_sprite_array(struct drawn_sprite *sprs,
+static int fill_terrain_sprite_array0(struct drawn_sprite *sprs,
                                     int map_x, int map_y,
                                     enum tile_terrain_type *ttype_near)
 {
@@ -2528,15 +2584,12 @@
   build_tile_data(map_x, map_y,
                  &ttype, &tspecial, ttype_near, tspecial_near);
 
-  /* Terrain and specials. */
-  if (!unit_only && !city_only) {
-    sprs += fill_terrain_sprite_array(sprs, map_x, map_y, ttype_near);
+  sprs += fill_terrain_sprite_array0(sprs, map_x, map_y, ttype_near);
 
-    if (is_ocean(ttype) && draw_terrain) {
-      for (dir = 0; dir < 4; dir++) {
-       if (contains_special(tspecial_near[DIR4_TO_DIR8[dir]], S_RIVER)) {
-         ADD_SPRITE_SIMPLE(sprites.tx.river_outlet[dir]);
-       }
+  if (is_ocean(ttype) && draw_terrain) {
+    for (dir = 0; dir < 4; dir++) {
+      if (contains_special(tspecial_near[DIR4_TO_DIR8[dir]], S_RIVER)) {
+       ADD_SPRITE_SIMPLE(sprites.tx.river_outlet[dir]);
       }
     }
 
@@ -2640,13 +2693,103 @@
               FALSE, 0, 0);
   }
 
-  if (punit && !city_only
-      && (draw_units || (punit == pfocus && draw_focus_unit))) {
+  if (punit && (draw_units || (punit == pfocus && draw_focus_unit))) {
     bool stacked = (unit_list_size(&map_get_tile(map_x, map_y)->units) > 1);
-    bool backdrop = !pcity && !unit_only;
-    bool dummy;
+    bool backdrop = !pcity;
+
+    sprs += fill_unit_sprite_array(sprs, punit, solid_bg, stacked, backdrop);
+  }
+
+  if (draw_fortress_airbase && contains_special(tspecial, S_FORTRESS)) {
+    ADD_SPRITE_FULL(sprites.tx.fortress);
+  }
+
+  return sprs - save_sprs;
+}
+
+int fill_terrain_sprite_array(struct drawn_sprite *sprs, int x, int y)
+{
+  enum tile_terrain_type ttype, ttype_near[8];
+  enum tile_special_type tspecial, tspecial_near[8];
+  struct drawn_sprite *save_sprs = sprs;
+
+  if (tile_get_known(x, y) == TILE_UNKNOWN)
+    return -1;
+
+  build_tile_data(x, y, &ttype, &tspecial, ttype_near, tspecial_near);
+
+  sprs += fill_terrain_sprite_array0(sprs, x, y, ttype_near);
+  return sprs - save_sprs;
+}
+
+/**********************************************************************
+  Fill in the sprite array for the tile at position (abs_x0,abs_y0)
+
+The sprites are drawn in the following order:
+ 1) basic terrain type
+ 2) river
+ 3) irritation
+ 4) road/railroad
+ 5) specials
+ 6) mine
+ 7) hut
+ 8) fortress
+ 9) airbase
+10) pollution
+11) fallout
+12) FoW
+***********************************************************************/
+#if 0
+int fill_tile_sprite_array(struct drawn_sprite *sprs, int abs_x0, int abs_y0,
+                          bool citymode, bool *solid_bg,
+                          enum color_std *bg_color)
+{
+  enum tile_terrain_type ttype, ttype_near[8];
+  enum tile_special_type tspecial, tspecial_near[8];
+  int dir, tileno;
+  struct tile *ptile;
+  struct city *pcity;
+  struct unit *pfocus;
+  struct unit *punit;
+  struct drawn_sprite *save_sprs = sprs;
+
+  *solid_bg = FALSE;
+  *bg_color = COLOR_STD_BACKGROUND;
+
+  ptile=map_get_tile(abs_x0, abs_y0);
+
+  if (tile_get_known(abs_x0, abs_y0) == TILE_UNKNOWN) {
+    return 0;
+  }
+
+  pcity=map_get_city(abs_x0, abs_y0);
+  pfocus=get_unit_in_focus();
 
-    sprs += fill_unit_sprite_array(sprs, punit, &dummy, stacked, backdrop);
+  if (solid_color_behind_units) {
+    punit = get_drawable_unit(abs_x0, abs_y0, citymode);
+    if (punit && (draw_units || (draw_focus_unit && pfocus == punit))) {
+      bool stacked = (unit_list_size(&ptile->units) > 1);
+
+      sprs += fill_unit_sprite_array(sprs, punit, solid_bg,
+                                    stacked, TRUE);
+
+      *bg_color = player_color(unit_owner(punit));
+      return sprs - save_sprs;
+    }
+
+    if (pcity && draw_cities) {
+      sprs += fill_city_sprite_array(sprs, pcity, solid_bg);
+      *bg_color = player_color(city_owner(pcity));
+      return sprs - save_sprs;
+    }
+  }
+  build_tile_data(abs_x0, abs_y0, 
+                 &ttype, &tspecial, ttype_near, tspecial_near);
+
+  sprs += fill_terrain_sprite_array0(sprs, abs_x0, abs_y0, ttype_near);
+
+  if (!draw_terrain) {
+    *solid_bg = TRUE;
   }
 
   if (!unit_only && !city_only) {
@@ -2666,6 +2809,7 @@
 
   return sprs - save_sprs;
 }
+#endif
 
 /**********************************************************************
   Set city tiles sprite values; should only happen after
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.75
diff -u -r1.75 tilespec.h
--- client/tilespec.h   10 Jul 2004 18:48:17 -0000      1.75
+++ client/tilespec.h   14 Jul 2004 21:49:31 -0000
@@ -72,6 +72,12 @@
                           int map_x, int map_y, bool citymode);
 int fill_unit_sprite_array(struct drawn_sprite *sprs, struct unit *punit,
                           bool *solid_bg, bool stack, bool backdrop);
+int fill_city_sprite_array_iso(struct drawn_sprite *sprs,
+                              struct city *pcity);
+int fill_terrain_sprite_array(struct drawn_sprite *sprs, int abs_x0,
+                             int abs_y0);
+int fill_city_sprite_array(struct drawn_sprite *sprs,
+                          struct city *pcity, bool *solid_bg);
 
 enum color_std player_color(struct player *pplayer);
 enum color_std overview_tile_color(int x, int y);
Index: client/gui-gtk/chatline.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/chatline.c,v
retrieving revision 1.21
diff -u -r1.21 chatline.c
--- client/gui-gtk/chatline.c   1 Apr 2004 01:28:56 -0000       1.21
+++ client/gui-gtk/chatline.c   14 Jul 2004 21:49:31 -0000
@@ -65,7 +65,7 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void real_append_output_window(const char *astring)
+void real_append_output_window(const char *astring, int conn_id)
 {
   bool scroll;
   GtkAdjustment *slider =
Index: client/gui-gtk-2.0/chatline.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/chatline.c,v
retrieving revision 1.9
diff -u -r1.9 chatline.c
--- client/gui-gtk-2.0/chatline.c       1 Apr 2004 01:20:20 -0000       1.9
+++ client/gui-gtk-2.0/chatline.c       14 Jul 2004 21:49:31 -0000
@@ -67,7 +67,7 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void real_append_output_window(const char *astring)
+void real_append_output_window(const char *astring, int conn_id)
 {
  GtkWidget *sw;
  GtkAdjustment *slider;
Index: client/gui-mui/chatline.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/chatline.c,v
retrieving revision 1.7
diff -u -r1.7 chatline.c
--- client/gui-mui/chatline.c   14 Nov 2002 09:14:56 -0000      1.7
+++ client/gui-mui/chatline.c   14 Jul 2004 21:49:31 -0000
@@ -34,7 +34,7 @@
 #include "gui_main.h"
 #include "muistuff.h"
 
-void real_append_output_window(const char *astring)
+void real_append_output_window(const char *astring, int conn_id)
 {
   DoMethod(main_output_listview, MUIM_NList_Insert, astring, -2, 
MUIV_List_Insert_Bottom);
   set(main_output_listview,MUIA_NList_First,  MUIV_NList_First_Bottom);
Index: client/gui-sdl/chatline.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/chatline.c,v
retrieving revision 1.14
diff -u -r1.14 chatline.c
--- client/gui-sdl/chatline.c   4 Dec 2003 13:53:12 -0000       1.14
+++ client/gui-sdl/chatline.c   14 Jul 2004 21:49:32 -0000
@@ -132,7 +132,7 @@
   Appends the string to the chat output window.
   Curretn it is wraper to message subsystem.
 **************************************************************************/
-void real_append_output_window(const char *astring)
+void real_append_output_window(const char *astring, int conn_id)
 {
   if (pConnDlg) {
     Uint16 *pUniStr;
Index: client/gui-stub/chatline.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/chatline.c,v
retrieving revision 1.4
diff -u -r1.4 chatline.c
--- client/gui-stub/chatline.c  30 Nov 2002 19:27:36 -0000      1.4
+++ client/gui-stub/chatline.c  14 Jul 2004 21:49:32 -0000
@@ -23,7 +23,7 @@
   Appends the string to the chat output window.  The string should be
   inserted on its own line, although it will have no newline.
 **************************************************************************/
-void real_append_output_window(const char *astring)
+void real_append_output_window(const char *astring, int conn_id)
 {
   /* PORTME */
 }
Index: client/gui-win32/chatline.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/chatline.c,v
retrieving revision 1.10
diff -u -r1.10 chatline.c
--- client/gui-win32/chatline.c 18 Jul 2003 22:02:25 -0000      1.10
+++ client/gui-win32/chatline.c 14 Jul 2004 21:49:32 -0000
@@ -85,10 +85,9 @@
 }
 
 /**************************************************************************
-
+  PS We need to add \r to lineends.
 **************************************************************************/
-void real_append_output_window(const char *astring) 
-     /* We need to add \r to lineends */ 
+void real_append_output_window(const char *astring, int conn_id)
 {
 
   const char *str;
Index: client/gui-xaw/chatline.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/chatline.c,v
retrieving revision 1.22
diff -u -r1.22 chatline.c
--- client/gui-xaw/chatline.c   24 Oct 2003 00:03:01 -0000      1.22
+++ client/gui-xaw/chatline.c   14 Jul 2004 21:49:32 -0000
@@ -72,7 +72,7 @@
 
  Now uses window's font size and width.  Assumes fixed-width font.  --jjm
 **************************************************************************/
-void real_append_output_window(const char *input_string)
+void real_append_output_window(const char *astring, int conn_id)
 {
   static int m_width=0;
 
Index: client/include/chatline_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/chatline_g.h,v
retrieving revision 1.2
diff -u -r1.2 chatline_g.h
--- client/include/chatline_g.h 27 Jun 2002 00:59:21 -0000      1.2
+++ client/include/chatline_g.h 14 Jul 2004 21:49:32 -0000
@@ -15,7 +15,7 @@
 
 #include "chatline_common.h"
 
-void real_append_output_window(const char *astring);
+void real_append_output_window(const char *astring, int conn_id);
 void log_output_window(void);
 void clear_output_window(void);
 
Index: client/include/diplodlg_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/diplodlg_g.h,v
retrieving revision 1.4
diff -u -r1.4 diplodlg_g.h
--- client/include/diplodlg_g.h 2 Feb 2004 07:23:45 -0000       1.4
+++ client/include/diplodlg_g.h 14 Jul 2004 21:49:32 -0000
@@ -13,9 +13,10 @@
 #ifndef FC__DIPLODLG_G_H
 #define FC__DIPLODLG_G_H
 
-#include "diptreaty.h"
 #include "shared.h"
 
+#include "diptreaty.h"
+
 void handle_diplomacy_init_meeting(int counterpart, int initiated_from);
 void handle_diplomacy_cancel_meeting(int counterpart, int initiated_from);
 void handle_diplomacy_create_clause(int counterpart, int giver,
Index: client/include/mapview_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/mapview_g.h,v
retrieving revision 1.54
diff -u -r1.54 mapview_g.h
--- client/include/mapview_g.h  23 Jun 2004 14:50:44 -0000      1.54
+++ client/include/mapview_g.h  14 Jul 2004 21:49:32 -0000
@@ -75,4 +75,7 @@
 void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h);
 void tileset_changed(void);
 
+void popup_mapcanvas(void);
+void popdown_mapcanvas(void);
+
 #endif  /* FC__MAPVIEW_G_H */
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.172
diff -u -r1.172 capstr.c
--- common/capstr.c     12 Jul 2004 03:03:28 -0000      1.172
+++ common/capstr.c     14 Jul 2004 21:49:32 -0000
@@ -77,7 +77,7 @@
                    "+starter +union +iso_maps +big_map_size +orders2client " \
                    "+change_production +tilespec1 +no_earth +trans " \
                    "+want_hack invasions bombard +killstack2 spec +spec2 " \
-                   "+city_map startunits +turn_last_built"
+                   "+city_map startunits +turn_last_built +chat_conn"
 
 /* "+1.14.delta" is the new delta protocol for 1.14.0-dev.
  *
@@ -127,6 +127,10 @@
  * "startunits" means the initial units are stored as a server string var.
  *
  * "turn_last_built" means that turn_last_built is stored as a turn
+ *
+ * "chat_conn" means that chat message also contain the connection id
+ * of the source.
+ *
  */
 
 void init_our_capability(void)
Index: common/connection.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/connection.c,v
retrieving revision 1.40
diff -u -r1.40 connection.c
--- common/connection.c 25 Jun 2004 23:43:01 -0000      1.40
+++ common/connection.c 14 Jul 2004 21:49:32 -0000
@@ -54,6 +54,8 @@
    neccesary as removing a random connection while we are iterating through
    a connection list might corrupt the list. */
 int delayed_disconnect = 0;
+
+struct connection *current_connection;
   
 /**************************************************************************
   Command access levels for client-side use; at present, they are only
Index: common/connection.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/connection.h,v
retrieving revision 1.34
diff -u -r1.34 connection.h
--- common/connection.h 10 Apr 2004 03:47:49 -0000      1.34
+++ common/connection.h 14 Jul 2004 21:49:32 -0000
@@ -223,6 +223,7 @@
   } statistics;
 };
 
+extern struct connection *current_connection;
 
 const char *cmdlevel_name(enum cmdlevel_id lvl);
 enum cmdlevel_id cmdlevel_named(const char *token);
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.176
diff -u -r1.176 map.c
--- common/map.c        9 Jul 2004 19:30:58 -0000       1.176
+++ common/map.c        14 Jul 2004 21:49:32 -0000
@@ -810,6 +810,19 @@
 /***************************************************************
 ...
 ***************************************************************/
+int map_get_turns_for_activity(enum unit_activity activity,
+                              struct unit *punit)
+{
+  int mr = get_unit_type(punit->type)->move_rate;
+  int au = (mr > 0) ? mr / SINGLE_MOVE : 1;
+  int time = map_activity_time(activity, punit->x, punit->y) / 10;
+
+  return (time - 1) / au + 1;
+}
+
+/***************************************************************
+...
+***************************************************************/
 static void clear_infrastructure(int x, int y)
 {
   map_clear_special(x, y, S_INFRASTRUCTURE_MASK);
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.192
diff -u -r1.192 map.h
--- common/map.h        9 Jul 2004 19:30:58 -0000       1.192
+++ common/map.h        14 Jul 2004 21:49:32 -0000
@@ -399,6 +399,8 @@
 int map_clean_pollution_time(int x, int y);
 int map_clean_fallout_time(int x, int y);
 int map_activity_time(enum unit_activity activity, int x, int y);
+int map_get_turns_for_activity(enum unit_activity activity,
+                              struct unit *punit);
 
 bool can_channel_land(int x, int y);
 bool can_reclaim_ocean(int x, int y);
Index: common/packets.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v
retrieving revision 1.267
diff -u -r1.267 packets.c
--- common/packets.c    14 Jan 2004 11:58:12 -0000      1.267
+++ common/packets.c    14 Jul 2004 21:49:32 -0000
@@ -604,6 +604,12 @@
 void pre_send_packet_chat_msg(struct connection *pc,
                              struct packet_chat_msg *packet)
 {
+  if (current_connection) {
+    packet->conn_id = current_connection->id;
+  } else {
+    packet->conn_id = 255;
+  }
+
   if (packet->x == -1 && packet->y == -1) {
     /* since we can currently only send unsigned ints... */
     assert(!is_normal_map_pos(255, 255));
@@ -620,6 +626,9 @@
     packet->x = -1;
     packet->y = -1;
   }
+  if (packet->conn_id == 255) {
+    packet->conn_id = -1;
+  }
 }
 
 void pre_send_packet_player_attribute_chunk(struct connection *pc,
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.32
diff -u -r1.32 packets.def
--- common/packets.def  12 Jul 2004 17:22:02 -0000      1.32
+++ common/packets.def  14 Jul 2004 21:49:32 -0000
@@ -365,6 +365,7 @@
   STRING message[MAX_LEN_MSG];
   COORD x, y;
   EVENT event;
+  CONNECTION conn_id;
 end
 
 PACKET_CHAT_MSG_REQ=19;cs,handle-per-conn,dsend
Index: common/packets_gen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets_gen.c,v
retrieving revision 1.36
diff -u -r1.36 packets_gen.c
--- common/packets_gen.c        12 Jul 2004 17:22:02 -0000      1.36
+++ common/packets_gen.c        14 Jul 2004 21:49:34 -0000
@@ -4116,7 +4116,7 @@
 
 #define cmp_packet_chat_msg_100 cmp_const
 
-BV_DEFINE(packet_chat_msg_100_fields, 4);
+BV_DEFINE(packet_chat_msg_100_fields, 5);
 
 static struct packet_chat_msg *receive_packet_chat_msg_100(struct connection 
*pc, enum packet_type type)
 {
@@ -4152,6 +4152,9 @@
   if (BV_ISSET(fields, 3)) {
     dio_get_sint16(&din, (int *) &real_packet->event);
   }
+  if (BV_ISSET(fields, 4)) {
+    dio_get_uint8(&din, (int *) &real_packet->conn_id);
+  }
 
   clone = fc_malloc(sizeof(*clone));
   *clone = *real_packet;
@@ -4211,6 +4214,10 @@
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 3);}
 
+  differ = (old->conn_id != real_packet->conn_id);
+  if(differ) {different++;}
+  if(differ) {BV_SET(fields, 4);}
+
   if (different == 0 && !force_send_of_unchanged) {
 
   if (real_packet != packet) {
@@ -4233,6 +4240,9 @@
   if (BV_ISSET(fields, 3)) {
     dio_put_sint16(&dout, real_packet->event);
   }
+  if (BV_ISSET(fields, 4)) {
+    dio_put_uint8(&dout, real_packet->conn_id);
+  }
 
 
   if (old_from_hash) {
@@ -20329,7 +20339,7 @@
 
 #define cmp_packet_ruleset_unit_101 cmp_const
 
-BV_DEFINE(packet_ruleset_unit_101_fields, 33);
+BV_DEFINE(packet_ruleset_unit_101_fields, 35);
 
 static struct packet_ruleset_unit *receive_packet_ruleset_unit_101(struct 
connection *pc, enum packet_type type)
 {
@@ -20441,15 +20451,45 @@
     dio_get_uint8(&din, (int *) &real_packet->paratroopers_mr_sub);
   }
   if (BV_ISSET(fields, 29)) {
-    dio_get_uint8(&din, (int *) &real_packet->bombard_rate);
+    
+    {
+      int i;
+    
+      for (i = 0; i < MAX_VET_LEVELS; i++) {
+        dio_get_string(&din, real_packet->veteran_name[i], 
sizeof(real_packet->veteran_name[i]));
+      }
+    }
   }
   if (BV_ISSET(fields, 30)) {
-    dio_get_string(&din, real_packet->helptext, sizeof(real_packet->helptext));
+    
+    {
+      int i;
+    
+      for (i = 0; i < MAX_VET_LEVELS; i++) {
+        int tmp;
+    
+        dio_get_uint32(&din, &tmp);
+        real_packet->power_fact[i] = (float)(tmp) / 10000.0;
+      }
+    }
   }
   if (BV_ISSET(fields, 31)) {
-    DIO_BV_GET(&din, real_packet->flags);
+    
+    {
+      int i;
+    
+      for (i = 0; i < MAX_VET_LEVELS; i++) {
+        dio_get_uint8(&din, (int *) &real_packet->move_bonus[i]);
+      }
+    }
   }
   if (BV_ISSET(fields, 32)) {
+    dio_get_string(&din, real_packet->helptext, sizeof(real_packet->helptext));
+  }
+  if (BV_ISSET(fields, 33)) {
+    DIO_BV_GET(&din, real_packet->flags);
+  }
+  if (BV_ISSET(fields, 34)) {
     DIO_BV_GET(&din, real_packet->roles);
   }
 
@@ -20602,22 +20642,66 @@
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 28);}
 
-  differ = (old->bombard_rate != real_packet->bombard_rate);
+
+    {
+      differ = (MAX_VET_LEVELS != MAX_VET_LEVELS);
+      if(!differ) {
+        int i;
+        for (i = 0; i < MAX_VET_LEVELS; i++) {
+          if (strcmp(old->veteran_name[i], real_packet->veteran_name[i]) != 0) 
{
+            differ = TRUE;
+            break;
+          }
+        }
+      }
+    }
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 29);}
 
-  differ = (strcmp(old->helptext, real_packet->helptext) != 0);
+
+    {
+      differ = (MAX_VET_LEVELS != MAX_VET_LEVELS);
+      if(!differ) {
+        int i;
+        for (i = 0; i < MAX_VET_LEVELS; i++) {
+          if (old->power_fact[i] != real_packet->power_fact[i]) {
+            differ = TRUE;
+            break;
+          }
+        }
+      }
+    }
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 30);}
 
-  differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
+
+    {
+      differ = (MAX_VET_LEVELS != MAX_VET_LEVELS);
+      if(!differ) {
+        int i;
+        for (i = 0; i < MAX_VET_LEVELS; i++) {
+          if (old->move_bonus[i] != real_packet->move_bonus[i]) {
+            differ = TRUE;
+            break;
+          }
+        }
+      }
+    }
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 31);}
 
-  differ = !BV_ARE_EQUAL(old->roles, real_packet->roles);
+  differ = (strcmp(old->helptext, real_packet->helptext) != 0);
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 32);}
 
+  differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
+  if(differ) {different++;}
+  if(differ) {BV_SET(fields, 33);}
+
+  differ = !BV_ARE_EQUAL(old->roles, real_packet->roles);
+  if(differ) {different++;}
+  if(differ) {BV_SET(fields, 34);}
+
   if (different == 0 && !force_send_of_unchanged) {
     return 0;
   }
@@ -20712,15 +20796,42 @@
     dio_put_uint8(&dout, real_packet->paratroopers_mr_sub);
   }
   if (BV_ISSET(fields, 29)) {
-    dio_put_uint8(&dout, real_packet->bombard_rate);
+  
+    {
+      int i;
+
+      for (i = 0; i < MAX_VET_LEVELS; i++) {
+        dio_put_string(&dout, real_packet->veteran_name[i]);
+      }
+    } 
   }
   if (BV_ISSET(fields, 30)) {
-    dio_put_string(&dout, real_packet->helptext);
+  
+    {
+      int i;
+
+      for (i = 0; i < MAX_VET_LEVELS; i++) {
+          dio_put_uint32(&dout, (int)(real_packet->power_fact[i] * 10000));
+      }
+    } 
   }
   if (BV_ISSET(fields, 31)) {
-  DIO_BV_PUT(&dout, packet->flags);
+  
+    {
+      int i;
+
+      for (i = 0; i < MAX_VET_LEVELS; i++) {
+        dio_put_uint8(&dout, real_packet->move_bonus[i]);
+      }
+    } 
   }
   if (BV_ISSET(fields, 32)) {
+    dio_put_string(&dout, real_packet->helptext);
+  }
+  if (BV_ISSET(fields, 33)) {
+  DIO_BV_PUT(&dout, packet->flags);
+  }
+  if (BV_ISSET(fields, 34)) {
   DIO_BV_PUT(&dout, packet->roles);
   }
 
@@ -20740,7 +20851,7 @@
 
 #define cmp_packet_ruleset_unit_102 cmp_const
 
-BV_DEFINE(packet_ruleset_unit_102_fields, 35);
+BV_DEFINE(packet_ruleset_unit_102_fields, 33);
 
 static struct packet_ruleset_unit *receive_packet_ruleset_unit_102(struct 
connection *pc, enum packet_type type)
 {
@@ -20852,45 +20963,15 @@
     dio_get_uint8(&din, (int *) &real_packet->paratroopers_mr_sub);
   }
   if (BV_ISSET(fields, 29)) {
-    
-    {
-      int i;
-    
-      for (i = 0; i < MAX_VET_LEVELS; i++) {
-        dio_get_string(&din, real_packet->veteran_name[i], 
sizeof(real_packet->veteran_name[i]));
-      }
-    }
+    dio_get_uint8(&din, (int *) &real_packet->bombard_rate);
   }
   if (BV_ISSET(fields, 30)) {
-    
-    {
-      int i;
-    
-      for (i = 0; i < MAX_VET_LEVELS; i++) {
-        int tmp;
-    
-        dio_get_uint32(&din, &tmp);
-        real_packet->power_fact[i] = (float)(tmp) / 10000.0;
-      }
-    }
-  }
-  if (BV_ISSET(fields, 31)) {
-    
-    {
-      int i;
-    
-      for (i = 0; i < MAX_VET_LEVELS; i++) {
-        dio_get_uint8(&din, (int *) &real_packet->move_bonus[i]);
-      }
-    }
-  }
-  if (BV_ISSET(fields, 32)) {
     dio_get_string(&din, real_packet->helptext, sizeof(real_packet->helptext));
   }
-  if (BV_ISSET(fields, 33)) {
+  if (BV_ISSET(fields, 31)) {
     DIO_BV_GET(&din, real_packet->flags);
   }
-  if (BV_ISSET(fields, 34)) {
+  if (BV_ISSET(fields, 32)) {
     DIO_BV_GET(&din, real_packet->roles);
   }
 
@@ -21043,65 +21124,21 @@
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 28);}
 
-
-    {
-      differ = (MAX_VET_LEVELS != MAX_VET_LEVELS);
-      if(!differ) {
-        int i;
-        for (i = 0; i < MAX_VET_LEVELS; i++) {
-          if (strcmp(old->veteran_name[i], real_packet->veteran_name[i]) != 0) 
{
-            differ = TRUE;
-            break;
-          }
-        }
-      }
-    }
+  differ = (old->bombard_rate != real_packet->bombard_rate);
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 29);}
 
-
-    {
-      differ = (MAX_VET_LEVELS != MAX_VET_LEVELS);
-      if(!differ) {
-        int i;
-        for (i = 0; i < MAX_VET_LEVELS; i++) {
-          if (old->power_fact[i] != real_packet->power_fact[i]) {
-            differ = TRUE;
-            break;
-          }
-        }
-      }
-    }
-  if(differ) {different++;}
-  if(differ) {BV_SET(fields, 30);}
-
-
-    {
-      differ = (MAX_VET_LEVELS != MAX_VET_LEVELS);
-      if(!differ) {
-        int i;
-        for (i = 0; i < MAX_VET_LEVELS; i++) {
-          if (old->move_bonus[i] != real_packet->move_bonus[i]) {
-            differ = TRUE;
-            break;
-          }
-        }
-      }
-    }
-  if(differ) {different++;}
-  if(differ) {BV_SET(fields, 31);}
-
   differ = (strcmp(old->helptext, real_packet->helptext) != 0);
   if(differ) {different++;}
-  if(differ) {BV_SET(fields, 32);}
+  if(differ) {BV_SET(fields, 30);}
 
   differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
   if(differ) {different++;}
-  if(differ) {BV_SET(fields, 33);}
+  if(differ) {BV_SET(fields, 31);}
 
   differ = !BV_ARE_EQUAL(old->roles, real_packet->roles);
   if(differ) {different++;}
-  if(differ) {BV_SET(fields, 34);}
+  if(differ) {BV_SET(fields, 32);}
 
   if (different == 0 && !force_send_of_unchanged) {
     return 0;
@@ -21197,42 +21234,15 @@
     dio_put_uint8(&dout, real_packet->paratroopers_mr_sub);
   }
   if (BV_ISSET(fields, 29)) {
-  
-    {
-      int i;
-
-      for (i = 0; i < MAX_VET_LEVELS; i++) {
-        dio_put_string(&dout, real_packet->veteran_name[i]);
-      }
-    } 
+    dio_put_uint8(&dout, real_packet->bombard_rate);
   }
   if (BV_ISSET(fields, 30)) {
-  
-    {
-      int i;
-
-      for (i = 0; i < MAX_VET_LEVELS; i++) {
-          dio_put_uint32(&dout, (int)(real_packet->power_fact[i] * 10000));
-      }
-    } 
-  }
-  if (BV_ISSET(fields, 31)) {
-  
-    {
-      int i;
-
-      for (i = 0; i < MAX_VET_LEVELS; i++) {
-        dio_put_uint8(&dout, real_packet->move_bonus[i]);
-      }
-    } 
-  }
-  if (BV_ISSET(fields, 32)) {
     dio_put_string(&dout, real_packet->helptext);
   }
-  if (BV_ISSET(fields, 33)) {
+  if (BV_ISSET(fields, 31)) {
   DIO_BV_PUT(&dout, packet->flags);
   }
-  if (BV_ISSET(fields, 34)) {
+  if (BV_ISSET(fields, 32)) {
   DIO_BV_PUT(&dout, packet->roles);
   }
 
@@ -21658,13 +21668,13 @@
   }
 
   if(FALSE) {
-  } else if((has_capability("bombard", pc->capability) && 
has_capability("bombard", our_capability)) && (has_capability("veteran", 
pc->capability) && has_capability("veteran", our_capability))) {
+  } else if((has_capability("veteran", pc->capability) && 
has_capability("veteran", our_capability)) && (has_capability("bombard", 
pc->capability) && has_capability("bombard", our_capability))) {
     variant = 100;
-  } else if((has_capability("bombard", pc->capability) && 
has_capability("bombard", our_capability)) && !(has_capability("veteran", 
pc->capability) && has_capability("veteran", our_capability))) {
-    variant = 101;
   } else if((has_capability("veteran", pc->capability) && 
has_capability("veteran", our_capability)) && !(has_capability("bombard", 
pc->capability) && has_capability("bombard", our_capability))) {
+    variant = 101;
+  } else if((has_capability("bombard", pc->capability) && 
has_capability("bombard", our_capability)) && !(has_capability("veteran", 
pc->capability) && has_capability("veteran", our_capability))) {
     variant = 102;
-  } else if(!(has_capability("bombard", pc->capability) && 
has_capability("bombard", our_capability)) && !(has_capability("veteran", 
pc->capability) && has_capability("veteran", our_capability))) {
+  } else if(!(has_capability("veteran", pc->capability) && 
has_capability("veteran", our_capability)) && !(has_capability("bombard", 
pc->capability) && has_capability("bombard", our_capability))) {
     variant = 103;
   } else {
     die("unknown variant");
Index: common/packets_gen.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets_gen.h,v
retrieving revision 1.28
diff -u -r1.28 packets_gen.h
--- common/packets_gen.h        12 Jul 2004 17:22:03 -0000      1.28
+++ common/packets_gen.h        14 Jul 2004 21:49:35 -0000
@@ -153,6 +153,7 @@
   int x;
   int y;
   enum event_type event;
+  int conn_id;
 };
 
 struct packet_chat_msg_req {
Index: doc/PEOPLE
===================================================================
RCS file: /home/freeciv/CVS/freeciv/doc/PEOPLE,v
retrieving revision 1.27
diff -u -r1.27 PEOPLE
--- doc/PEOPLE  26 Aug 2003 08:21:56 -0000      1.27
+++ doc/PEOPLE  14 Jul 2004 21:49:35 -0000
@@ -417,6 +417,7 @@
      Frank Muzzulini <muzz@xxxxxxxxxxxxxxxxxxxxxx> (artillery icon)
      Allan Ove Kjeldbjerg <allan@xxxxxxxxxxxx> (original graphics)
      Jan Heidefuss <jan_heidefuss@xxxxxxxx> (flags)
+     Jukka Liukkonen <juliukko@xxxxxxx> (gold upkeep icons)
 
   Sounds:
 
Index: server/sernet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sernet.c,v
retrieving revision 1.119
diff -u -r1.119 sernet.c
--- server/sernet.c     17 May 2004 02:16:15 -0000      1.119
+++ server/sernet.c     14 Jul 2004 21:49:35 -0000
@@ -605,6 +605,7 @@
                  err = gettimeofday(&start, &tz);
                  assert(!err);
 #endif
+               current_connection = pconn;
                connection_do_buffer(pconn);
                start_processing_request(pconn,
                                         pconn->server.
@@ -614,6 +615,7 @@
 
                finish_processing_request(pconn);
                connection_do_unbuffer(pconn);
+               current_connection = NULL;
                if (!command_ok) {
                  close_connection(pconn);
                }
Index: utility/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- utility/Makefile.am 6 May 2004 22:57:36 -0000       1.3
+++ utility/Makefile.am 14 Jul 2004 21:49:35 -0000
@@ -1,5 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
+SUBDIRS=fdl
+
 noinst_LIBRARIES = libcivutility.a
 
 INCLUDES = -I../intl

Attachment: fs14.tar.gz
Description: application/gunzip


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7123) [FS#14], Per Inge Mathisen <=