Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2006:
[Freeciv-Dev] (PR#16759) gui-ftwl compile fix
Home

[Freeciv-Dev] (PR#16759) gui-ftwl compile fix

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#16759) gui-ftwl compile fix
From: "Christian Prochaska" <cp.ml.freeciv.dev@xxxxxxxxxxxxxx>
Date: Sun, 30 Apr 2006 02:25:35 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch makes the ftwl client compile again.
Index: client/gui-ftwl/gotodlg.c
===================================================================
--- client/gui-ftwl/gotodlg.c   (Revision 11895)
+++ client/gui-ftwl/gotodlg.c   (Arbeitskopie)
@@ -30,7 +30,7 @@
   if (get_client_state() != CLIENT_GAME_RUNNING_STATE) {
     return;
   }
-  if (!get_unit_in_focus()) {
+  if (!get_num_units_in_focus()) {
     return;
   }
   /* PORTME */
Index: client/gui-ftwl/colors.c
===================================================================
--- client/gui-ftwl/colors.c    (Revision 11895)
+++ client/gui-ftwl/colors.c    (Arbeitskopie)
@@ -15,12 +15,29 @@
 #include <config.h>
 #endif
 
+#include "mem.h"
+
+#include "back_end.h"
+
 #include "colors.h"
 
-/**************************************************************************
-  Initialize colors for the game.
-**************************************************************************/
-void init_color_system(void)
+/****************************************************************************
+  Allocate a color (adjusting it for our colormap if necessary on paletted
+  systems) and return a pointer to it.
+****************************************************************************/
+struct color *color_alloc(int r, int g, int b)
 {
-  /* PORTME */
+  struct color *color = fc_malloc(sizeof(*color));
+
+  color->color = be_get_color(r, g, b, MAX_OPACITY);
+
+  return color;
 }
+
+/****************************************************************************
+  Free a previously allocated color.  See color_alloc.
+****************************************************************************/
+void color_free(struct color *color)
+{
+  free(color);
+}
Index: client/gui-ftwl/colors.h
===================================================================
--- client/gui-ftwl/colors.h    (Revision 11895)
+++ client/gui-ftwl/colors.h    (Arbeitskopie)
@@ -16,5 +16,36 @@
 
 #include "colors_g.h"
 
+#include "common_types.h"
 
+struct color {
+  be_color color;
+};
+
+enum colors { 
+  COLOR_STD_BLACK, COLOR_STD_WHITE, COLOR_STD_RED, 
+  COLOR_STD_YELLOW, COLOR_STD_CYAN, 
+  COLOR_STD_GROUND, COLOR_STD_OCEAN, 
+  COLOR_STD_BACKGROUND, 
+  COLOR_STD_RACE0, COLOR_STD_RACE1, COLOR_STD_RACE2, 
+  COLOR_STD_RACE3, COLOR_STD_RACE4, COLOR_STD_RACE5, 
+  COLOR_STD_RACE6, COLOR_STD_RACE7, COLOR_STD_RACE8, 
+  COLOR_STD_RACE9, COLOR_STD_RACE10, COLOR_STD_RACE11, 
+  COLOR_STD_RACE12, COLOR_STD_RACE13,
+  COLOR_STD_LAST,
+    
+  COLOR_EXT_BLUE = COLOR_STD_LAST, 
+  COLOR_EXT_TOOLTIP_FOREGROUND, 
+  COLOR_EXT_TOOLTIP_BACKGROUND, 
+  COLOR_EXT_GRAY, 
+  COLOR_EXT_LIGHT_GRAY, 
+  COLOR_EXT_GREEN, 
+  COLOR_EXT_DEFAULT_WINDOW_BACKGROUND, 
+  COLOR_EXT_SELECTED_ROW, 
+  COLOR_EXT_DARK_BLUE, 
+  COLOR_EXT_OUTERSPACE_FG, 
+  COLOR_EXT_OUTERSPACE_BG, 
+  COLOR_EXT_LAST 
+}; 
+
 #endif                         /* FC__COLORS_H */
Index: client/gui-ftwl/mapview.c
===================================================================
--- client/gui-ftwl/mapview.c   (Revision 11895)
+++ client/gui-ftwl/mapview.c   (Arbeitskopie)
@@ -24,10 +24,12 @@
 #include "movement.h"
 #include "registry.h"
 #include "support.h"
+#include "unitlist.h"
 
 #include "civclient.h"
 #include "climap.h"
 #include "climisc.h"
+#include "colors.h"
 #include "combat.h"
 #include "control.h"
 #include "mapctrl_common.h"
@@ -180,7 +182,7 @@
   And it may call update_unit_pix_label() to update the icons for units
   on this square.
 **************************************************************************/
-void update_unit_info_label(struct unit *punit)
+void update_unit_info_label(struct unit_list *punitlist)
 {
   /* PORTME */
 }
@@ -651,7 +653,7 @@
 
   ptile = get_focus_tile();
   unit_list_iterate(ptile->units, aunit) {
-    if (game.info.player_idx == aunit->owner) {
+    if (game.info.player_idx == aunit->owner->player_no) {
       set_unit_focus(aunit);
       break;
     }
@@ -676,7 +678,7 @@
     item->selected = create_selected_osda(item->unselected);
     item->button = NULL;
     item->tooltip=mystrdup(mapview_get_terrain_tooltip_text(ptile));
-    item->info_text=mystrdup(mapview_get_terrain_info_text(ptile));
+    item->info_text=mystrdup(popup_info_text(ptile));
   }
 
   if (tile_get_city(ptile)) {
@@ -1306,7 +1308,7 @@
     X(ACTIVITY_SENTRY,  "unit_sentry");
     X(ACTIVITY_TRANSFORM,  "unit_transform");
 
-    if (can_unit_do_auto(punit)) {
+    if (can_unit_do_autosettlers(punit)) {
       if (unit_flag(punit, F_SETTLERS)) {
        ADD("unit_auto_settler");
       } else {
Index: client/gui-ftwl/canvas.c
===================================================================
--- client/gui-ftwl/canvas.c    (Revision 11895)
+++ client/gui-ftwl/canvas.c    (Arbeitskopie)
@@ -19,6 +19,7 @@
 
 #include "log.h"
 #include "back_end.h"
+#include "colors.h"
 #include "gui_main.h"          /* for enum_color_to_be_color() */
 #include "widget.h"
 #include "mapview.h"           /* for text_templates */
@@ -118,14 +119,17 @@
   Draw a filled-in colored rectangle onto the mapview or citydialog canvas.
 **************************************************************************/
 void canvas_put_rectangle(struct canvas *pcanvas,
-                         enum color_std color,
+                         struct color *pcolor,
                          int canvas_x, int canvas_y, int width, int height)
 {
   struct ct_rect rect = { canvas_x, canvas_y, width, height };
-
+/* FIXME */
+#if 0
   freelog(LOG_DEBUG, "gui_put_rectangle(,%d,%d,%d,%d,%d)", color, canvas_x, 
           canvas_y, width, height);
-  be_draw_region(pcanvas->osda, &rect, enum_color_to_be_color(color));
+#endif
+  
+  be_draw_region(pcanvas->osda, &rect, pcolor->color);
   if (pcanvas->widget) {
     sw_window_canvas_background_region_needs_repaint(pcanvas->widget,
                                                     &rect);
@@ -136,7 +140,7 @@
   Fill the area covered by the sprite with the given color.
 ****************************************************************************/
 void canvas_fill_sprite_area(struct canvas *pcanvas,
-                             struct sprite *psprite, enum color_std color,
+                             struct sprite *psprite, struct color *pcolor,
                              int canvas_x, int canvas_y)
 {
   /* PORTME */
@@ -154,7 +158,7 @@
 /**************************************************************************
   Draw a 1-pixel-width colored line onto the mapview or citydialog canvas.
 **************************************************************************/
-void canvas_put_line(struct canvas *pcanvas, enum color_std color,
+void canvas_put_line(struct canvas *pcanvas, struct color *pcolor,
                     enum line_type ltype, int start_x, int start_y,
                     int dx, int dy)
 {
@@ -167,11 +171,9 @@
   freelog(LOG_DEBUG, "gui_put_line(...)");
 
   if (ltype == LINE_NORMAL) {
-    be_draw_line(pcanvas->osda, &start, &end, 1, FALSE,
-                enum_color_to_be_color(color));
+    be_draw_line(pcanvas->osda, &start, &end, 1, FALSE, pcolor->color);
   } else if (ltype == LINE_BORDER) {
-    be_draw_line(pcanvas->osda, &start, &end, 2, TRUE,
-                enum_color_to_be_color(color));
+    be_draw_line(pcanvas->osda, &start, &end, 2, TRUE, pcolor->color);
   } else {
     assert(0);
   }
@@ -209,12 +211,12 @@
   take care of this manually.  The text will not be NULL but may be empty.
 ****************************************************************************/
 void canvas_put_text(struct canvas *pcanvas, int canvas_x, int canvas_y,
-                    enum client_font font, enum color_std color,
+                    enum client_font font, struct color *pcolor,
                     const char *text)
 {
     struct ct_point position={canvas_x, canvas_y};
-    struct ct_string *string=ct_string_clone4(text_templates[font],
-                                             text,color);
+    struct ct_string *string=ct_string_clone4(text_templates[font], text,
+                                                              pcolor->color);
     tr_draw_string(pcanvas->osda,&position,string);
     ct_string_destroy(string);
 }
Index: client/gui-ftwl/themes.c
===================================================================
--- client/gui-ftwl/themes.c    (Revision 0)
+++ client/gui-ftwl/themes.c    (Revision 0)
@@ -0,0 +1,59 @@
+/********************************************************************** 
+ Freeciv - Copyright (C) 2005 The Freeciv Team
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "themes_common.h"
+#include "themes_g.h"
+
+/*****************************************************************************
+  Loads a gtk theme directory/theme_name
+*****************************************************************************/
+void gui_load_theme(const char *directory, const char *theme_name)
+{
+  /* Nothing */
+}
+
+/*****************************************************************************
+  Clears a theme (sets default system theme)
+*****************************************************************************/
+void gui_clear_theme(void)
+{
+  /* Nothing */
+}
+
+/*****************************************************************************
+  Each gui has its own themes directories.
+
+  Returns an array containing these strings and sets array size in count.
+  The caller is responsible for freeing the array and the paths.
+*****************************************************************************/
+char **get_gui_specific_themes_directories(int *count)
+{
+  *count = 0;
+  
+  return fc_malloc(sizeof(char*) * 0);
+}
+
+/*****************************************************************************
+  Return an array of names of usable themes in the given directory.
+  Array size is stored in count.
+  Useable theme for gtk+ is a directory which contains file gtk-2.0/gtkrc.
+  The caller is responsible for freeing the array and the names
+*****************************************************************************/
+char **get_useable_themes_in_directory(const char *directory, int *count)
+{
+  *count = 0;
+  return fc_malloc(sizeof(char*) * 0);
+}
Index: client/gui-ftwl/chatline.c
===================================================================
--- client/gui-ftwl/chatline.c  (Revision 11895)
+++ client/gui-ftwl/chatline.c  (Arbeitskopie)
@@ -18,6 +18,7 @@
 #include <assert.h>
 
 #include "climisc.h"           /* for write_chatline_content */
+#include "colors.h"
 #include "widget.h"
 #include "gui_main.h"
 #include "chat.h"
Index: client/gui-ftwl/gui_main.c
===================================================================
--- client/gui-ftwl/gui_main.c  (Revision 11895)
+++ client/gui-ftwl/gui_main.c  (Arbeitskopie)
@@ -24,6 +24,8 @@
 #include "registry.h"
 
 #include "chatline.h"
+#include "colors_common.h"
+#include "colors.h"
 #include "back_end.h"
 #include "widget.h"
 #include "graphics_g.h"
@@ -256,6 +258,14 @@
 }
 
 /**************************************************************************
+  Do any necessary UI-specific cleanup
+**************************************************************************/
+void ui_exit()
+{
+  /* PORTME */
+}
+
+/**************************************************************************
   Make a bell noise (beep).  This provides low-level sound alerts even
   if there is no real sound support.
 **************************************************************************/
Index: client/gui-ftwl/gui_main.h
===================================================================
--- client/gui-ftwl/gui_main.h  (Revision 11895)
+++ client/gui-ftwl/gui_main.h  (Arbeitskopie)
@@ -25,19 +25,4 @@
 
 be_color enum_color_to_be_color(int color);
 
-enum color_ext {
-  COLOR_EXT_BLUE = COLOR_STD_LAST,
-  COLOR_EXT_TOOLTIP_FOREGROUND,
-  COLOR_EXT_TOOLTIP_BACKGROUND,
-  COLOR_EXT_GRAY,
-  COLOR_EXT_LIGHT_GRAY,
-  COLOR_EXT_GREEN,
-  COLOR_EXT_DEFAULT_WINDOW_BACKGROUND,
-  COLOR_EXT_SELECTED_ROW,
-  COLOR_EXT_DARK_BLUE,
-  COLOR_EXT_OUTERSPACE_FG,
-  COLOR_EXT_OUTERSPACE_BG,
-  COLOR_EXT_LAST
-};
-
 #endif                         /* FC__GUI_MAIN_H */
Index: client/gui-ftwl/pages.c
===================================================================
--- client/gui-ftwl/pages.c     (Revision 11895)
+++ client/gui-ftwl/pages.c     (Arbeitskopie)
@@ -24,3 +24,20 @@
 {
   /* PORTME */
 }
+
+/**************************************************************************
+  Returns current client page
+**************************************************************************/
+enum client_pages get_client_page(void)
+{
+  /* PORTME */
+  return PAGE_MAIN;
+}
+
+/**************************************************************************
+  update the start page.
+**************************************************************************/
+void update_start_page(void)
+{
+  /* PORTME */
+}
Index: client/gui-ftwl/chat.c
===================================================================
--- client/gui-ftwl/chat.c      (Revision 11895)
+++ client/gui-ftwl/chat.c      (Arbeitskopie)
@@ -20,6 +20,7 @@
 
 #include "connection.h"
 #include "climisc.h"      /* for write_chatline_content */
+#include "colors.h"
 #include "log.h"
 #include "widget.h"
 #include "gui_main.h"
@@ -232,7 +233,7 @@
   struct sw_widget *label;
   struct ct_rect rect;
   struct connection *conn = find_conn_by_id(conn_id);
-  enum color_std color=COLOR_STD_BLACK;
+  struct color *pcolor = color_alloc(0, 0, 0);
   struct player *pplayer=NULL;
 
   freelog(LOG_NORMAL,"ogg_add(%d,%s)",conn_id, astring);
@@ -246,15 +247,13 @@
 
   if (conn && conn->player) {
     pplayer = conn->player;
-    color = player_color(pplayer);
+    pcolor = get_player_color(tileset, pplayer);
   }
 
   freelog(LOG_NORMAL, "id=%d conn=%p player=%s", conn_id, conn,
          pplayer ? pplayer->name : "none");
   
-  string =
-      ct_string_clone4(output.template, astring,
-                      enum_color_to_be_color(color));
+  string = ct_string_clone4(output.template, astring, pcolor->color);
   string = ct_string_wrap(string, output.inner_bounds.width);
   label = sw_label_create_text(output.window, string);
   sw_widget_set_position(label, 0, 0);
Index: client/gui-ftwl/connectdlg.c
===================================================================
--- client/gui-ftwl/connectdlg.c        (Revision 11895)
+++ client/gui-ftwl/connectdlg.c        (Arbeitskopie)
@@ -37,8 +37,6 @@
 
 static struct te_screen *screen;
 
-static void try_to_autoconnect(void *data);
-
 /**************************************************************************
   this regenerates the player information from a loaded game on the server.
 **************************************************************************/
Index: client/gui-ftwl/dialogs.c
===================================================================
--- client/gui-ftwl/dialogs.c   (Revision 11895)
+++ client/gui-ftwl/dialogs.c   (Arbeitskopie)
@@ -154,7 +154,7 @@
 /**************************************************************************
   Popup the nation selection dialog.
 **************************************************************************/
-void popup_races_dialog(void)
+void popup_races_dialog(struct player *pplayer)
 {
 #if 0
   struct ct_string *string;
@@ -282,12 +282,20 @@
   Is there currently a caravan dialog open?  This is important if there
   can be only one such dialog at a time; otherwise return FALSE.
 **************************************************************************/
-bool caravan_dialog_is_open(void)
+bool caravan_dialog_is_open(int* unit_id, int* city_id)
 {
   /* PORTME */
   return FALSE;
 }
 
+/****************************************************************
+  Updates caravan dialog
+****************************************************************/
+void caravan_dialog_update(void)
+{
+  /* PORTME */
+}
+
 /**************************************************************************
   Popup a dialog giving a diplomatic unit some options when moving into
   the target tile.
@@ -297,14 +305,21 @@
   /* PORTME */
 }
 
-/**************************************************************************
-  Return whether a diplomat dialog is open.  This is important if there
-  can be only one such dialog at a time; otherwise return FALSE.
-**************************************************************************/
-bool diplomat_dialog_is_open(void)
+/****************************************************************
+  Returns id of a diplomat currently handled in diplomat dialog
+*****************************************************************/
+int diplomat_handled_in_diplomat_dialog(void)
 {
+  /* PORTME */    
+  return -1;  
+}
+
+/****************************************************************
+  Closes the diplomat dialog
+****************************************************************/
+void close_diplomat_dialog(void)
+{
   /* PORTME */
-  return FALSE;
 }
 
 /**************************************************************************
@@ -338,8 +353,7 @@
   Popup a dialog asking the unit which improvement they would like to
   pillage.
 **************************************************************************/
-void popup_pillage_dialog(struct unit *punit,
-                         enum tile_special_type may_pillage)
+void popup_pillage_dialog(struct unit *punit, bv_special may_pillage)
 {
   /* PORTME */
 }
Index: client/gui-ftwl/gui_text.c
===================================================================
--- client/gui-ftwl/gui_text.c  (Revision 11895)
+++ client/gui-ftwl/gui_text.c  (Arbeitskopie)
@@ -27,6 +27,7 @@
 #include "map.h"
 #include "combat.h"
 #include "government.h"
+#include "unitlist.h"
 
 #include "climisc.h"
 #include "civclient.h"
@@ -134,7 +135,10 @@
 ****************************************************************************/
 const char *mapview_get_terrain_tooltip_text(struct tile *ptile)
 {
-  int infrastructure = get_tile_infrastructure_set(ptile);
+  int count;
+    
+  bv_special infrastructure = get_tile_infrastructure_set(ptile, &count);
+               
   INIT;
 
 #ifdef DEBUG
@@ -142,7 +146,7 @@
           ptile->x, ptile->y, ptile->continent);
 #endif
   add_line("%s", tile_get_info_text(ptile));
-  if (infrastructure) {
+  if (count > 0) {
     add_line("%s",
             get_infrastructure_text(infrastructure));
   }
@@ -346,8 +350,7 @@
     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->production.value,
-                                pcity->production.is_unit, TRUE));
+            city_turns_to_build(pcity, pcity->production, TRUE));
   } else {
     add_line("tooltip for action %s isn't written yet", action);
     freelog(LOG_NORMAL,
@@ -356,59 +359,6 @@
   RETURN;
 }  
 
-/************************************************************************
-  Text to popup on middle-click
-************************************************************************/
-const char *mapview_get_terrain_info_text(struct tile *ptile)
-{
-  const char *activity_text = concat_tile_activity_text(ptile);
-  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"),
-          tile_get_info_text(ptile));
-  add_line(_("Food/Prod/Trade: %s"),
-          get_tile_output_text(ptile));
-  if (tile_has_special(ptile, S_HUT)) {
-    add_line(_("Minor Tribe Village"));
-  }
-  if (game.info.borders > 0) {
-    struct player *owner = tile_get_owner(ptile);
-    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"),
-            get_infrastructure_text(ptile->special));
-  }
-  if (strlen(activity_text)) {
-    add_line(_("Activity: %s"), activity_text);
-  }
-  RETURN;
-}
-
 /****************************************************************************
   Get a short tooltip for a city.
 ****************************************************************************/
@@ -476,7 +426,7 @@
     char tmp[64] = { 0 };
     struct unit_type *ptype = unit_type(punit);
 
-    if (punit->owner == game.info.player_idx) {
+    if (punit->owner->player_no == game.info.player_idx) {
       struct city *pcity =
          player_find_city_by_id(game.player_ptr, punit->homecity);
 
@@ -486,8 +436,8 @@
     }
     add_line(_("Unit: %s(%s%s)"), ptype->name,
             get_nation_name(unit_owner(punit)->nation), tmp);
-    if (punit->owner != game.info.player_idx) {
-      struct unit *apunit = get_unit_in_focus();
+    if (punit->owner->player_no != game.info.player_idx) {
+      struct unit *apunit = unit_list_get(get_units_in_focus(), 0);
 
       if (apunit) {
        /* chance to win when active unit is attacking the selected unit */
Index: client/gui-ftwl/Makefile.am
===================================================================
--- client/gui-ftwl/Makefile.am (Revision 11895)
+++ client/gui-ftwl/Makefile.am (Arbeitskopie)
@@ -60,6 +60,7 @@
        spaceshipdlg.h  \
        sprite.c        \
        sprite.h        \
+       themes.c        \
        wldlg.c         \
        wldlg.h         \
        chat.c          \
Index: client/gui-ftwl/gui_text.h
===================================================================
--- client/gui-ftwl/gui_text.h  (Revision 11895)
+++ client/gui-ftwl/gui_text.h  (Arbeitskopie)
@@ -23,7 +23,6 @@
 const char *mapview_get_city_action_tooltip(struct city *pcity,
                                            const char *action,
                                            const char *shortcut_);
-const char *mapview_get_terrain_info_text(struct tile *ptile);
 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);
Index: client/gui-ftwl/gotodlg.c
===================================================================
--- client/gui-ftwl/gotodlg.c   (Revision 11895)
+++ client/gui-ftwl/gotodlg.c   (Arbeitskopie)
@@ -30,7 +30,7 @@
   if (get_client_state() != CLIENT_GAME_RUNNING_STATE) {
     return;
   }
-  if (!get_unit_in_focus()) {
+  if (!get_num_units_in_focus()) {
     return;
   }
   /* PORTME */
Index: client/gui-ftwl/colors.c
===================================================================
--- client/gui-ftwl/colors.c    (Revision 11895)
+++ client/gui-ftwl/colors.c    (Arbeitskopie)
@@ -15,12 +15,29 @@
 #include <config.h>
 #endif
 
+#include "mem.h"
+
+#include "back_end.h"
+
 #include "colors.h"
 
-/**************************************************************************
-  Initialize colors for the game.
-**************************************************************************/
-void init_color_system(void)
+/****************************************************************************
+  Allocate a color (adjusting it for our colormap if necessary on paletted
+  systems) and return a pointer to it.
+****************************************************************************/
+struct color *color_alloc(int r, int g, int b)
 {
-  /* PORTME */
+  struct color *color = fc_malloc(sizeof(*color));
+
+  color->color = be_get_color(r, g, b, MAX_OPACITY);
+
+  return color;
 }
+
+/****************************************************************************
+  Free a previously allocated color.  See color_alloc.
+****************************************************************************/
+void color_free(struct color *color)
+{
+  free(color);
+}
Index: client/gui-ftwl/colors.h
===================================================================
--- client/gui-ftwl/colors.h    (Revision 11895)
+++ client/gui-ftwl/colors.h    (Arbeitskopie)
@@ -16,5 +16,36 @@
 
 #include "colors_g.h"
 
+#include "common_types.h"
 
+struct color {
+  be_color color;
+};
+
+enum colors { 
+  COLOR_STD_BLACK, COLOR_STD_WHITE, COLOR_STD_RED, 
+  COLOR_STD_YELLOW, COLOR_STD_CYAN, 
+  COLOR_STD_GROUND, COLOR_STD_OCEAN, 
+  COLOR_STD_BACKGROUND, 
+  COLOR_STD_RACE0, COLOR_STD_RACE1, COLOR_STD_RACE2, 
+  COLOR_STD_RACE3, COLOR_STD_RACE4, COLOR_STD_RACE5, 
+  COLOR_STD_RACE6, COLOR_STD_RACE7, COLOR_STD_RACE8, 
+  COLOR_STD_RACE9, COLOR_STD_RACE10, COLOR_STD_RACE11, 
+  COLOR_STD_RACE12, COLOR_STD_RACE13,
+  COLOR_STD_LAST,
+    
+  COLOR_EXT_BLUE = COLOR_STD_LAST, 
+  COLOR_EXT_TOOLTIP_FOREGROUND, 
+  COLOR_EXT_TOOLTIP_BACKGROUND, 
+  COLOR_EXT_GRAY, 
+  COLOR_EXT_LIGHT_GRAY, 
+  COLOR_EXT_GREEN, 
+  COLOR_EXT_DEFAULT_WINDOW_BACKGROUND, 
+  COLOR_EXT_SELECTED_ROW, 
+  COLOR_EXT_DARK_BLUE, 
+  COLOR_EXT_OUTERSPACE_FG, 
+  COLOR_EXT_OUTERSPACE_BG, 
+  COLOR_EXT_LAST 
+}; 
+
 #endif                         /* FC__COLORS_H */
Index: client/gui-ftwl/mapview.c
===================================================================
--- client/gui-ftwl/mapview.c   (Revision 11895)
+++ client/gui-ftwl/mapview.c   (Arbeitskopie)
@@ -24,10 +24,12 @@
 #include "movement.h"
 #include "registry.h"
 #include "support.h"
+#include "unitlist.h"
 
 #include "civclient.h"
 #include "climap.h"
 #include "climisc.h"
+#include "colors.h"
 #include "combat.h"
 #include "control.h"
 #include "mapctrl_common.h"
@@ -180,7 +182,7 @@
   And it may call update_unit_pix_label() to update the icons for units
   on this square.
 **************************************************************************/
-void update_unit_info_label(struct unit *punit)
+void update_unit_info_label(struct unit_list *punitlist)
 {
   /* PORTME */
 }
@@ -651,7 +653,7 @@
 
   ptile = get_focus_tile();
   unit_list_iterate(ptile->units, aunit) {
-    if (game.info.player_idx == aunit->owner) {
+    if (game.info.player_idx == aunit->owner->player_no) {
       set_unit_focus(aunit);
       break;
     }
@@ -676,7 +678,7 @@
     item->selected = create_selected_osda(item->unselected);
     item->button = NULL;
     item->tooltip=mystrdup(mapview_get_terrain_tooltip_text(ptile));
-    item->info_text=mystrdup(mapview_get_terrain_info_text(ptile));
+    item->info_text=mystrdup(popup_info_text(ptile));
   }
 
   if (tile_get_city(ptile)) {
@@ -1306,7 +1308,7 @@
     X(ACTIVITY_SENTRY,  "unit_sentry");
     X(ACTIVITY_TRANSFORM,  "unit_transform");
 
-    if (can_unit_do_auto(punit)) {
+    if (can_unit_do_autosettlers(punit)) {
       if (unit_flag(punit, F_SETTLERS)) {
        ADD("unit_auto_settler");
       } else {
@@ -1527,3 +1529,11 @@
   freelog(LOG_ERROR, "Ignore set_city_names_font_sizes call.");
   /* PORTME */
 }
+
+/**************************************************************************
+  This function will change the current mouse cursor.
+**************************************************************************/
+void update_mouse_cursor(enum cursor_type new_cursor_type)
+{
+  /* PORT ME */
+}
Index: client/gui-ftwl/canvas.c
===================================================================
--- client/gui-ftwl/canvas.c    (Revision 11895)
+++ client/gui-ftwl/canvas.c    (Arbeitskopie)
@@ -19,6 +19,7 @@
 
 #include "log.h"
 #include "back_end.h"
+#include "colors.h"
 #include "gui_main.h"          /* for enum_color_to_be_color() */
 #include "widget.h"
 #include "mapview.h"           /* for text_templates */
@@ -118,14 +119,17 @@
   Draw a filled-in colored rectangle onto the mapview or citydialog canvas.
 **************************************************************************/
 void canvas_put_rectangle(struct canvas *pcanvas,
-                         enum color_std color,
+                         struct color *pcolor,
                          int canvas_x, int canvas_y, int width, int height)
 {
   struct ct_rect rect = { canvas_x, canvas_y, width, height };
-
+/* FIXME */
+#if 0
   freelog(LOG_DEBUG, "gui_put_rectangle(,%d,%d,%d,%d,%d)", color, canvas_x, 
           canvas_y, width, height);
-  be_draw_region(pcanvas->osda, &rect, enum_color_to_be_color(color));
+#endif
+  
+  be_draw_region(pcanvas->osda, &rect, pcolor->color);
   if (pcanvas->widget) {
     sw_window_canvas_background_region_needs_repaint(pcanvas->widget,
                                                     &rect);
@@ -136,7 +140,7 @@
   Fill the area covered by the sprite with the given color.
 ****************************************************************************/
 void canvas_fill_sprite_area(struct canvas *pcanvas,
-                             struct sprite *psprite, enum color_std color,
+                             struct sprite *psprite, struct color *pcolor,
                              int canvas_x, int canvas_y)
 {
   /* PORTME */
@@ -154,7 +158,7 @@
 /**************************************************************************
   Draw a 1-pixel-width colored line onto the mapview or citydialog canvas.
 **************************************************************************/
-void canvas_put_line(struct canvas *pcanvas, enum color_std color,
+void canvas_put_line(struct canvas *pcanvas, struct color *pcolor,
                     enum line_type ltype, int start_x, int start_y,
                     int dx, int dy)
 {
@@ -167,11 +171,9 @@
   freelog(LOG_DEBUG, "gui_put_line(...)");
 
   if (ltype == LINE_NORMAL) {
-    be_draw_line(pcanvas->osda, &start, &end, 1, FALSE,
-                enum_color_to_be_color(color));
+    be_draw_line(pcanvas->osda, &start, &end, 1, FALSE, pcolor->color);
   } else if (ltype == LINE_BORDER) {
-    be_draw_line(pcanvas->osda, &start, &end, 2, TRUE,
-                enum_color_to_be_color(color));
+    be_draw_line(pcanvas->osda, &start, &end, 2, TRUE, pcolor->color);
   } else {
     assert(0);
   }
@@ -209,12 +211,12 @@
   take care of this manually.  The text will not be NULL but may be empty.
 ****************************************************************************/
 void canvas_put_text(struct canvas *pcanvas, int canvas_x, int canvas_y,
-                    enum client_font font, enum color_std color,
+                    enum client_font font, struct color *pcolor,
                     const char *text)
 {
     struct ct_point position={canvas_x, canvas_y};
-    struct ct_string *string=ct_string_clone4(text_templates[font],
-                                             text,color);
+    struct ct_string *string=ct_string_clone4(text_templates[font], text,
+                                                              pcolor->color);
     tr_draw_string(pcanvas->osda,&position,string);
     ct_string_destroy(string);
 }
Index: client/gui-ftwl/themes.c
===================================================================
--- client/gui-ftwl/themes.c    (Revision 0)
+++ client/gui-ftwl/themes.c    (Revision 0)
@@ -0,0 +1,59 @@
+/********************************************************************** 
+ Freeciv - Copyright (C) 2005 The Freeciv Team
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "themes_common.h"
+#include "themes_g.h"
+
+/*****************************************************************************
+  Loads a gtk theme directory/theme_name
+*****************************************************************************/
+void gui_load_theme(const char *directory, const char *theme_name)
+{
+  /* Nothing */
+}
+
+/*****************************************************************************
+  Clears a theme (sets default system theme)
+*****************************************************************************/
+void gui_clear_theme(void)
+{
+  /* Nothing */
+}
+
+/*****************************************************************************
+  Each gui has its own themes directories.
+
+  Returns an array containing these strings and sets array size in count.
+  The caller is responsible for freeing the array and the paths.
+*****************************************************************************/
+char **get_gui_specific_themes_directories(int *count)
+{
+  *count = 0;
+  
+  return fc_malloc(sizeof(char*) * 0);
+}
+
+/*****************************************************************************
+  Return an array of names of usable themes in the given directory.
+  Array size is stored in count.
+  Useable theme for gtk+ is a directory which contains file gtk-2.0/gtkrc.
+  The caller is responsible for freeing the array and the names
+*****************************************************************************/
+char **get_useable_themes_in_directory(const char *directory, int *count)
+{
+  *count = 0;
+  return fc_malloc(sizeof(char*) * 0);
+}
Index: client/gui-ftwl/chatline.c
===================================================================
--- client/gui-ftwl/chatline.c  (Revision 11895)
+++ client/gui-ftwl/chatline.c  (Arbeitskopie)
@@ -18,6 +18,7 @@
 #include <assert.h>
 
 #include "climisc.h"           /* for write_chatline_content */
+#include "colors.h"
 #include "widget.h"
 #include "gui_main.h"
 #include "chat.h"
Index: client/gui-ftwl/gui_main.c
===================================================================
--- client/gui-ftwl/gui_main.c  (Revision 11895)
+++ client/gui-ftwl/gui_main.c  (Arbeitskopie)
@@ -24,6 +24,8 @@
 #include "registry.h"
 
 #include "chatline.h"
+#include "colors_common.h"
+#include "colors.h"
 #include "back_end.h"
 #include "widget.h"
 #include "graphics_g.h"
@@ -256,6 +258,14 @@
 }
 
 /**************************************************************************
+  Do any necessary UI-specific cleanup
+**************************************************************************/
+void ui_exit()
+{
+  /* PORTME */
+}
+
+/**************************************************************************
   Make a bell noise (beep).  This provides low-level sound alerts even
   if there is no real sound support.
 **************************************************************************/
Index: client/gui-ftwl/gui_main.h
===================================================================
--- client/gui-ftwl/gui_main.h  (Revision 11895)
+++ client/gui-ftwl/gui_main.h  (Arbeitskopie)
@@ -25,19 +25,4 @@
 
 be_color enum_color_to_be_color(int color);
 
-enum color_ext {
-  COLOR_EXT_BLUE = COLOR_STD_LAST,
-  COLOR_EXT_TOOLTIP_FOREGROUND,
-  COLOR_EXT_TOOLTIP_BACKGROUND,
-  COLOR_EXT_GRAY,
-  COLOR_EXT_LIGHT_GRAY,
-  COLOR_EXT_GREEN,
-  COLOR_EXT_DEFAULT_WINDOW_BACKGROUND,
-  COLOR_EXT_SELECTED_ROW,
-  COLOR_EXT_DARK_BLUE,
-  COLOR_EXT_OUTERSPACE_FG,
-  COLOR_EXT_OUTERSPACE_BG,
-  COLOR_EXT_LAST
-};
-
 #endif                         /* FC__GUI_MAIN_H */
Index: client/gui-ftwl/pages.c
===================================================================
--- client/gui-ftwl/pages.c     (Revision 11895)
+++ client/gui-ftwl/pages.c     (Arbeitskopie)
@@ -24,3 +24,20 @@
 {
   /* PORTME */
 }
+
+/**************************************************************************
+  Returns current client page
+**************************************************************************/
+enum client_pages get_client_page(void)
+{
+  /* PORTME */
+  return PAGE_MAIN;
+}
+
+/**************************************************************************
+  update the start page.
+**************************************************************************/
+void update_start_page(void)
+{
+  /* PORTME */
+}
Index: client/gui-ftwl/chat.c
===================================================================
--- client/gui-ftwl/chat.c      (Revision 11895)
+++ client/gui-ftwl/chat.c      (Arbeitskopie)
@@ -20,6 +20,7 @@
 
 #include "connection.h"
 #include "climisc.h"      /* for write_chatline_content */
+#include "colors.h"
 #include "log.h"
 #include "widget.h"
 #include "gui_main.h"
@@ -232,7 +233,7 @@
   struct sw_widget *label;
   struct ct_rect rect;
   struct connection *conn = find_conn_by_id(conn_id);
-  enum color_std color=COLOR_STD_BLACK;
+  struct color *pcolor = color_alloc(0, 0, 0);
   struct player *pplayer=NULL;
 
   freelog(LOG_NORMAL,"ogg_add(%d,%s)",conn_id, astring);
@@ -246,15 +247,13 @@
 
   if (conn && conn->player) {
     pplayer = conn->player;
-    color = player_color(pplayer);
+    pcolor = get_player_color(tileset, pplayer);
   }
 
   freelog(LOG_NORMAL, "id=%d conn=%p player=%s", conn_id, conn,
          pplayer ? pplayer->name : "none");
   
-  string =
-      ct_string_clone4(output.template, astring,
-                      enum_color_to_be_color(color));
+  string = ct_string_clone4(output.template, astring, pcolor->color);
   string = ct_string_wrap(string, output.inner_bounds.width);
   label = sw_label_create_text(output.window, string);
   sw_widget_set_position(label, 0, 0);
Index: client/gui-ftwl/connectdlg.c
===================================================================
--- client/gui-ftwl/connectdlg.c        (Revision 11895)
+++ client/gui-ftwl/connectdlg.c        (Arbeitskopie)
@@ -37,8 +37,6 @@
 
 static struct te_screen *screen;
 
-static void try_to_autoconnect(void *data);
-
 /**************************************************************************
   this regenerates the player information from a loaded game on the server.
 **************************************************************************/
Index: client/gui-ftwl/dialogs.c
===================================================================
--- client/gui-ftwl/dialogs.c   (Revision 11895)
+++ client/gui-ftwl/dialogs.c   (Arbeitskopie)
@@ -154,7 +154,7 @@
 /**************************************************************************
   Popup the nation selection dialog.
 **************************************************************************/
-void popup_races_dialog(void)
+void popup_races_dialog(struct player *pplayer)
 {
 #if 0
   struct ct_string *string;
@@ -282,12 +282,20 @@
   Is there currently a caravan dialog open?  This is important if there
   can be only one such dialog at a time; otherwise return FALSE.
 **************************************************************************/
-bool caravan_dialog_is_open(void)
+bool caravan_dialog_is_open(int* unit_id, int* city_id)
 {
   /* PORTME */
   return FALSE;
 }
 
+/****************************************************************
+  Updates caravan dialog
+****************************************************************/
+void caravan_dialog_update(void)
+{
+  /* PORTME */
+}
+
 /**************************************************************************
   Popup a dialog giving a diplomatic unit some options when moving into
   the target tile.
@@ -297,14 +305,21 @@
   /* PORTME */
 }
 
-/**************************************************************************
-  Return whether a diplomat dialog is open.  This is important if there
-  can be only one such dialog at a time; otherwise return FALSE.
-**************************************************************************/
-bool diplomat_dialog_is_open(void)
+/****************************************************************
+  Returns id of a diplomat currently handled in diplomat dialog
+*****************************************************************/
+int diplomat_handled_in_diplomat_dialog(void)
 {
+  /* PORTME */    
+  return -1;  
+}
+
+/****************************************************************
+  Closes the diplomat dialog
+****************************************************************/
+void close_diplomat_dialog(void)
+{
   /* PORTME */
-  return FALSE;
 }
 
 /**************************************************************************
@@ -338,8 +353,7 @@
   Popup a dialog asking the unit which improvement they would like to
   pillage.
 **************************************************************************/
-void popup_pillage_dialog(struct unit *punit,
-                         enum tile_special_type may_pillage)
+void popup_pillage_dialog(struct unit *punit, bv_special may_pillage)
 {
   /* PORTME */
 }
Index: client/gui-ftwl/gui_text.c
===================================================================
--- client/gui-ftwl/gui_text.c  (Revision 11895)
+++ client/gui-ftwl/gui_text.c  (Arbeitskopie)
@@ -27,6 +27,7 @@
 #include "map.h"
 #include "combat.h"
 #include "government.h"
+#include "unitlist.h"
 
 #include "climisc.h"
 #include "civclient.h"
@@ -134,7 +135,10 @@
 ****************************************************************************/
 const char *mapview_get_terrain_tooltip_text(struct tile *ptile)
 {
-  int infrastructure = get_tile_infrastructure_set(ptile);
+  int count;
+    
+  bv_special infrastructure = get_tile_infrastructure_set(ptile, &count);
+               
   INIT;
 
 #ifdef DEBUG
@@ -142,7 +146,7 @@
           ptile->x, ptile->y, ptile->continent);
 #endif
   add_line("%s", tile_get_info_text(ptile));
-  if (infrastructure) {
+  if (count > 0) {
     add_line("%s",
             get_infrastructure_text(infrastructure));
   }
@@ -346,8 +350,7 @@
     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->production.value,
-                                pcity->production.is_unit, TRUE));
+            city_turns_to_build(pcity, pcity->production, TRUE));
   } else {
     add_line("tooltip for action %s isn't written yet", action);
     freelog(LOG_NORMAL,
@@ -356,59 +359,6 @@
   RETURN;
 }  
 
-/************************************************************************
-  Text to popup on middle-click
-************************************************************************/
-const char *mapview_get_terrain_info_text(struct tile *ptile)
-{
-  const char *activity_text = concat_tile_activity_text(ptile);
-  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"),
-          tile_get_info_text(ptile));
-  add_line(_("Food/Prod/Trade: %s"),
-          get_tile_output_text(ptile));
-  if (tile_has_special(ptile, S_HUT)) {
-    add_line(_("Minor Tribe Village"));
-  }
-  if (game.info.borders > 0) {
-    struct player *owner = tile_get_owner(ptile);
-    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"),
-            get_infrastructure_text(ptile->special));
-  }
-  if (strlen(activity_text)) {
-    add_line(_("Activity: %s"), activity_text);
-  }
-  RETURN;
-}
-
 /****************************************************************************
   Get a short tooltip for a city.
 ****************************************************************************/
@@ -476,7 +426,7 @@
     char tmp[64] = { 0 };
     struct unit_type *ptype = unit_type(punit);
 
-    if (punit->owner == game.info.player_idx) {
+    if (punit->owner->player_no == game.info.player_idx) {
       struct city *pcity =
          player_find_city_by_id(game.player_ptr, punit->homecity);
 
@@ -486,8 +436,8 @@
     }
     add_line(_("Unit: %s(%s%s)"), ptype->name,
             get_nation_name(unit_owner(punit)->nation), tmp);
-    if (punit->owner != game.info.player_idx) {
-      struct unit *apunit = get_unit_in_focus();
+    if (punit->owner->player_no != game.info.player_idx) {
+      struct unit *apunit = unit_list_get(get_units_in_focus(), 0);
 
       if (apunit) {
        /* chance to win when active unit is attacking the selected unit */
Index: client/gui-ftwl/Makefile.am
===================================================================
--- client/gui-ftwl/Makefile.am (Revision 11895)
+++ client/gui-ftwl/Makefile.am (Arbeitskopie)
@@ -60,6 +60,7 @@
        spaceshipdlg.h  \
        sprite.c        \
        sprite.h        \
+       themes.c        \
        wldlg.c         \
        wldlg.h         \
        chat.c          \
Index: client/gui-ftwl/gui_text.h
===================================================================
--- client/gui-ftwl/gui_text.h  (Revision 11895)
+++ client/gui-ftwl/gui_text.h  (Arbeitskopie)
@@ -23,7 +23,6 @@
 const char *mapview_get_city_action_tooltip(struct city *pcity,
                                            const char *action,
                                            const char *shortcut_);
-const char *mapview_get_terrain_info_text(struct tile *ptile);
 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);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#16759) gui-ftwl compile fix, Christian Prochaska <=