diff --git a/doc/ChangeLog.html b/doc/ChangeLog.html
index 368c18358..bf751474d 100644
--- a/doc/ChangeLog.html
+++ b/doc/ChangeLog.html
@@ -791,6 +791,7 @@
     <LI>Added keyboard, mouse, and game speed options. (from Nehal Mistry)
     <LI>Added master, music, and cd volume control options. (from Nehal Mistry)
     <LI>Added fog of war control to preferences. (from Nehal Mistry)
+    <LI>Fixed bug #542313: Sleep does not work with NEW_AI.
     <LI>+++
     </UL>
 
diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp
index 4c267cd0f..87e5deb5b 100644
--- a/src/ai/ai.cpp
+++ b/src/ai/ai.cpp
@@ -50,7 +50,7 @@
 --	Variables
 ----------------------------------------------------------------------------*/
 
-global int AiSleep;			/// Ai sleeps # frames
+global int AiSleepCycles;		/// Ai sleeps # cycles
 global int AiTimeFactor = 100;		/// Adjust the AI build times
 global int AiCostFactor = 100;		/// Adjust the AI costs
 
diff --git a/src/ai/ai_local.h b/src/ai/ai_local.h
index 24b3db9e4..fb0d0fa68 100644
--- a/src/ai/ai_local.h
+++ b/src/ai/ai_local.h
@@ -228,7 +228,7 @@ typedef struct _player_ai_ {
     // controller
     SCM		Script;			/// Script executed
     int		ScriptDebug;		/// Flag script debuging on/off
-    int		SleepFrames;		/// Frames to sleep
+    int		SleepCycles;		/// Cycles to sleep
 
     // forces
 #define AI_MAX_FORCES	10		/// How many forces are supported
diff --git a/src/ai/old_ai.cpp b/src/ai/old_ai.cpp
index 30743254e..84a2552b7 100644
--- a/src/ai/old_ai.cpp
+++ b/src/ai/old_ai.cpp
@@ -83,7 +83,7 @@
 --      Ai tables
 ----------------------------------------------------------------------------*/
 
-global int AiSleep = 0;			/// Ai sleeps # frames
+global int AiSleepCycles;		/// Ai sleeps # cycles
 global int AiTimeFactor = 100;		/// Adjust the AI build times
 global int AiCostFactor = 100;		/// Adjust the AI costs
 
diff --git a/src/ai/script_ai.cpp b/src/ai/script_ai.cpp
index 14f255c17..8dc5b0122 100644
--- a/src/ai/script_ai.cpp
+++ b/src/ai/script_ai.cpp
@@ -35,6 +35,7 @@
 #include "freecraft.h"
 #include "unittype.h"
 #include "ccl.h"
+#include "ai.h"
 #include "ai_local.h"
 
 /*----------------------------------------------------------------------------
@@ -499,6 +500,14 @@ local SCM CclAiGetRace(void)
     return gh_symbol2scm(AiPlayer->Player->RaceName);
 }
 
+/**
+**	Get the number of cycles to sleep.
+*/
+local SCM CclAiGetSleepCycles(void)
+{
+    return gh_int2scm(AiSleepCycles);
+}
+
 //----------------------------------------------------------------------------
 
 /**
@@ -768,23 +777,23 @@ local SCM CclAiAttackWithForce(SCM value)
 }
 
 /**
-**	Sleep n frames.
+**	Sleep n cycles.
 **
-**	@param value	Number of frames to delay.
+**	@param value	Number of cycles to delay.
 */
 local SCM CclAiSleep(SCM value)
 {
     int i;
 
-    DebugLevel3Fn("%lu %d\n",GameCycle,AiPlayer->SleepFrames);
-    if( AiPlayer->SleepFrames ) {
-	if( AiPlayer->SleepFrames<GameCycle ) {
-	    AiPlayer->SleepFrames=0;
+    DebugLevel3Fn("%lu %d\n",GameCycle,AiPlayer->SleepCycles);
+    if( AiPlayer->SleepCycles ) {
+	if( AiPlayer->SleepCycles<GameCycle ) {
+	    AiPlayer->SleepCycles=0;
 	    return SCM_BOOL_F;
 	}
     } else {
 	i=gh_scm2int(value);
-	AiPlayer->SleepFrames=GameCycle+i;
+	AiPlayer->SleepCycles=GameCycle+i;
     }
 
     return SCM_BOOL_T;
@@ -1034,6 +1043,7 @@ global void AiCclRegister(void)
 
 #if defined(NEW_AI)
     gh_new_procedure0_0("ai:get-race",CclAiGetRace);
+    gh_new_procedure0_0("ai:get-sleep-cycles",CclAiGetSleepCycles);
 
     gh_new_procedure1_0("ai:debug",CclAiDebug);
     gh_new_procedure1_0("ai:need",CclAiNeed);
diff --git a/src/include/ai.h b/src/include/ai.h
index 680c14012..949bdae3e 100644
--- a/src/include/ai.h
+++ b/src/include/ai.h
@@ -38,7 +38,7 @@
 --	Variables
 ----------------------------------------------------------------------------*/
 
-extern int AiSleep;			/// Ai sleeps # frames
+extern int AiSleepCycles;		/// Ai sleeps # cycles
 extern int AiTimeFactor;		/// Adjust the AI build times
 extern int AiCostFactor;		/// Adjust the AI costs
 
diff --git a/src/stratagus/stratagus.cpp b/src/stratagus/stratagus.cpp
index f790df974..19aad2c39 100644
--- a/src/stratagus/stratagus.cpp
+++ b/src/stratagus/stratagus.cpp
@@ -836,7 +836,7 @@ global int main(int argc,char** argv)
 		strncpy(NetworkName, optarg, 16);
 		continue;
 	    case 's':
-		AiSleep=atoi(optarg);
+		AiSleepCycles=atoi(optarg);
 		continue;
 	    case 't':
 		AiTimeFactor=atoi(optarg);