Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] (PR#6870) Replace int with enum event_type
Home

[Freeciv-Dev] (PR#6870) Replace int with enum event_type

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#6870) Replace int with enum event_type
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Sat, 15 Nov 2003 07:22:05 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=6870 >


This patch should make the code type-correct wrt enum event_type. The
only semantic change is this:

-  if (event != 0)
+  if (event != E_NOEVENT)

I think the old version is wrong here.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Many of my assistants were fans of Tolkien, who wrote 'Lord of the Rings'
  and a number of other children's stories for adults.  The first character
  alphabet that was programmed for my plotter was Elvish rather than Latin."
    -- from SAIs "life as a computer for a quarter of a century"

Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.121
diff -u -u -r1.121 climisc.c
--- client/climisc.c    2003/10/21 21:49:55     1.121
+++ client/climisc.c    2003/11/15 15:08:26
@@ -946,7 +946,8 @@
   Creates a struct packet_generic_message packet and injects it via
   handle_chat_msg.
 **************************************************************************/
-void create_event(int x, int y, int event, const char *format, ...)
+void create_event(int x, int y, enum event_type event, const char *format,
+                 ...)
 {
   va_list ap;
   struct packet_generic_message packet;
Index: client/climisc.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.h,v
retrieving revision 1.44
diff -u -u -r1.44 climisc.h
--- client/climisc.h    2003/02/15 20:26:17     1.44
+++ client/climisc.h    2003/11/15 15:08:26
@@ -13,6 +13,7 @@
 #ifndef FC__CLIMISC_H
 #define FC__CLIMISC_H
 
+#include "events.h"
 #include "shared.h"            /* MAX_LEN_NAME */
 
 struct city;
@@ -107,7 +108,8 @@
 int num_supported_units_in_city(struct city* pcity);   
 
 char *get_spaceship_descr(struct player_spaceship *pship);
-void create_event(int x, int y, int event, const char *format, ...)
+void create_event(int x, int y, enum event_type event, const char *format,
+                 ...)
      fc__attribute((format (printf, 4, 5)));
 void write_chatline_content(const char *txt);
 
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.240
diff -u -u -r1.240 citytools.c
--- server/citytools.c  2003/11/07 09:45:03     1.240
+++ server/citytools.c  2003/11/15 15:08:29
@@ -1823,8 +1823,8 @@
 /**************************************************************************
   Change the build target.
 **************************************************************************/
-void change_build_target(struct player *pplayer, struct city *pcity, 
-                        int target, bool is_unit, int event)
+void change_build_target(struct player *pplayer, struct city *pcity,
+                        int target, bool is_unit, enum event_type event)
 {
   char *name;
   const char *source;
@@ -1872,7 +1872,7 @@
   }
 
   /* Tell the player what's up. */
-  if (event != 0)
+  if (event != E_NOEVENT)
     notify_player_ex(pplayer, pcity->x, pcity->y, event,
                     _("Game: %s is building %s%s."),
                     pcity->name, name, source);
Index: server/citytools.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.h,v
retrieving revision 1.47
diff -u -u -r1.47 citytools.h
--- server/citytools.h  2003/07/20 20:41:39     1.47
+++ server/citytools.h  2003/11/15 15:08:29
@@ -14,6 +14,7 @@
 #define FC__CITYTOOLS_H
 
 #include "city.h"
+#include "events.h"
 #include "nation.h"            /* for struct city_name */
 #include "packets.h"
 
@@ -79,8 +80,8 @@
 
 void do_sell_building(struct player *pplayer, struct city *pcity, int id);
 void building_lost(struct city *pcity, int id);
-void change_build_target(struct player *pplayer, struct city *pcity, 
-                        int target, bool is_unit, int event);
+void change_build_target(struct player *pplayer, struct city *pcity,
+                        int target, bool is_unit, enum event_type event);
 
 bool is_allowed_city_name(struct player *pplayer, const char *city_name,
                          int x, int y, bool notify_player);
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.296
diff -u -u -r1.296 plrhand.c
--- server/plrhand.c    2003/11/08 03:39:26     1.296
+++ server/plrhand.c    2003/11/15 15:08:31
@@ -1053,8 +1053,9 @@
   coordinates have been normalized.  For generic event use E_NOEVENT.
   (But current clients do not use (x,y) data for E_NOEVENT events.)
 **************************************************************************/
-void vnotify_conn_ex(struct conn_list *dest, int x, int y, int event,
-                    const char *format, va_list vargs) 
+void vnotify_conn_ex(struct conn_list *dest, int x, int y,
+                    enum event_type event, const char *format,
+                    va_list vargs)
 {
   struct packet_generic_message genmsg;
   
@@ -1082,8 +1083,8 @@
 /**************************************************************************
   See vnotify_conn_ex - this is just the "non-v" version, with varargs.
 **************************************************************************/
-void notify_conn_ex(struct conn_list *dest, int x, int y, int event,
-                   const char *format, ...) 
+void notify_conn_ex(struct conn_list *dest, int x, int y,
+                   enum event_type event, const char *format, ...)
 {
   va_list args;
   va_start(args, format);
@@ -1110,7 +1111,7 @@
   explicitly game.est_connections or game.game_connections as dest.
 **************************************************************************/
 void notify_player_ex(const struct player *pplayer, int x, int y,
-                     int event, const char *format, ...) 
+                     enum event_type event, const char *format, ...) 
 {
   struct conn_list *dest;
   va_list args;
Index: server/plrhand.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.h,v
retrieving revision 1.59
diff -u -u -r1.59 plrhand.h
--- server/plrhand.h    2003/10/20 08:30:22     1.59
+++ server/plrhand.h    2003/11/15 15:08:31
@@ -15,6 +15,7 @@
 
 #include <stdarg.h>
 
+#include "events.h"
 #include "packets.h"
 #include "shared.h"            /* fc__attribute */
 
@@ -46,15 +47,16 @@
 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, int x, int y, int event,
-                   const char *format, ...) 
+void notify_conn_ex(struct conn_list *dest, int x, int y,
+                   enum event_type event, const char *format, ...)
                     fc__attribute((format (printf, 5, 6)));
-void vnotify_conn_ex(struct conn_list *dest, int x, int y, int event,
-                    const char *format, va_list vargs);
+void vnotify_conn_ex(struct conn_list *dest, int x, int y,
+                    enum event_type event, const char *format,
+                    va_list vargs);
 void notify_conn(struct conn_list *dest, const char *format, ...) 
                  fc__attribute((format (printf, 2, 3)));
 void notify_player_ex(const struct player *pplayer, int x, int y,
-                     int event, const char *format, ...)
+                     enum event_type event, const char *format, ...)
                       fc__attribute((format (printf, 5, 6)));
 void notify_player(const struct player *pplayer, const char *format, ...)
                    fc__attribute((format (printf, 2, 3)));
Index: server/report.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/report.c,v
retrieving revision 1.47
diff -u -u -r1.47 report.c
--- server/report.c     2003/10/12 10:36:36     1.47
+++ server/report.c     2003/11/15 15:08:31
@@ -35,7 +35,7 @@
 
 static void page_conn_etype(struct conn_list *dest, const char *caption,
                            const char *headline, const char *lines,
-                           int event);
+                           enum event_type event);
 enum historian_type {
         HISTORIAN_RICHEST=0, 
         HISTORIAN_ADVANCED=1,
@@ -1172,7 +1172,7 @@
 **************************************************************************/
 static void page_conn_etype(struct conn_list *dest, const char *caption,
                            const char *headline, const char *lines,
-                           int event)
+                           enum event_type event)
 {
   int len;
   struct packet_generic_message genmsg;

[Prev in Thread] Current Thread [Next in Thread]