Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2005:
[Freeciv-Dev] (PR#13742) allow notify_conn(NULL, ...) to work
Home

[Freeciv-Dev] (PR#13742) allow notify_conn(NULL, ...) to work

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13742) allow notify_conn(NULL, ...) to work
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 Aug 2005 18:49:59 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch changes notify_conn(NULL, ...) and friends to send to 
game.est_connections.

The ailog calls are changed to use the new form, which simplifies them a 
bit.

-jason


Index: ai/ailog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/ailog.c,v
retrieving revision 1.29
diff -p -u -r1.29 ailog.c
--- ai/ailog.c  4 Aug 2005 16:26:12 -0000       1.29
+++ ai/ailog.c  23 Aug 2005 01:48:26 -0000
@@ -69,7 +69,7 @@ void TECH_LOG(int level, struct player *
 
   cat_snprintf(buffer, sizeof(buffer), buffer2);
   if (BV_ISSET(pplayer->debug, PLAYER_DEBUG_TECH)) {
-    notify_conn(game.est_connections, buffer);
+    notify_conn(NULL, buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -109,7 +109,7 @@ void DIPLO_LOG(int level, struct player 
 
   cat_snprintf(buffer, sizeof(buffer), buffer2);
   if (BV_ISSET(pplayer->debug, PLAYER_DEBUG_DIPLOMACY)) {
-    notify_conn(game.est_connections, buffer);
+    notify_conn(NULL, buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -143,7 +143,7 @@ void CITY_LOG(int level, struct city *pc
 
   cat_snprintf(buffer, sizeof(buffer), buffer2);
   if (pcity->debug) {
-    notify_conn(game.est_connections, buffer);
+    notify_conn(NULL, buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -202,7 +202,7 @@ void UNIT_LOG(int level, struct unit *pu
 
   cat_snprintf(buffer, sizeof(buffer), buffer2);
   if (punit->debug || messwin) {
-    notify_conn(game.est_connections, buffer);
+    notify_conn(NULL, buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -254,7 +254,7 @@ void BODYGUARD_LOG(int level, const stru
              s, id, charge_x, charge_y);
   cat_snprintf(buffer, sizeof(buffer), msg);
   if (punit->debug) {
-    notify_conn(game.est_connections, buffer);
+    notify_conn(NULL, buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -307,10 +307,10 @@ void TIMING_RESULTS(void)
            read_timer_seconds(aitimer[which][0]),                        \
            read_timer_seconds(aitimer[which][1]));                       \
   freelog(LOG_NORMAL, buf);                                              \
-  notify_conn(game.est_connections, buf);
+  notify_conn(NULL, buf);
 
   freelog(LOG_NORMAL, "  --- AI timing results ---");
-  notify_conn(game.est_connections, "  --- AI timing results ---");
+  notify_conn(NULL, "  --- AI timing results ---");
   OUT("Total AI time", AIT_ALL);
   OUT("Movemap", AIT_MOVEMAP);
   OUT("Units", AIT_UNITS);
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.412
diff -p -u -r1.412 plrhand.c
--- server/plrhand.c    22 Aug 2005 21:15:49 -0000      1.412
+++ server/plrhand.c    23 Aug 2005 01:48:27 -0000
@@ -696,6 +696,10 @@ void vnotify_conn_ex(struct conn_list *d
                     va_list vargs)
 {
   struct packet_chat_msg genmsg;
+
+  if (!dest) {
+    dest = game.est_connections;
+  }
   
   my_vsnprintf(genmsg.message, sizeof(genmsg.message), format, vargs);
   genmsg.event = event;
@@ -751,15 +755,9 @@ void notify_conn(struct conn_list *dest,
 void notify_player_ex(const struct player *pplayer, struct tile *ptile,
                      enum event_type event, const char *format, ...) 
 {
-  struct conn_list *dest;
+  struct conn_list *dest = pplayer ? pplayer->connections : NULL;
   va_list args;
 
-  if (pplayer) {
-    dest = pplayer->connections;
-  } else {
-    dest = game.game_connections;
-  }
-  
   va_start(args, format);
   vnotify_conn_ex(dest, ptile, event, format, args);
   va_end(args);
@@ -770,15 +768,9 @@ void notify_player_ex(const struct playe
 **************************************************************************/
 void notify_player(const struct player *pplayer, const char *format, ...) 
 {
-  struct conn_list *dest;
+  struct conn_list *dest = pplayer ? pplayer->connections : NULL;
   va_list args;
 
-  if (pplayer) {
-    dest = pplayer->connections;
-  } else {
-    dest = game.game_connections;
-  }
-  
   va_start(args, format);
   vnotify_conn_ex(dest, NULL, E_NOEVENT, format, args);
   va_end(args);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13742) allow notify_conn(NULL, ...) to work, Jason Short <=