Only in Freeciv/: .DS_Store
Only in Freeciv/: .gdb_history
Only in Freeciv/: Freeciv.pbproj
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/Makefile.am Freeciv/Makefile.am
--- freeciv-1.14.0/Makefile.am	Sat Oct 19 09:12:57 2002
+++ Freeciv/Makefile.am	Sun Feb  9 18:51:34 2003
@@ -18,8 +18,13 @@
 DSUBDIRS =
 endif
 
+if WITH_CLIPS
+CLIPSSUBDIRS = clipssrc
+else
+CLIPSSUBDIRS =
+endif
 
-SUBDIRS=	$(DSUBDIRS) intl common $(SSUBDIRS) $(CSUBDIRS) po doc
+SUBDIRS=	$(DSUBDIRS) intl common $(CLIPSSUBDIRS) $(SSUBDIRS) $(CSUBDIRS) po doc
 
 EXTRA_DIST=	acconfig.old			\
 		autogen.sh 			\
Only in freeciv-1.14.0: acconfig.old
Only in Freeciv/ai: deps
Only in Freeciv/: build
Only in Freeciv/: civgame-blah.gz
Only in Freeciv/: civgame-fins.gz
Only in Freeciv/client/agents: .DS_Store
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/client/agents/Makefile.am Freeciv/client/agents/Makefile.am
--- freeciv-1.14.0/client/agents/Makefile.am	Sat Feb  2 04:21:32 2002
+++ Freeciv/client/agents/Makefile.am	Sun Feb  9 17:11:32 2003
@@ -2,9 +2,19 @@
 
 noinst_LIBRARIES = libagents.a
 
+ALL_CLIPS_FILES=clips_agent.c clips_agent.h
+
+if WITH_CLIPS
+CLIPS_FILES=$(ALL_CLIPS_FILES)
+CLIPS_INCLUDES=-I../../clipssrc
+else
+CLIPS_FILES=
+CLIPS_INCLUDES=
+endif 
+
 ## INCLUDES = -I.. -I../gui-gtk -I../include -I$(top_srcdir)/common -I../intl -I/usr/lib/glib/include @CLIENT_CFLAGS@
 
-INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common -I../../intl -I$(srcdir)/../gui-gtk @CLIENT_CFLAGS@
+INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/common -I../../intl -I$(srcdir)/../gui-gtk @CLIENT_CFLAGS@ $(CLIPS_INCLUDES)
 
 libagents_a_SOURCES = 		\
 	agents.c		\
@@ -12,4 +22,6 @@
 	cma_core.c 		\
 	cma_core.h 		\
 	cma_fec.c		\
-	cma_fec.h 
+	cma_fec.h 		\
+	$(CLIPS_FILES)
+
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/client/agents/agents.c Freeciv/client/agents/agents.c
--- freeciv-1.14.0/client/agents/agents.c	Fri Oct 11 19:35:11 2002
+++ Freeciv/client/agents/agents.c	Thu Feb  6 20:48:01 2003
@@ -11,6 +11,10 @@
    GNU General Public License for more details.
 ***********************************************************************/
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <assert.h>
 #include <string.h>
 
@@ -26,6 +30,8 @@
 #include "cma_core.h"
 #include "cma_fec.h"
 
+#include "clips_agent.h"
+
 #include "agents.h"
 
 #define DEBUG_REQUEST_IDS		FALSE
@@ -39,9 +45,11 @@
 
 struct call {
   struct my_agent *agent;
-  enum oct { OCT_NEW_TURN, OCT_UNIT, OCT_CITY } type;
+  enum oct { OCT_NEW_TURN, OCT_UNIT, OCT_CITY, OCT_PLAYER, OCT_EVENT } type;
   enum callback_type cb_type;
   int arg;
+  int x;
+  int y;
 };
 
 #define SPECLIST_TAG call
@@ -83,7 +91,7 @@
 ***********************************************************************/
 static void enqueue_call(struct my_agent *agent,
 			 enum oct type,
-			 enum callback_type cb_type, int arg)
+			 enum callback_type cb_type, int arg, int x, int y)
 {
   struct call *pcall2;
 
@@ -104,6 +112,8 @@
   pcall2->type = type;
   pcall2->cb_type = cb_type;
   pcall2->arg = arg;
+  pcall2->x = x;
+  pcall2->y = y;
 
   call_list_insert(&agents.calls, pcall2);
 
@@ -160,6 +170,10 @@
     call->agent->agent.unit_callbacks[call->cb_type] (call->arg);
   } else if (call->type == OCT_CITY) {
     call->agent->agent.city_callbacks[call->cb_type] (call->arg);
+  } else if (call->type == OCT_PLAYER) {
+    call->agent->agent.player_callbacks[call->cb_type] (call->arg);
+  } else if (call->type == OCT_EVENT) {
+    call->agent->agent.event_notify(call->arg, call->x, call->y);
   } else {
     assert(0);
   }
@@ -296,6 +310,9 @@
   /* Add init calls of agents here */
   cma_init();
   cmafec_init();
+#ifdef CLIPS
+  clips_init();
+#endif
 }
 
 /***********************************************************************
@@ -311,6 +328,9 @@
    * let the OS free the memory on exit instead of doing it ourselves. */
   /* cmafec_free(); */
   cma_free();
+#ifdef CLIPS
+  clips_free();
+#endif
 
   for (;;) {
     struct call *pcall = remove_and_return_a_call();
@@ -442,7 +462,7 @@
       continue;
     }
     if (agent->agent.turn_start_notify) {
-      enqueue_call(agent, OCT_NEW_TURN, CB_LAST, 0);
+      enqueue_call(agent, OCT_NEW_TURN, CB_LAST, 0, 0, 0);
     }
   }
   /*
@@ -475,7 +495,7 @@
       continue;
     }
     if (agent->agent.unit_callbacks[CB_CHANGE]) {
-      enqueue_call(agent, OCT_UNIT, CB_CHANGE, punit->id);
+      enqueue_call(agent, OCT_UNIT, CB_CHANGE, punit->id, 0, 0);
     }
   }
   call_handle_methods();
@@ -501,7 +521,7 @@
       continue;
     }
     if (agent->agent.unit_callbacks[CB_NEW]) {
-      enqueue_call(agent, OCT_UNIT, CB_NEW, punit->id);
+      enqueue_call(agent, OCT_UNIT, CB_NEW, punit->id, 0, 0);
     }
   }
 
@@ -528,7 +548,7 @@
       continue;
     }
     if (agent->agent.unit_callbacks[CB_REMOVE]) {
-      enqueue_call(agent, OCT_UNIT, CB_REMOVE, punit->id);
+      enqueue_call(agent, OCT_UNIT, CB_REMOVE, punit->id, 0, 0);
     }
   }
 
@@ -553,7 +573,7 @@
       continue;
     }
     if (agent->agent.city_callbacks[CB_CHANGE]) {
-      enqueue_call(agent, OCT_CITY, CB_CHANGE, pcity->id);
+      enqueue_call(agent, OCT_CITY, CB_CHANGE, pcity->id, 0, 0);
     }
   }
   call_handle_methods();
@@ -579,7 +599,7 @@
       continue;
     }
     if (agent->agent.city_callbacks[CB_NEW]) {
-      enqueue_call(agent, OCT_CITY, CB_NEW, pcity->id);
+      enqueue_call(agent, OCT_CITY, CB_NEW, pcity->id, 0, 0);
     }
   }
 
@@ -606,7 +626,82 @@
       continue;
     }
     if (agent->agent.city_callbacks[CB_REMOVE]) {
-      enqueue_call(agent, OCT_CITY, CB_REMOVE, pcity->id);
+      enqueue_call(agent, OCT_CITY, CB_REMOVE, pcity->id, 0, 0);
+    }
+  }
+
+  call_handle_methods();
+}
+
+/***********************************************************************
+ Called from client/packhand.c. See agents_unit_changed for a generic
+ documentation.
+***********************************************************************/
+void agents_player_changed(int player_no)
+{
+  int i;
+
+  freelog(LOG_DEBUG,
+	  "A: agents_player_changed(player_no=(%d))", player_no);
+
+  for (i = 0; i < agents.entries_used; i++) {
+    struct my_agent *agent = &agents.entries[i];
+
+    if (is_outstanding_request(agent)) {
+      continue;
+    }
+    if (agent->agent.player_callbacks[CB_CHANGE]) {
+      enqueue_call(agent, OCT_PLAYER, CB_CHANGE, player_no, 0, 0);
+    }
+  }
+
+  call_handle_methods();
+}
+
+/***********************************************************************
+ Called from client/packhand.c. See agents_unit_changed for a generic
+ documentation.
+***********************************************************************/
+void agents_player_new(int player_no)
+{
+  int i;
+
+  freelog(LOG_DEBUG,
+	  "A: agents_player_new(player_no=(%d))", player_no);
+
+  for (i = 0; i < agents.entries_used; i++) {
+    struct my_agent *agent = &agents.entries[i];
+
+    if (is_outstanding_request(agent)) {
+      continue;
+    }
+    if (agent->agent.player_callbacks[CB_NEW]) {
+      enqueue_call(agent, OCT_PLAYER, CB_NEW, player_no, 0, 0);
+    }
+  }
+
+  call_handle_methods();
+}
+
+/***********************************************************************
+ Called from client/packhand.c. See agents_unit_changed for a generic
+ documentation.
+***********************************************************************/
+void agents_player_remove(int player_no)
+{
+  int i;
+
+  freelog(LOG_DEBUG,
+	  "A: agents_player_removee(player_no=(%d))", player_no);
+
+  for (i = 0; i < agents.entries_used; i++) {
+    struct my_agent *agent = &agents.entries[i];
+
+    if (is_outstanding_request(agent)) {
+      continue;
+    }
+    if (agent->agent.player_callbacks[CB_REMOVE]) {
+      enqueue_call(agent, OCT_PLAYER, CB_REMOVE, player_no, 0, 0);
     }
   }
 
@@ -614,6 +709,30 @@
 }
 
 /***********************************************************************
+ Called from client/packhand.c. See agents_unit_changed for a generic
+ documentation.
+***********************************************************************/
+void agents_event(int type, int x, int y)
+{
+  int i;
+
+  for (i = 0; i < agents.entries_used; i++) {
+    struct my_agent *agent = &agents.entries[i];
+
+    if (is_outstanding_request(agent)) {
+      continue;
+    }
+    if (agent->agent.event_notify) {
+      enqueue_call(agent, OCT_EVENT, CB_LAST, type, x, y);
+    }
+  }
+  /*
+   * call_handle_methods() isn't called here because the agents are
+   * frozen anyway.
+   */
+}
+
+/***********************************************************************
  Called from an agent. This function will return until the last
  request has been processed by the server.
 ***********************************************************************/
@@ -660,7 +779,7 @@
   struct my_agent *agent = find_agent_by_name(name_of_calling_agent);
 
   assert(agent->agent.unit_callbacks[CB_CHANGE] != NULL);
-  enqueue_call(agent, OCT_UNIT, CB_CHANGE, punit->id);
+  enqueue_call(agent, OCT_UNIT, CB_CHANGE, punit->id, 0, 0);
   call_handle_methods();
 }
 
@@ -673,7 +792,7 @@
   struct my_agent *agent = find_agent_by_name(name_of_calling_agent);
 
   assert(agent->agent.city_callbacks[CB_CHANGE] != NULL);
-  enqueue_call(agent, OCT_CITY, CB_CHANGE, pcity->id);
+  enqueue_call(agent, OCT_CITY, CB_CHANGE, pcity->id, 0, 0);
   call_handle_methods();
 }
 
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/client/agents/agents.h Freeciv/client/agents/agents.h
--- freeciv-1.14.0/client/agents/agents.h	Fri Oct 11 19:35:11 2002
+++ Freeciv/client/agents/agents.h	Thu Feb  6 20:00:47 2003
@@ -38,6 +38,8 @@
   void (*turn_start_notify) (void);
   void (*city_callbacks[CB_LAST]) (int);
   void (*unit_callbacks[CB_LAST]) (int);
+  void (*player_callbacks[CB_LAST]) (int);
+  void (*event_notify) (int type, int x, int y);
 };
 
 void agents_init(void);
@@ -64,6 +66,12 @@
 void agents_city_changed(struct city *pcity);
 void agents_city_new(struct city *pcity);
 void agents_city_remove(struct city *pcity);
+
+void agents_player_changed(int player_no);
+void agents_player_new(int player_no);
+void agents_player_remove(int player_no);
+
+void agents_event(int type, int x, int y);
 
 /* called from agents */
 void cause_a_city_changed_for_agent(char *name_of_calling_agent,
Only in Freeciv/client/agents: clips_agent.c
Only in Freeciv/client/agents: clips_agent.h
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/client/civclient.c Freeciv/client/civclient.c
--- freeciv-1.14.0/client/civclient.c	Fri Oct 11 19:35:11 2002
+++ Freeciv/client/civclient.c	Wed Feb  5 08:19:47 2003
@@ -68,6 +68,9 @@
 #include "attribute.h"
 #include "agents.h"
 #include "audio.h"
+#ifdef CLIPS
+#include "clips_agent.h"
+#endif
 
 #include "cma_core.h" /* kludge */
 
@@ -785,6 +788,9 @@
   }
 
   blink_active_unit();
+#ifdef CLIPS
+  clips_run();
+#endif
 
   if (flip) {
     update_timeout_label();
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/client/gui-gtk/Makefile.am Freeciv/client/gui-gtk/Makefile.am
--- freeciv-1.14.0/client/gui-gtk/Makefile.am	Sat Feb  2 04:21:34 2002
+++ Freeciv/client/gui-gtk/Makefile.am	Tue Jan 14 01:03:58 2003
@@ -19,7 +19,16 @@
 
 libguiclient_a_DEPENDENCIES = rc2c
 
+ALL_CLIPS_FILES=clipsdlg.c
+
+if WITH_CLIPS
+CLIPS_FILES=$(ALL_CLIPS_FILES)
+else
+CLIPS_FILES=
+endif 
+
 libguiclient_a_SOURCES = \
+        $(ALL_CLIPS_FILES) \
 	rc2c		\
 	Freeciv.h	\
 	chatline.h	\
Only in Freeciv/client/gui-gtk: clipsdlg.c
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/client/gui-gtk/menu.c Freeciv/client/gui-gtk/menu.c
--- freeciv-1.14.0/client/gui-gtk/menu.c	Sun Jun 23 12:06:24 2002
+++ Freeciv/client/gui-gtk/menu.c	Tue Jan 14 01:03:58 2003
@@ -48,6 +48,7 @@
 #include "repodlgs.h"
 #include "spaceshipdlg.h"
 #include "wldlg.h"
+#include "clipsdlg.h"
 
 #include "menu.h"
 
@@ -130,6 +131,7 @@
   MENU_REPORT_MESSAGES,
   MENU_REPORT_DEMOGRAPHIC,
   MENU_REPORT_SPACESHIP,
+  MENU_REPORT_CLIPS,
 
   MENU_HELP_LANGUAGES,
   MENU_HELP_CONNECTING,
@@ -441,6 +443,9 @@
    case MENU_REPORT_SPACESHIP:
     popup_spaceship_dialog(game.player_ptr);
     break;
+   case MENU_REPORT_CLIPS:
+    popup_clips_dialog();
+    break;
   }
 }
 
@@ -726,6 +731,11 @@
 	reports_menu_callback,	MENU_REPORT_DEMOGRAPHIC					},
   { "/" N_("Reports") "/" N_("S_paceship"),		"F12",
 	reports_menu_callback,	MENU_REPORT_SPACESHIP					},
+  { "/" N_("Reports") "/sep2",				NULL,
+	NULL,			0,					"<Separator>"	},
+  { "/" N_("Reports") "/" N_("CLIPS Shell"),            NULL,
+        reports_menu_callback, MENU_REPORT_CLIPS
+        },
   /* Help menu ... */
   { "/" N_("_Help"),					NULL,
 	NULL,			0,					"<LastBranch>"	},
Only in Freeciv/client/gui-mui: CVS.dead
Only in Freeciv/client/gui-stub: CVS.dead
Only in Freeciv/client/gui-win32: CVS.dead
Only in Freeciv/client/gui-xaw: CVS.dead
Only in Freeciv/client/include: clipsdlg.h
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/client/packhand.c Freeciv/client/packhand.c
--- freeciv-1.14.0/client/packhand.c	Fri Jan 17 03:39:27 2003
+++ Freeciv/client/packhand.c	Sun Feb  9 12:33:39 2003
@@ -745,6 +745,7 @@
     popup_notify_goto_dialog(_("Popup Request"), packet->message, 
 			     packet->x, packet->y);
   play_sound_for_event(packet->event);
+  agents_event(packet->event, packet->x, packet->y);
 }
  
 /**************************************************************************
@@ -1167,6 +1168,7 @@
 
   if (!pplayer->island_improv) {   /* initialise new player */
     client_init_player(pplayer);
+    agents_player_new(pinfo->playerno);
   }
 
   pplayer->nation=pinfo->nation;
@@ -1250,6 +1252,8 @@
       && get_client_state() == CLIENT_GAME_RUNNING_STATE) {
     update_info_label();
   }
+
+  agents_player_changed(pinfo->playerno);
 }
 
 /**************************************************************************
@@ -1612,6 +1616,7 @@
 void handle_remove_player(struct packet_generic_integer *packet)
 {
   client_remove_player(packet->value);
+  agents_player_remove(packet->value);
 }
 
 /**************************************************************************
Only in Freeciv/: clipssrc
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/configure.ac Freeciv/configure.ac
--- freeciv-1.14.0/configure.ac	Fri Jan 17 04:09:20 2003
+++ Freeciv/configure.ac	Sun Feb  9 17:45:41 2003
@@ -130,6 +130,11 @@
 	WITH_EFENCE=1
 )
 
+AC_ARG_WITH(clips,
+        [  --with-clips            use CLIPS for client-side AI ],
+        WITH_CLIPS=yes
+)
+
 dnl Checks for programs.
 AC_PROG_AWK
 AC_PROG_CC
@@ -480,6 +485,19 @@
 
   gui_sources="gui-$client"
 fi
+
+dnl CLIPS
+if test "x$WITH_CLIPS" = "xyes"; then
+  AC_DEFINE(CLIPS, 1, [CLIPS Integration])
+  dnl AC_CHECK_LIB(clips, InitializeEnvironment, [
+  if test "x$CLIENT_LIBS" = "x"; then
+    CLIENT_LIBS="..clipssrc/libclips.a"
+  else
+    CLIENT_LIBS="$CLIENT_LIBS ../clipssrc/libclips.a"
+  fi
+  dnl fi])
+fi
+
 AC_SUBST(gui_sources)
 AC_SUBST(CLIENT_CFLAGS)
 AC_SUBST(CLIENT_LIBS)
@@ -494,6 +512,7 @@
 AM_CONDITIONAL(CLIENT_GUI_BEOS, test "$gui_sources" = "gui-beos")
 AM_CONDITIONAL(CLIENT_GUI_STUB, test "$gui_sources" = "gui-stub")
 AM_CONDITIONAL(CLIENT_GUI_WIN32, test "$gui_sources" = "gui-win32")
+AM_CONDITIONAL(WITH_CLIPS, test "x$WITH_CLIPS" = "xyes")
 
 dnl Checks for additional server libraries:
 if test x$server = xtrue; then
@@ -708,6 +727,7 @@
 	  client/gui-xaw/Makefile 
 	  client/gui-win32/Makefile 
 	  client/gui-stub/Makefile 
+          clipssrc/Makefile 
 	  server/Makefile 
 	  intl/Makefile
 	  po/Makefile.in
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/configure.in Freeciv/configure.in
--- freeciv-1.14.0/configure.in	Fri Jan 17 04:09:14 2003
+++ Freeciv/configure.in	Sun Feb  9 12:33:39 2003
@@ -129,6 +129,11 @@
 	WITH_EFENCE=1
 )
 
+AC_ARG_WITH(clips,
+	[ --with-clips             use CLIPS for client-side AI ],
+	WITH_CLIPS=1
+)
+
 dnl Checks for programs.
 AC_PROG_AWK
 AC_PROG_CC
@@ -474,6 +479,15 @@
 
   gui_sources="gui-$client"
 fi
+
+dnl CLIPS
+if test -n "$WITH_CLIPS"; then
+  if test "x$CLIENT_LIBS" = "x"; then
+    CLIENT_LIBS="-lclips"
+  else
+    CLIENT_LIBS="$CLIENT_LIBS -lclips"
+fi
+
 AC_SUBST(gui_sources)
 AC_SUBST(CLIENT_CFLAGS)
 AC_SUBST(CLIENT_LIBS)
@@ -602,6 +616,7 @@
 else
   AC_DEFINE_UNQUOTED(DEFAULT_DATA_PATH, ".:data:~/.freeciv:$FREECIV_DATADIR")
 fi
+
 
 dnl This has to be last library
 if test -n "$WITH_EFENCE"; then
Only in Freeciv/data: .DS_Store
Only in Freeciv/data: clips.hlp
Only in Freeciv/data: common.clp
Only in Freeciv/data: init.clp
Only in Freeciv/data/isotrident: CVS.dead
Only in Freeciv/data: main.clp
Only in Freeciv/data: rules.clp
Only in Freeciv/data: rules.clp.bak.1
Only in Freeciv/data: stdsounds
Only in Freeciv/data: stdsounds.soundspec
Only in Freeciv/data/trident: CVS.dead
Only in Freeciv/: diefenbaker1.gz
Only in freeciv-1.14.0/doc: INSTALL.Cygwin
Only in Freeciv/doc: README.clips
Only in Freeciv/: instances
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/m4/ac_path_lib.m4 Freeciv/m4/ac_path_lib.m4
--- freeciv-1.14.0/m4/ac_path_lib.m4	Sat Apr 13 09:51:45 2002
+++ Freeciv/m4/ac_path_lib.m4	Tue Jan 14 01:04:09 2003
@@ -57,7 +57,7 @@
 dnl Based on `AM_PATH_GTK' (gtk.m4) by Owen Taylor, and `AC_PATH_GENERIC'
 dnl (ac_path_generic.m4) by Angus Lees <gusl@cse.unsw.edu.au>
 dnl
-dnl @version $Id: ac_path_lib.m4,v 1.1 2002/04/13 13:51:45 rfalke Exp $
+dnl @version $Id: ac_path_lib.m4,v 1.1.1.1 2003/01/14 06:04:09 martin Exp $
 dnl @author Roger Leigh <roger@whinlatter.uklinux.net>
 dnl
 AC_DEFUN([AC_PATH_LIB],[# check for presence of lib$1
diff -ur -Xfreeciv-1.14.0/diff_ignore freeciv-1.14.0/m4/vsnprintf.m4 Freeciv/m4/vsnprintf.m4
--- freeciv-1.14.0/m4/vsnprintf.m4	Sat Apr 13 09:51:48 2002
+++ Freeciv/m4/vsnprintf.m4	Tue Jan 14 01:04:09 2003
@@ -6,7 +6,7 @@
 dnl the buffer supplied, and having a sensible return value.  It is
 dnl explicitly allowed not to NUL-terminate the return value, however.
 dnl
-dnl @version $Id: vsnprintf.m4,v 1.1 2002/04/13 13:51:48 rfalke Exp $
+dnl @version $Id: vsnprintf.m4,v 1.1.1.1 2003/01/14 06:04:09 martin Exp $
 dnl @author Gaute Strokkenes <gs234@cam.ac.uk>
 dnl
 AC_DEFUN([AC_FUNC_VSNPRINTF],
