Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] (PR#13847) rename notify_conn_ex and related functions
Home

[Freeciv-Dev] (PR#13847) rename notify_conn_ex and related functions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13847) rename notify_conn_ex and related functions
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 3 Sep 2005 21:10:15 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch renames

   notify_conn_ex -> notify_conn
   vnotify_conn_ex -> vnotify_conn
   notify_team_ex -> notify_team

The "_ex" is now redundant as all functions include the full data.

-jason

Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.89
diff -p -u -r1.89 advdiplomacy.c
--- ai/advdiplomacy.c   29 Aug 2005 14:10:11 -0000      1.89
+++ ai/advdiplomacy.c   4 Sep 2005 04:03:47 -0000
@@ -75,7 +75,7 @@ static void notify(struct player *pplaye
     struct conn_list *dest = pplayer->connections;
 
     va_start(ap, text);
-    vnotify_conn_ex(dest, NULL, E_DIPLOMACY, text, ap);
+    vnotify_conn(dest, NULL, E_DIPLOMACY, text, ap);
     va_end(ap);
   }
 }
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.334
diff -p -u -r1.334 cityturn.c
--- server/cityturn.c   1 Sep 2005 02:32:41 -0000       1.334
+++ server/cityturn.c   4 Sep 2005 04:03:48 -0000
@@ -297,7 +297,7 @@ void send_global_city_turn_notifications
       if (!pcity->production.is_unit && 
is_great_wonder(pcity->production.value)
          && (city_turns_to_build(pcity, pcity->production, TRUE) <= 1)
          && can_player_build_improvement(city_owner(pcity), 
pcity->production.value)) {
-       notify_conn_ex(dest, pcity->tile,
+       notify_conn(dest, pcity->tile,
                       E_WONDER_WILL_BE_BUILT,
                       _("Notice: Wonder %s in %s will be finished"
                         " next turn."), 
@@ -331,7 +331,7 @@ void send_city_turn_notifications(struct
         preserves food.  -AJS */
       if (turns_growth < 5 && turns_granary < 5
          && turns_growth < turns_granary) {
-       notify_conn_ex(dest, pcity->tile,
+       notify_conn(dest, pcity->tile,
                         E_CITY_GRAN_THROTTLE,
                         _("Suggest throttling growth in %s to use %s "
                           "(being built) more effectively."), pcity->name,
@@ -342,7 +342,7 @@ void send_city_turn_notifications(struct
     can_grow = city_can_grow_to(pcity, pcity->size + 1);
 
     if ((turns_growth <= 0) && !city_celebrating(pcity) && can_grow) {
-      notify_conn_ex(dest, pcity->tile,
+      notify_conn(dest, pcity->tile,
                       E_CITY_MAY_SOON_GROW,
                       _("%s may soon grow to size %i."),
                       pcity->name, pcity->size + 1);
@@ -350,7 +350,7 @@ void send_city_turn_notifications(struct
   } else {
     if (pcity->food_stock + pcity->surplus[O_FOOD] <= 0
        && pcity->surplus[O_FOOD] < 0) {
-      notify_conn_ex(dest, pcity->tile,
+      notify_conn(dest, pcity->tile,
                     E_CITY_FAMINE_FEARED,
                     _("Warning: Famine feared in %s."),
                     pcity->name);
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.167
diff -p -u -r1.167 gamehand.c
--- server/gamehand.c   26 Aug 2005 19:40:26 -0000      1.167
+++ server/gamehand.c   4 Sep 2005 04:03:48 -0000
@@ -310,7 +310,7 @@ void send_year_to_clients(int year)
   lsend_packet_new_year(game.game_connections, &apacket);
 
   /* Hmm, clients could add this themselves based on above packet? */
-  notify_conn_ex(game.game_connections, NULL, E_NEXT_YEAR, _("Year: %s"),
+  notify_conn(game.game_connections, NULL, E_NEXT_YEAR, _("Year: %s"),
                 textyear(year));
 }
 
@@ -384,7 +384,7 @@ int update_timeout(void)
     game.timeoutint += game.timeoutintinc;
 
     if (game.info.timeout > GAME_MAX_TIMEOUT) {
-      notify_conn_ex(game.game_connections, NULL, E_SETTING,
+      notify_conn(game.game_connections, NULL, E_SETTING,
                     _("The turn timeout has exceeded its maximum value, "
                       "fixing at its maximum"));
       freelog(LOG_DEBUG, "game.info.timeout exceeded maximum value");
@@ -392,7 +392,7 @@ int update_timeout(void)
       game.timeoutint = 0;
       game.timeoutinc = 0;
     } else if (game.info.timeout < 0) {
-      notify_conn_ex(game.game_connections, NULL, E_SETTING,
+      notify_conn(game.game_connections, NULL, E_SETTING,
                     _("The turn timeout is smaller than zero, "
                       "fixing at zero."));
       freelog(LOG_DEBUG, "game.info.timeout less than zero");
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.419
diff -p -u -r1.419 plrhand.c
--- server/plrhand.c    4 Sep 2005 03:03:44 -0000       1.419
+++ server/plrhand.c    4 Sep 2005 04:03:48 -0000
@@ -691,7 +691,7 @@ repeat_break_treaty:
   caller should specify (x,y) = (-1,-1); otherwise make sure that the
   coordinates have been normalized.
 **************************************************************************/
-void vnotify_conn_ex(struct conn_list *dest, struct tile *ptile,
+void vnotify_conn(struct conn_list *dest, struct tile *ptile,
                     enum event_type event, const char *format,
                     va_list vargs)
 {
@@ -723,19 +723,19 @@ void vnotify_conn_ex(struct conn_list *d
 }
 
 /**************************************************************************
-  See vnotify_conn_ex - this is just the "non-v" version, with varargs.
+  See vnotify_conn - this is just the "non-v" version, with varargs.
 **************************************************************************/
-void notify_conn_ex(struct conn_list *dest, struct tile *ptile,
+void notify_conn(struct conn_list *dest, struct tile *ptile,
                    enum event_type event, const char *format, ...)
 {
   va_list args;
   va_start(args, format);
-  vnotify_conn_ex(dest, ptile, event, format, args);
+  vnotify_conn(dest, ptile, event, format, args);
   va_end(args);
 }
 
 /**************************************************************************
-  Similar to vnotify_conn_ex (see also), but takes player as "destination".
+  Similar to vnotify_conn (see also), but takes player as "destination".
   If player != NULL, sends to all connections for that player.
   If player == NULL, sends to all game connections, to support
   old code, but this feature may go away - should use notify_conn(NULL)
@@ -748,7 +748,7 @@ void notify_player(const struct player *
   va_list args;
 
   va_start(args, format);
-  vnotify_conn_ex(dest, ptile, event, format, args);
+  vnotify_conn(dest, ptile, event, format, args);
   va_end(args);
 }
 
@@ -789,7 +789,7 @@ void notify_embassies(struct player *ppl
 /**************************************************************************
   Sends a message to all players on pplayer's team
 **************************************************************************/
-void notify_team_ex(struct player* pplayer,
+void notify_team(struct player* pplayer,
                     struct tile *ptile, enum event_type event,
                    const char* format, ...)
 {
@@ -800,7 +800,7 @@ void notify_team_ex(struct player* pplay
     if (!players_on_same_team(pplayer, other_player)) {
       continue;
     }
-    vnotify_conn_ex(other_player->connections, ptile, event, format, args);
+    vnotify_conn(other_player->connections, ptile, event, format, args);
   } players_iterate_end;
   va_end(args);
 }
Index: server/plrhand.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.h,v
retrieving revision 1.84
diff -p -u -r1.84 plrhand.h
--- server/plrhand.h    4 Sep 2005 03:03:44 -0000       1.84
+++ server/plrhand.h    4 Sep 2005 04:03:48 -0000
@@ -46,13 +46,12 @@ void maybe_make_contact(struct tile *pti
 void send_player_info(struct player *src, struct player *dest);
 void send_player_info_c(struct player *src, struct conn_list *dest);
 
-void notify_conn_ex(struct conn_list *dest, struct tile *ptile,
-                   enum event_type event, const char *format, ...)
-                    fc__attribute((format (printf, 4, 5)));
-void vnotify_conn_ex(struct conn_list *dest, struct tile *ptile,
-                    enum event_type event, const char *format,
-                    va_list vargs);
-#define notify_conn notify_conn_ex
+void notify_conn(struct conn_list *dest, struct tile *ptile,
+                enum event_type event, const char *format, ...)
+                 fc__attribute((format (printf, 4, 5)));
+void vnotify_conn(struct conn_list *dest, struct tile *ptile,
+                 enum event_type event, const char *format,
+                 va_list vargs);
 void notify_player(const struct player *pplayer, struct tile *ptile,
                   enum event_type event, const char *format, ...)
                    fc__attribute((format (printf, 4, 5)));
@@ -60,7 +59,7 @@ void notify_embassies(struct player *ppl
                      struct tile *ptile, enum event_type event,
                      const char *format, ...)
                      fc__attribute((format (printf, 5, 6)));
-void notify_team_ex(struct player* pplayer, struct tile *ptile,
+void notify_team(struct player* pplayer, struct tile *ptile,
                  enum event_type event, const char *format, ...)
                  fc__attribute((format (printf, 4, 5)));
 
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.289
diff -p -u -r1.289 srv_main.c
--- server/srv_main.c   4 Sep 2005 03:03:44 -0000       1.289
+++ server/srv_main.c   4 Sep 2005 04:03:49 -0000
@@ -210,7 +210,7 @@ bool is_game_over(void)
 
   /* quit if we are past the year limit */
   if (game.info.year > game.info.end_year) {
-    notify_conn_ex(game.est_connections, NULL, E_GAME_END, 
+    notify_conn(game.est_connections, NULL, E_GAME_END, 
                   _("Game ended in a draw as end year exceeded"));
     gamelog(GAMELOG_JUDGE, GL_DRAW, 
             "Game ended in a draw as end year exceeded");
@@ -258,7 +258,7 @@ bool is_game_over(void)
       }
     } players_iterate_end;
     if (win) {
-      notify_conn_ex(game.est_connections, NULL, E_GAME_END,
+      notify_conn(game.est_connections, NULL, E_GAME_END,
                     _("Team victory to %s"), team_get_name_orig(pteam));
       gamelog(GAMELOG_JUDGE, GL_TEAMWIN, pteam);
       return TRUE;
@@ -267,12 +267,12 @@ bool is_game_over(void)
 
   /* quit if only one player is left alive */
   if (alive == 1) {
-    notify_conn_ex(game.est_connections, NULL, E_GAME_END,
+    notify_conn(game.est_connections, NULL, E_GAME_END,
                   _("Game ended in victory for %s"), victor->name);
     gamelog(GAMELOG_JUDGE, GL_LONEWIN, victor);
     return TRUE;
   } else if (alive == 0) {
-    notify_conn_ex(game.est_connections, NULL, E_GAME_END, 
+    notify_conn(game.est_connections, NULL, E_GAME_END, 
                   _("Game ended in a draw"));
     gamelog(GAMELOG_JUDGE, GL_DRAW);
     return TRUE;
@@ -296,7 +296,7 @@ bool is_game_over(void)
     }
   } players_iterate_end;
   if (all_allied) {
-    notify_conn_ex(game.est_connections, NULL, E_GAME_END, 
+    notify_conn(game.est_connections, NULL, E_GAME_END, 
                   _("Game ended in allied victory"));
     gamelog(GAMELOG_JUDGE, GL_ALLIEDWIN);
     return TRUE;
@@ -1256,13 +1256,13 @@ void handle_nation_select_req(struct pla
     }
 
     if (new_nation->is_unavailable) {
-      notify_conn_ex(pplayer->connections, NULL, E_NATION_SELECTED,
+      notify_conn(pplayer->connections, NULL, E_NATION_SELECTED,
                     _("%s nation is not available in this scenario."),
                     new_nation->name);
       return;
     }
     if (new_nation->is_unavailable) {
-      notify_conn_ex(pplayer->connections, NULL, E_NATION_SELECTED,
+      notify_conn(pplayer->connections, NULL, E_NATION_SELECTED,
                     _("%s nation is already in use."),
                     new_nation->name);
       return;
@@ -1272,14 +1272,14 @@ void handle_nation_select_req(struct pla
 
     if (!is_allowed_player_name(pplayer, new_nation, name,
                                message, sizeof(message))) {
-      notify_conn_ex(pplayer->connections, NULL, E_NATION_SELECTED,
+      notify_conn(pplayer->connections, NULL, E_NATION_SELECTED,
                     "%s", message);
       return;
     }
 
     name[0] = my_toupper(name[0]);
 
-    notify_conn_ex(game.game_connections, NULL, E_NATION_SELECTED,
+    notify_conn(game.game_connections, NULL, E_NATION_SELECTED,
                   _("%s is the %s ruler %s."), pplayer->username,
                   new_nation->name, name);
 
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.434
diff -p -u -r1.434 stdinhand.c
--- server/stdinhand.c  4 Sep 2005 03:03:44 -0000       1.434
+++ server/stdinhand.c  4 Sep 2005 04:03:50 -0000
@@ -1612,7 +1612,7 @@ static bool explain_option(struct connec
 static bool wall(char *str, bool check)
 {
   if (!check) {
-    notify_conn_ex(game.game_connections, NULL, E_MESSAGE_WALL,
+    notify_conn(game.game_connections, NULL, E_MESSAGE_WALL,
                   _("Server Operator: %s"), str);
   }
   return TRUE;
@@ -3508,7 +3508,7 @@ static bool end_command(struct connectio
     if (check) {
       return TRUE;
     }
-    notify_conn_ex(game.est_connections, NULL, E_GAME_END,
+    notify_conn(game.est_connections, NULL, E_GAME_END,
                    _("Game ended in a draw."));
     gamelog(GAMELOG_JUDGE, GL_DRAW,
             "Game ended in a draw by /endgame.");
@@ -3535,7 +3535,7 @@ static bool surrender_command(struct con
     if (check) {
       return TRUE;
     }
-    notify_conn_ex(game.est_connections, NULL, E_GAME_END,
+    notify_conn(game.est_connections, NULL, E_GAME_END,
                    _("%s has conceded the game and can no longer win."),
                    caller->player->name);
     caller->player->surrendered = TRUE;
Index: server/techtools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/techtools.c,v
retrieving revision 1.22
diff -p -u -r1.22 techtools.c
--- server/techtools.c  1 Sep 2005 02:32:41 -0000       1.22
+++ server/techtools.c  4 Sep 2005 04:03:50 -0000
@@ -356,7 +356,7 @@ void found_new_tech(struct player *plr, 
     /* try to pick new tech to research */
 
     if (choose_goal_tech(plr)) {
-      notify_team_ex(plr, NULL, E_TECH_LEARNED,
+      notify_team(plr, NULL, E_TECH_LEARNED,
                       _("Learned %s.  "
                         "Our scientists focus on %s, goal is %s."),
                       get_tech_name(plr, tech_found),
@@ -374,7 +374,7 @@ void found_new_tech(struct player *plr, 
       if (research->researching != A_UNSET 
           && (!is_future_tech(research->researching)
              || !is_future_tech(tech_found))) {
-       notify_team_ex(plr, NULL, E_TECH_LEARNED,
+       notify_team(plr, NULL, E_TECH_LEARNED,
                         _("Learned %s.  Scientists "
                           "choose to research %s."),
                         get_tech_name(plr, tech_found),
@@ -387,10 +387,10 @@ void found_new_tech(struct player *plr, 
        research->future_tech++;
        my_snprintf(buffer2, sizeof(buffer2), _("Researching %s."),
                    get_tech_name(plr, research->researching));
-       notify_team_ex(plr, NULL, E_TECH_LEARNED, "%s%s", buffer1,
+       notify_team(plr, NULL, E_TECH_LEARNED, "%s%s", buffer1,
                         buffer2);
       } else {
-       notify_team_ex(plr, NULL, E_TECH_LEARNED,
+       notify_team(plr, NULL, E_TECH_LEARNED,
                         _("Learned %s.  Scientists "
                           "do not know what to research next."),
                         get_tech_name(plr, tech_found));
@@ -404,10 +404,10 @@ void found_new_tech(struct player *plr, 
 
   if (bonus_tech_hack) {
     if (advances[tech_found].bonus_message) {
-      notify_team_ex(plr, NULL, E_TECH_GAIN,
+      notify_team(plr, NULL, E_TECH_GAIN,
                     "%s", _(advances[tech_found].bonus_message));
     } else {
-      notify_team_ex(plr, NULL, E_TECH_GAIN,
+      notify_team(plr, NULL, E_TECH_GAIN,
                      _("Great scientists from all the "
                       "world join your civilization: you get "
                       "an immediate advance."));
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.381
diff -p -u -r1.381 unittools.c
--- server/unittools.c  1 Sep 2005 02:32:41 -0000       1.381
+++ server/unittools.c  4 Sep 2005 04:03:51 -0000
@@ -1460,7 +1460,7 @@ static void server_remove_unit(struct un
 
   /* check if this unit had F_GAMELOSS flag */
   if (unit_flag(punit, F_GAMELOSS) && unit_owner(punit)->is_alive) {
-    notify_conn_ex(game.est_connections, punit->tile, E_UNIT_LOST,
+    notify_conn(game.est_connections, punit->tile, E_UNIT_LOST,
                    _("Unable to defend %s, %s has lost the game."),
                    unit_name(punit->type), unit_owner(punit)->name);
     notify_player(unit_owner(punit), punit->tile, E_GAME_END,
@@ -1998,7 +1998,7 @@ void do_nuclear_explosion(struct player 
     do_nuke_tile(pplayer, ptile1);
   } square_iterate_end;
 
-  notify_conn_ex(game.game_connections, ptile, E_NUKE,
+  notify_conn(game.game_connections, ptile, E_NUKE,
                 _("%s detonated a nuke!"), pplayer->name);
 }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13847) rename notify_conn_ex and related functions, Jason Short <=