[Freeciv-Dev] (PR#3935) remove MAX_NUM_NATIONS from gui-gtk-2.0
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
This patch removes the use of MAX_NUM_NATIONS in the gtk2 client. This
is a small step toward removing this value completely.
There may be a better way to do this; I'm not sure.
jason
Index: client/gui-gtk-2.0/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/plrdlg.c,v
retrieving revision 1.19
diff -u -r1.19 plrdlg.c
--- client/gui-gtk-2.0/plrdlg.c 2003/04/04 15:47:47 1.19
+++ client/gui-gtk-2.0/plrdlg.c 2003/04/04 23:32:49
@@ -54,7 +54,7 @@
static GtkWidget *players_sship_command;
static GtkListStore *store;
-static GdkPixbuf *flags[MAX_NUM_NATIONS];
+static GdkPixbuf **flags;
static void create_players_dialog(void);
static void players_meet_callback(GtkMenuItem *item, gpointer data);
@@ -214,6 +214,11 @@
int i;
GtkAccelGroup *accel = gtk_accel_group_new();
GtkWidget *sep, *sw;
+
+ /* The flag array is dynamically allocated, and its size may change from
+ * time to time. (Re)allocating it when the players dialog is opened is
+ * safe, but may be wasteful. */
+ flags = fc_realloc(game.nation_count * sizeof(*flags));
model_types[1] = GDK_TYPE_PIXBUF;
model_types[COLOR_COLUMN] = GDK_TYPE_COLOR;
- [Freeciv-Dev] (PR#3935) remove MAX_NUM_NATIONS from gui-gtk-2.0,
Jason Short <=
|
|