Author: cazfi
Date: Sat Aug 29 17:33:47 2015
New Revision: 29717

URL: http://svn.gna.org/viewcvs/freeciv?rev=29717&view=rev
Log:
Added 'pulse' signal to lua API.

Derived from a original request for a 'tick' signal by Michal Mazurek <akfaew>

See patch #6286

Modified:
    trunk/server/scripting/script_server.c
    trunk/server/sernet.c

Modified: trunk/server/scripting/script_server.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/script_server.c?rev=29717&r1=29716&r2=29717&view=diff
==============================================================================
--- trunk/server/scripting/script_server.c      (original)
+++ trunk/server/scripting/script_server.c      Sat Aug 29 17:33:47 2015
@@ -399,6 +399,8 @@
                           API_TYPE_BOOL);
 
   luascript_signal_create(fcl_main, "map_generated", 0);
+
+  luascript_signal_create(fcl_main, "pulse", 0);
 
   luascript_signal_create(fcl_main, "action_started_unit_unit", 3,
                           API_TYPE_ACTION,

Modified: trunk/server/sernet.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/sernet.c?rev=29717&r1=29716&r2=29717&view=diff
==============================================================================
--- trunk/server/sernet.c       (original)
+++ trunk/server/sernet.c       Sat Aug 29 17:33:47 2015
@@ -75,6 +75,9 @@
 #include "events.h"
 #include "game.h"
 #include "packets.h"
+
+/* server/scripting */
+#include "script_server.h"
 
 /* server */
 #include "aiiface.h"
@@ -645,6 +648,7 @@
     /* Don't wait if timeout == -1 (i.e. on auto games) */
     if (S_S_RUNNING == server_state() && game.info.timeout == -1) {
       call_ai_refresh();
+      script_server_signal_emit("pulse", 0);
       (void) send_server_info_to_metaserver(META_REFRESH);
       return S_E_END_OF_TURN_TIMEOUT;
     }
@@ -690,6 +694,7 @@
     if (fc_select(max_desc + 1, &readfs, &writefs, &exceptfs, &tv) == 0) {
       /* timeout */
       call_ai_refresh();
+      script_server_signal_emit("pulse", 0);
       (void) send_server_info_to_metaserver(META_REFRESH);
       if (current_turn_timeout() > 0
          && S_S_RUNNING == server_state()
@@ -878,6 +883,7 @@
   con_prompt_off();
 
   call_ai_refresh();
+  script_server_signal_emit("pulse", 0);
 
   if (current_turn_timeout() > 0
       && S_S_RUNNING == server_state()


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to