From dbf517d265cdf8fa37e9dd479747616d99836528 Mon Sep 17 00:00:00 2001
From: jsalmon3 <>
Date: Tue, 3 Sep 2002 01:21:48 +0000
Subject: [PATCH] Added set-game-cycle!

---
 doc/scripts/game.html    | 34 ++++++++++++++++++++++++++++++----
 doc/scripts/index.html   |  2 ++
 src/stratagus/script.cpp | 11 ++++++++++-
 3 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/doc/scripts/game.html b/doc/scripts/game.html
index f4fe6b182..bd6f24b89 100644
--- a/doc/scripts/game.html
+++ b/doc/scripts/game.html
@@ -80,6 +80,7 @@
 <A HREF="#reset-keystroke-help">reset-keystroke-help</A>
 <A HREF="#selection">selection</A>
 <A HREF="#set-diplomacy!">set-diplomacy!</A>
+<A HREF="#set-game-cycle!">set-game-cycle!</A>
 <A HREF="#set-group-id!">set-group-id!</A>
 <A HREF="#set-player-resources!">set-player-resources!</A>
 <A HREF="#set-this-player!">set-this-player!</A>
@@ -561,7 +562,7 @@ Everything around the game.
 
 <H4>Description</H4>
 
-.
+Returns the current game cycle.
 
 <H4>Syntax</H4>
 
@@ -581,9 +582,7 @@ Everything around the game.
 
 <P>.
 
-<H4>Used</H4>
-
-<A HREF="../../data/ccl/wc2.ccl"> $LIBARYPATH/ccl/wc2.ccl </A>
+<H4>Not Used</H4>
 
 <A NAME="get-freecraft-home-path"></A>
 <H3>get-freecraft-home-path</H3>
@@ -1165,6 +1164,33 @@ Everything around the game.
 
 <A HREF="../../data/ccl/wc2.ccl"> $LIBARYPATH/ccl/wc2.ccl </A>
 
+<A NAME="set-game-cycle!"></A>
+<H3>set-game-cycle!</H3>
+
+<H4>Description</H4>
+
+Set the current game cycle number.
+
+<H4>Syntax</H4>
+
+<CODE>(set-game-cycle! cycle)</CODE>
+
+<DL>
+<DT>cycle</DT>
+<DD>The game cycle number.
+</DD>
+</DL>
+
+<H4>Example</H4>
+
+<PRE>
+    (set-game-cycle! 100)
+</PRE>
+
+<P>Set the game cycle number to 100.
+
+<H4>Not Used</H4>
+
 <A NAME="set-group-id!"></A>
 <H3>set-group-id!</H3>
 
diff --git a/doc/scripts/index.html b/doc/scripts/index.html
index a68a4f6ea..b382429c6 100644
--- a/doc/scripts/index.html
+++ b/doc/scripts/index.html
@@ -372,6 +372,8 @@
 <DD></DD>
 <DT><A HREF="ui.html#set-game-cursor!">set-game-cursor!</A></DT>
 <DD></DD>
+<DT><A HREF="game.html#set-game-cycle!">set-game-cycle!</A></DT>
+<DD></DD>
 <DT><A HREF="sound.html#set-global-sound-range!">set-global-sound-range!</A></DT>
 <DD></DD>
 <DT><A HREF="config.html#set-goldmine-depleted!">set-goldmine-depleted!</A></DT>
diff --git a/src/stratagus/script.cpp b/src/stratagus/script.cpp
index 32d3365dc..efbf4a882 100644
--- a/src/stratagus/script.cpp
+++ b/src/stratagus/script.cpp
@@ -108,6 +108,15 @@ local SCM CclGameCycle(void)
     return gh_int2scm(GameCycle);
 }
 
+/**
+**	Set the freecraft game-cycle
+*/
+local SCM CclSetGameCycle(SCM cycle)
+{
+    GameCycle=gh_scm2int(cycle);
+    return SCM_UNSPECIFIED;
+}
+
 /**
 **	Enable/disable Showing the tips at the start of a level.
 **
@@ -442,7 +451,7 @@ global void InitCcl(void)
 
     gh_new_procedure0_0("library-path",CclFreeCraftLibraryPath);
     gh_new_procedure0_0("game-cycle",CclGameCycle);
-
+    gh_new_procedure1_0("set-game-cycle!",CclSetGameCycle);
 
     gh_new_procedure1_0("set-show-tips!",CclSetShowTips);
     gh_new_procedure1_0("add-tip",CclAddTip);