Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] (PR#13019) Meta-Ticket: Improved scripting
Home

[Freeciv-Dev] (PR#13019) Meta-Ticket: Improved scripting

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13019) Meta-Ticket: Improved scripting
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Mon, 9 May 2005 18:01:55 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch adds two more signals:
'turn_started' and 'unit_moved'.

Patch by Jason Dorje Short.

Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.259
diff -u -r1.259 srv_main.c
--- server/srv_main.c   7 May 2005 14:03:53 -0000       1.259
+++ server/srv_main.c   10 May 2005 00:57:02 -0000
@@ -480,6 +480,12 @@
   send_game_info(game.game_connections);
 
   if (is_new_turn) {
+    script_signal_emit("turn_started", 2,
+                      API_TYPE_INT, game.info.turn,
+                      API_TYPE_INT, game.info.year);
+  }
+
+  if (is_new_turn) {
     /* We build scores at the beginning of every turn.  We have to
      * build them at the beginning so that the AI can use the data,
      * and we are sure to have it when we need it. */
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.353
diff -u -r1.353 unittools.c
--- server/unittools.c  8 May 2005 06:37:50 -0000       1.353
+++ server/unittools.c  10 May 2005 00:57:02 -0000
@@ -2942,6 +2942,10 @@
   } square_iterate_end;
 
   handle_unit_move_consequences(punit, psrctile, pdesttile);
+  script_signal_emit("unit_moved", 3,
+                    API_TYPE_UNIT, punit,
+                    API_TYPE_TILE, psrctile,
+                    API_TYPE_TILE, pdesttile);
   wakeup_neighbor_sentries(punit);
   if (!unit_survive_autoattack(punit)) {
     return FALSE;
Index: server/scripting/script_signal.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/scripting/script_signal.c,v
retrieving revision 1.2
diff -u -r1.2 script_signal.c
--- server/scripting/script_signal.c    9 May 2005 21:24:48 -0000       1.2
+++ server/scripting/script_signal.c    10 May 2005 00:57:02 -0000
@@ -308,5 +308,8 @@
 **************************************************************************/
 static void signals_create(void)
 {
+  script_signal_create("turn_started", 2, API_TYPE_INT, API_TYPE_INT);
+  script_signal_create("unit_moved",
+                      3, API_TYPE_UNIT, API_TYPE_TILE, API_TYPE_TILE);
   script_signal_create("hut_enter", 1, API_TYPE_UNIT);
 }

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