stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus/src stratagus/ccl.c ui/ccl_ui.c


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src stratagus/ccl.c ui/ccl_ui.c
Date: 10 Jan 2004 17:04:24 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/10 17:04:23

Modified files:
        src/stratagus  : ccl.c 
        src/ui         : ccl_ui.c 

Log message:
        Save Game Fixes: Viewport location, and loading compressed files

Patches:
Index: stratagus/src/stratagus/ccl.c
diff -u stratagus/src/stratagus/ccl.c:1.152 stratagus/src/stratagus/ccl.c:1.153
--- stratagus/src/stratagus/ccl.c:1.152 Fri Jan  2 14:13:58 2004
+++ stratagus/src/stratagus/ccl.c       Sat Jan 10 17:04:22 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl.c,v 1.152 2004/01/02 03:13:58 jsalmon3 Exp $
+//     $Id: ccl.c,v 1.153 2004/01/10 06:04:22 wizzard Exp $
 
 //@{
 
@@ -182,12 +182,37 @@
 global int LuaLoadFile(const char* file)
 {
        int status;
+       int size;
+       int read;
+       int location;
+       char* buf;
+       CLFile* fp;
+
+       if (!(fp = CLopen(file, CL_OPEN_READ))) {
+               perror("Can't open file");
+               return -1;
+       }
+                                       
+       size = 10000;
+       buf = (char*)malloc(size);
+       location = 0;
+       while ((read = CLread(fp, &buf[location], size - location))) {
+               location += read;
+               size = size * 2;
+               buf = (char*)realloc(buf, size);
+               if (!buf) {
+                       fprintf(stderr, "Out of memory\n");
+                       ExitFatal(-1);
+               }
+       }
+       CLclose(fp);
 
-       if (!(status = luaL_loadfile(Lua, file))) {
+       if (!(status = luaL_loadbuffer(Lua, buf, location, file))) {
                LuaCall(0, 1);
        } else {
                report(status);
        }
+       free(buf);
        return status;
 }
 
@@ -1063,7 +1088,7 @@
        }
 
        fprintf(fd, "--- -----------------------------------------\n");
-       fprintf(fd, "--- $Id: ccl.c,v 1.152 2004/01/02 03:13:58 jsalmon3 Exp 
$\n");
+       fprintf(fd, "--- $Id: ccl.c,v 1.153 2004/01/10 06:04:22 wizzard Exp 
$\n");
 
        fprintf(fd, "SetVideoResolution(%d, %d)\n", VideoWidth, VideoHeight);
        fprintf(fd, "SetGroupKeys(\"");
@@ -1099,7 +1124,7 @@
        }
 
        fprintf(fd, "--- -----------------------------------------\n");
-       fprintf(fd, "--- $Id: ccl.c,v 1.152 2004/01/02 03:13:58 jsalmon3 Exp 
$\n");
+       fprintf(fd, "--- $Id: ccl.c,v 1.153 2004/01/10 06:04:22 wizzard Exp 
$\n");
 
        // Global options
        if (OriginalFogOfWar) {
@@ -1208,7 +1233,7 @@
        extern SCM oblistvar;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.152 2004/01/02 03:13:58 
jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.153 2004/01/10 06:04:22 
wizzard Exp $\n\n");
 
        for (list = oblistvar; gh_list_p(list); list = gh_cdr(list)) {
                SCM sym;
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.182 stratagus/src/ui/ccl_ui.c:1.183
--- stratagus/src/ui/ccl_ui.c:1.182     Sat Jan 10 16:14:02 2004
+++ stratagus/src/ui/ccl_ui.c   Sat Jan 10 17:04:23 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ccl_ui.c,v 1.182 2004/01/10 05:14:02 jsalmon3 Exp $
+//      $Id: ccl_ui.c,v 1.183 2004/01/10 06:04:23 wizzard Exp $
 
 //@{
 
@@ -2266,7 +2266,7 @@
                        lua_rawgeti(l, j + 1, 1);
                        ui->Viewports[i].MapX = LuaToNumber(l, -1);
                        lua_pop(l, 1);
-                       lua_rawgeti(l, j + 1, 1);
+                       lua_rawgeti(l, j + 1, 2);
                        ui->Viewports[i].MapY = LuaToNumber(l, -1);
                        lua_pop(l, 1);
                        ++i;




reply via email to

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