stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src network/commands.c stratagus/ccl....


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src network/commands.c stratagus/ccl....
Date: 2 Jan 2004 12:14:19 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/02 12:14:18

Modified files:
        src/network    : commands.c 
        src/stratagus  : ccl.c 
        src/ui         : interface.c 

Log message:
        Added CclCommand

Patches:
Index: stratagus/src/network/commands.c
diff -u stratagus/src/network/commands.c:1.87 
stratagus/src/network/commands.c:1.88
--- stratagus/src/network/commands.c:1.87       Fri Jan  2 10:46:40 2004
+++ stratagus/src/network/commands.c    Fri Jan  2 12:14:16 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: commands.c,v 1.87 2004/01/01 23:46:40 wizzard Exp $
+//     $Id: commands.c,v 1.88 2004/01/02 01:14:16 jsalmon3 Exp $
 
 //@{
 
@@ -174,7 +174,7 @@
 
        replay->Comment1 = strdup("Generated by Stratagus Version " VERSION "");
        replay->Comment2 = strdup("Visit http://Stratagus.Org for more 
information");
-       replay->Comment3 = strdup("$Id: commands.c,v 1.87 2004/01/01 23:46:40 
wizzard Exp $");
+       replay->Comment3 = strdup("$Id: commands.c,v 1.88 2004/01/02 01:14:16 
jsalmon3 Exp $");
 
        if (GameSettings.NetGameType == SettingsSinglePlayerGame) {
                replay->Type = ReplaySinglePlayer;
@@ -315,13 +315,13 @@
        CLprintf(dest, "  Players = {\n");
        for (i = 0; i < PlayerMax; ++i) {
                if (CurrentReplay->Players[i].Name) {
-                       CLprintf(dest, "        { Name = \"%s\",\n", 
CurrentReplay->Players[i].Name);
+                       CLprintf(dest, "        { Name = \"%s\",", 
CurrentReplay->Players[i].Name);
                } else {
-                       CLprintf(dest, "        {\n");
+                       CLprintf(dest, "        {");
                }
-               CLprintf(dest, "          Race = %d,\n", 
CurrentReplay->Players[i].Race);
-               CLprintf(dest, "          Team = %d,\n", 
CurrentReplay->Players[i].Team);
-               CLprintf(dest, "          Type = %d }%s", 
CurrentReplay->Players[i].Type,
+               CLprintf(dest, " Race = %d,", CurrentReplay->Players[i].Race);
+               CLprintf(dest, " Team = %d,", CurrentReplay->Players[i].Team);
+               CLprintf(dest, " Type = %d }%s", CurrentReplay->Players[i].Type,
                        i != PlayerMax - 1 ? ",\n" : "\n");
        }
        CLprintf(dest, "  },\n");
@@ -384,7 +384,7 @@
                CLprintf(dest, "DestUnitNumber = %d, ", log->DestUnitNumber);
        }
        if (log->Value) {
-               CLprintf(dest, "Value = \"%s\", ", log->Value);
+               CLprintf(dest, "Value = [[%s]], ", log->Value);
        }
        if (log->Num != -1) {
                CLprintf(dest, "Num = %d, ", log->Num);
@@ -899,8 +899,8 @@
                }
                SendCommandSharedVision(posx, state, posy);
        } else if (!strcmp(action, "input")) {
-               if (val[0] == '(') {
-                       CclCommand(val);
+               if (val[0] == '-') {
+                       CclCommand(val + 1);
                } else {
                        HandleCheats(val);
                }
Index: stratagus/src/stratagus/ccl.c
diff -u stratagus/src/stratagus/ccl.c:1.150 stratagus/src/stratagus/ccl.c:1.151
--- stratagus/src/stratagus/ccl.c:1.150 Fri Jan  2 08:24:14 2004
+++ stratagus/src/stratagus/ccl.c       Fri Jan  2 12:14:17 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl.c,v 1.150 2004/01/01 21:24:14 jsalmon3 Exp $
+//     $Id: ccl.c,v 1.151 2004/01/02 01:14:17 jsalmon3 Exp $
 
 //@{
 
@@ -895,17 +895,14 @@
 */
 global void CclCommand(const char* command)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       char msg[80];
-
-       strncpy(msg, command, sizeof(msg));
+       int status;
 
-       // FIXME: cheat protection
-       retval = repl_c_string(msg, 0, 0, sizeof(msg));
-       DebugLevel3("\n%d=%s\n" _C_ retval _C_ msg);
-       SetMessage("%s", msg);
-#elif defined(USE_LUA)
-#endif
+       if (!(status = luaL_loadbuffer(Lua, command, strlen(command), 
command))) {
+               LuaCall(0, 1);
+       } else {
+               report(status);
+       }
+       return status;
 }
 
 /*............................................................................
@@ -1066,7 +1063,7 @@
        }
 
        fprintf(fd, "--- -----------------------------------------\n");
-       fprintf(fd, "--- $Id: ccl.c,v 1.150 2004/01/01 21:24:14 jsalmon3 Exp 
$\n");
+       fprintf(fd, "--- $Id: ccl.c,v 1.151 2004/01/02 01:14:17 jsalmon3 Exp 
$\n");
 
        fprintf(fd, "SetVideoResolution(%d, %d)\n", VideoWidth, VideoHeight);
        fprintf(fd, "SetGroupKeys(\"");
@@ -1102,7 +1099,7 @@
        }
 
        fprintf(fd, "--- -----------------------------------------\n");
-       fprintf(fd, "--- $Id: ccl.c,v 1.150 2004/01/01 21:24:14 jsalmon3 Exp 
$\n");
+       fprintf(fd, "--- $Id: ccl.c,v 1.151 2004/01/02 01:14:17 jsalmon3 Exp 
$\n");
 
        // Global options
        if (OriginalFogOfWar) {
@@ -1211,7 +1208,7 @@
        extern SCM oblistvar;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.150 2004/01/01 21:24:14 
jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.151 2004/01/02 01:14:17 
jsalmon3 Exp $\n\n");
 
        for (list = oblistvar; gh_list_p(list); list = gh_cdr(list)) {
                SCM sym;
Index: stratagus/src/ui/interface.c
diff -u stratagus/src/ui/interface.c:1.150 stratagus/src/ui/interface.c:1.151
--- stratagus/src/ui/interface.c:1.150  Fri Jan  2 08:24:18 2004
+++ stratagus/src/ui/interface.c        Fri Jan  2 12:14:18 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: interface.c,v 1.150 2004/01/01 21:24:18 jsalmon3 Exp $
+//     $Id: interface.c,v 1.151 2004/01/02 01:14:18 jsalmon3 Exp $
 
 //@{
 
@@ -1044,12 +1044,15 @@
                                *q++ = *p++;
                        }
                        *q = '\0';
-                       if (Input[0] == '(') {
+#ifdef DEBUG
+                       if (Input[0] == '-') {
                                if (!GameObserve && !GamePaused) {
                                        CommandLog("input", NoUnitP, 
FlushCommands, -1, -1, NoUnitP, Input, -1);
-                                       CclCommand(Input);
+                                       CclCommand(Input + 1);
                                }
-                       } else if (NetworkFildes == (Socket)-1) {
+                       } else
+#endif
+                       if (NetworkFildes == (Socket)-1) {
                                if (!GameObserve && !GamePaused) {
                                        int ret;
                                        ret = HandleCheats(Input);




reply via email to

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