Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11478) Sprinkling some const struct player
Home

[Freeciv-Dev] (PR#11478) Sprinkling some const struct player

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11478) Sprinkling some const struct player
From: "Frédéric Brière" <fbriere@xxxxxxxxxxx>
Date: Sat, 11 Dec 2004 13:25:11 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch adds a const to a couple of functions that merely return some
information about a player.

It also removes a dupliate declaration in client/text.h by the same
occasion.


-- 
             Frédéric Brière    <*>    fbriere@xxxxxxxxxxx

 =>  <fbriere@xxxxxxxxxx> IS NO MORE:  <http://www.abacomsucks.com>  <=

Index: common/nation.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/nation.c,v
retrieving revision 1.41
diff -u -r1.41 nation.c
--- common/nation.c     4 Dec 2004 10:42:12 -0000       1.41
+++ common/nation.c     11 Dec 2004 21:16:10 -0000
@@ -178,7 +178,7 @@
 /***************************************************************
 Returns pointer to a nation 
 ***************************************************************/
-struct nation_type *get_nation_by_plr(struct player *plr)
+struct nation_type *get_nation_by_plr(const struct player *plr)
 {
   assert(plr != NULL);
   if (!bounds_check_nation_id(plr->nation, LOG_FATAL, "get_nation_by_plr")) {
Index: common/nation.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/nation.h,v
retrieving revision 1.33
diff -u -r1.33 nation.h
--- common/nation.h     4 Dec 2004 10:42:12 -0000       1.33
+++ common/nation.h     11 Dec 2004 21:16:11 -0000
@@ -115,7 +115,7 @@
 struct leader *get_nation_leaders(Nation_Type_id nation, int *dim);
 Nation_Type_id *get_nation_civilwar(Nation_Type_id nation);
 bool get_nation_leader_sex(Nation_Type_id nation, const char *name);
-struct nation_type *get_nation_by_plr(struct player *plr);
+struct nation_type *get_nation_by_plr(const struct player *plr);
 struct nation_type *get_nation_by_idx(Nation_Type_id nation);
 bool check_nation_leader_name(Nation_Type_id nation, const char *name);
 void nations_alloc(int num);
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.145
diff -u -r1.145 climisc.c
--- client/climisc.c    8 Dec 2004 20:48:33 -0000       1.145
+++ client/climisc.c    11 Dec 2004 21:16:11 -0000
@@ -190,7 +190,8 @@
 /***************************************************************************
   Return a string indicating one nation's embassy status with another
 ***************************************************************************/
-const char *get_embassy_status(struct player *me, struct player *them)
+const char *get_embassy_status(const struct player *me,
+                               const struct player *them)
 {
   if (me == them
       || !them->is_alive
@@ -216,7 +217,8 @@
 /***************************************************************************
   Return a string indicating one nation's shaed vision status with another
 ***************************************************************************/
-const char *get_vision_status(struct player *me, struct player *them)
+const char *get_vision_status(const struct player *me,
+                               const struct player *them)
 {
   if (gives_shared_vision(me, them)) {
     if (gives_shared_vision(them, me)) {
Index: client/climisc.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.h,v
retrieving revision 1.51
diff -u -r1.51 climisc.h
--- client/climisc.h    29 Sep 2004 02:24:19 -0000      1.51
+++ client/climisc.h    11 Dec 2004 21:16:11 -0000
@@ -29,8 +29,10 @@
 
 void client_change_all(cid x, cid y);
 
-const char *get_embassy_status(struct player *me, struct player *them);
-const char *get_vision_status(struct player *me, struct player *them);
+const char *get_embassy_status(const struct player *me,
+                               const struct player *them);
+const char *get_vision_status(const struct player *me,
+                               const struct player *them);
 void client_diplomacy_clause_string(char *buf, int bufsiz,
                                    struct Clause *pclause);
 
Index: client/plrdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/plrdlg_common.c,v
retrieving revision 1.13
diff -u -r1.13 plrdlg_common.c
--- client/plrdlg_common.c      4 Nov 2004 03:02:10 -0000       1.13
+++ client/plrdlg_common.c      11 Dec 2004 21:16:11 -0000
@@ -269,7 +269,7 @@
   kept as a blank address if no one is controlling a player, but there are
   observers.
 **************************************************************************/
-const char *player_addr_hack(struct player *pplayer)
+const char *player_addr_hack(const struct player *pplayer)
 { 
   conn_list_iterate(pplayer->connections, pconn) {
     if (!pconn->observer) {
Index: client/plrdlg_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/plrdlg_common.h,v
retrieving revision 1.8
diff -u -r1.8 plrdlg_common.h
--- client/plrdlg_common.h      23 Oct 2004 20:02:52 -0000      1.8
+++ client/plrdlg_common.h      11 Dec 2004 21:16:11 -0000
@@ -45,6 +45,6 @@
 void init_player_dlg_common(void);
 int player_dlg_default_sort_column(void);
 
-const char *player_addr_hack(struct player *pplayer);
+const char *player_addr_hack(const struct player *pplayer);
 
 #endif  /* FC__PLRDLG_COMMON_H */
Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.18
diff -u -r1.18 text.c
--- client/text.c       11 Dec 2004 10:34:46 -0000      1.18
+++ client/text.c       11 Dec 2004 21:16:11 -0000
@@ -682,7 +682,7 @@
   Return text giving the ping time for the player.  This is generally used
   used in the playerdlg.  This should only be used in playerdlg_common.c.
 ****************************************************************************/
-const char *get_ping_time_text(struct player *pplayer)
+const char *get_ping_time_text(const struct player *pplayer)
 {
   INIT;
 
Index: client/text.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.h,v
retrieving revision 1.7
diff -u -r1.7 text.h
--- client/text.h       29 Sep 2004 02:24:19 -0000      1.7
+++ client/text.h       11 Dec 2004 21:16:11 -0000
@@ -36,10 +36,9 @@
 const char *get_spaceship_descr(struct player_spaceship *pship);
 const char *get_timeout_label_text(void);
 const char *format_duration(int duration);
-const char *get_ping_time_text(struct player *pplayer);
+const char *get_ping_time_text(const struct player *pplayer);
 const char *get_report_title(const char *report_name);
 const char *get_happiness_buildings(const struct city *pcity);
 const char *get_happiness_wonders(const struct city *pcity);
-const char *get_ping_time_text(struct player *pplayer);
 
 #endif /* FC__TEXT_H */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11478) Sprinkling some const struct player, Frédéric Brière <=