[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/network commands.c
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus/src/network commands.c |
Date: |
Wed, 12 Nov 2003 15:24:49 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/11/12 15:24:48
Modified files:
src/network : commands.c
Log message:
Started lua support
Patches:
Index: stratagus/src/network/commands.c
diff -u stratagus/src/network/commands.c:1.74
stratagus/src/network/commands.c:1.75
--- stratagus/src/network/commands.c:1.74 Mon Nov 10 14:25:34 2003
+++ stratagus/src/network/commands.c Wed Nov 12 15:24:48 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: commands.c,v 1.74 2003/11/10 19:25:34 pludov Exp $
+// $Id: commands.c,v 1.75 2003/11/12 20:24:48 jsalmon3 Exp $
//@{
@@ -65,7 +65,10 @@
global ReplayType ReplayGameType; /// Replay game type
local int DisabledLog; /// Disabled log for replay
local int DisabledShowTips; /// Disabled show tips
+#if defined(USE_GUILE) || defined(USE_SIOD)
local SCM ReplayLog; /// Replay log
+#elif defined(USE_LUA)
+#endif
local FILE* LogFile; /// Replay log file
local unsigned long NextLogCycle; /// Next log cycle number
local int InitReplay; /// Initialize replay
@@ -143,7 +146,7 @@
fprintf(LogFile, "(replay-log\n");
fprintf(LogFile, " 'comment\t\"Generated by Stratagus Version "
VERSION "\"\n");
fprintf(LogFile, " 'comment\t\"Visit http://Stratagus.Org for more
information\"\n");
- fprintf(LogFile, " 'comment\t\"$Id: commands.c,v 1.74 2003/11/10
19:25:34 pludov Exp $\"\n");
+ fprintf(LogFile, " 'comment\t\"$Id: commands.c,v 1.75 2003/11/12
20:24:48 jsalmon3 Exp $\"\n");
if (NetworkFildes == (Socket)-1) {
fprintf(LogFile, " 'type\t\"%s\"\n", "single-player");
fprintf(LogFile, " 'race\t%d\n", GameSettings.Presets[0].Race);
@@ -232,6 +235,7 @@
/**
** Parse log
*/
+#if defined(USE_GUILE) || defined(USE_SIOD)
local SCM CclLog(SCM list)
{
SCM var;
@@ -250,10 +254,13 @@
return SCM_UNSPECIFIED;
}
+#elif defined(USE_LUA)
+#endif
/**
** Parse replay-log
*/
+#if defined(USE_GUILE) || defined(USE_SIOD)
local SCM CclReplayLog(SCM list)
{
SCM value;
@@ -389,6 +396,8 @@
return SCM_UNSPECIFIED;
}
+#elif defined(USE_LUA)
+#endif
/**
** Load a log file to replay a game
@@ -407,12 +416,22 @@
}
ReplayGameType = ReplaySinglePlayer;
+#if defined(USE_GUILE) || defined(USE_SIOD)
gh_new_procedureN("log", CclLog);
gh_new_procedureN("replay-log", CclReplayLog);
gh_define("*replay_log*", NIL);
+#elif defined(USE_LUA)
+#endif
+#if defined(USE_GUILE) || defined(USE_SIOD)
vload(name, 0, 1);
+#elif defined(USE_LUA)
+ LuaLoadFile(name);
+#endif
+#if defined(USE_GUILE) || defined(USE_SIOD)
CclGcProtectedAssign(&ReplayLog,
symbol_value(gh_symbol2scm("*replay_log*"), NIL));
+#elif defined(USE_LUA)
+#endif
NextLogCycle = ~0UL;
if (!CommandLogDisabled) {
CommandLogDisabled = 1;
@@ -439,7 +458,10 @@
fclose(LogFile);
LogFile = NULL;
}
+#if defined(USE_GUILE) || defined(USE_SIOD)
CclGcProtectedAssign(&ReplayLog,SCM_UNSPECIFIED);
+#elif defined(USE_LUA)
+#endif
}
/**
@@ -447,7 +469,10 @@
*/
global void CleanReplayLog(void)
{
+#if defined(USE_GUILE) || defined(USE_SIOD)
CclGcProtectedAssign(&ReplayLog, NIL);
+#elif defined(USE_LUA)
+#endif
// FIXME: LoadGame disables the log since replays aren't saved in the
// FIXME: saved games yet. Always enable the log again for now even
// FIXME: though it ignores the -l command line option.
@@ -469,6 +494,7 @@
*/
local void DoNextReplay(void)
{
+#if defined(USE_GUILE) || defined(USE_SIOD)
SCM value;
SCM list;
int unit;
@@ -620,6 +646,8 @@
}
CclGcProtectedAssign(&ReplayLog, gh_cdr(ReplayLog));
+#elif defined(USE_LUA)
+#endif
}
/**
@@ -627,6 +655,7 @@
*/
local void ReplayEachCycle(void)
{
+#if defined(USE_GUILE) || defined(USE_SIOD)
if (InitReplay) {
int i;
for (i = 0; i < PlayerMax; ++i) {
@@ -654,6 +683,8 @@
SetMessage("End of replay");
GameObserve = 0;
}
+#elif defined(USE_LUA)
+#endif
}
/**
@@ -1158,8 +1189,11 @@
global void NetworkCclRegister(void)
{
+#if defined(USE_GUILE) || defined(USE_SIOD)
ReplayLog = SCM_UNSPECIFIED;
CclGcProtect(&ReplayLog);
+#elif defined(USE_LUA)
+#endif
}
//@}