[Freeciv-Dev] (PR#8569) num_player_dlg_columns value
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8569 >
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=8569 >
> >
> > On Wed, 21 Apr 2004, Jason Short wrote:
> >
> > > > Replaced NUM_PLAYER_DLG_COLUMNS constant with
> num_player_dlg_columns variable.
> > >
> > > This value would be better as a const.
> > >
> > > In the city report I once tried doing the same thing. However
> that
> > > value is used in the declaration of some global arrays, so it
> can't be a
> > > variable. It's possible this will happen to the playerdlg value
> as well.
const it is then. Here is the patch.
Index: client/plrdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/plrdlg_common.c,v
retrieving revision 1.6
diff -u -r1.6 plrdlg_common.c
--- client/plrdlg_common.c 22 Apr 2004 02:15:38 -0000 1.6
+++ client/plrdlg_common.c 22 Apr 2004 15:33:09 -0000
@@ -236,7 +236,7 @@
{TRUE, COL_RIGHT_TEXT, N_("Ping"), get_ping_time_text, NULL, "ping"}
};
-int num_player_dlg_columns;
+const int num_player_dlg_columns = ARRAY_SIZE(player_dlg_columns);
/******************************************************************
...
@@ -252,8 +252,6 @@
void init_player_dlg_common()
{
int i;
-
- num_player_dlg_columns = ARRAY_SIZE(player_dlg_columns);
for (i = 0; i < num_player_dlg_columns; i++) {
player_dlg_columns[i].title = Q_(player_dlg_columns[i].title);
Index: client/plrdlg_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/plrdlg_common.h,v
retrieving revision 1.4
diff -u -r1.4 plrdlg_common.h
--- client/plrdlg_common.h 22 Apr 2004 02:15:38 -0000 1.4
+++ client/plrdlg_common.h 22 Apr 2004 15:33:09 -0000
@@ -40,7 +40,7 @@
};
extern struct player_dlg_column player_dlg_columns[];
-extern int num_player_dlg_columns;
+extern const int num_player_dlg_columns;
const char *get_ping_time_text(struct player *pplayer);
void init_player_dlg_common(void);
|
|