stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus/src/unit ccl_unit.c unit.c


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src/unit ccl_unit.c unit.c
Date: 3 Jan 2004 12:00:00 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/03 12:00:00

Modified files:
        src/unit       : ccl_unit.c unit.c 

Log message:
        Load/Save bug fixes

Patches:
Index: stratagus/src/unit/ccl_unit.c
diff -u stratagus/src/unit/ccl_unit.c:1.88 stratagus/src/unit/ccl_unit.c:1.89
--- stratagus/src/unit/ccl_unit.c:1.88  Fri Jan  2 11:36:33 2004
+++ stratagus/src/unit/ccl_unit.c       Sat Jan  3 11:59:58 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unit.c,v 1.88 2004/01/02 00:36:33 jsalmon3 Exp $
+//     $Id: ccl_unit.c,v 1.89 2004/01/03 00:59:58 jsalmon3 Exp $
 
 //@{
 
@@ -754,6 +754,7 @@
                        unit->SeenFrame = -LuaToNumber(l, j + 1);
                } else if (!strcmp(value, "not-seen")) {
                        unit->SeenFrame = UnitNotSeen;
+                       --j;
                } else if (!strcmp(value, "direction")) {
                        unit->Direction = LuaToNumber(l, j + 1);
                } else if (!strcmp(value, "attacked")) {
@@ -1461,7 +1462,7 @@
        prev = -1;
        args = lua_gettop(l);
        for (j = 0; j < args; ++j) {
-               if (lua_isstring(l, j + 1) &&
+               if (lua_type(l, j + 1) == LUA_TSTRING &&
                                !strcmp((value = LuaToString(l, j + 1)), "-")) {
                        int range_end;
 
Index: stratagus/src/unit/unit.c
diff -u stratagus/src/unit/unit.c:1.353 stratagus/src/unit/unit.c:1.354
--- stratagus/src/unit/unit.c:1.353     Sat Jan  3 11:33:01 2004
+++ stratagus/src/unit/unit.c   Sat Jan  3 11:59:59 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: unit.c,v 1.353 2004/01/03 00:33:01 jsalmon3 Exp $
+//      $Id: unit.c,v 1.354 2004/01/03 00:59:59 jsalmon3 Exp $
 
 //@{
 
@@ -3699,9 +3699,10 @@
        unsigned char SlotUsage[MAX_UNIT_SLOTS / 8 + 1];
        int InRun;
        int RunStart;
+       int j;
 
        CLprintf(file, "\n--- -----------------------------------------\n");
-       CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.353 2004/01/03 
00:33:01 jsalmon3 Exp $\n\n");
+       CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.354 2004/01/03 
00:59:59 jsalmon3 Exp $\n\n");
 
 #if 0
        //
@@ -3716,7 +3717,7 @@
 #endif
 
        CLprintf(file, "-- Unit slot usage bitmap\n");
-       CLprintf(file, "SlotUsage({");
+       CLprintf(file, "SlotUsage(");
 
        memset(SlotUsage, 0, MAX_UNIT_SLOTS / 8 + 1);
        for (i = 0; i < NumUnits; ++i) {
@@ -3735,6 +3736,7 @@
 #else
 #define SlotUsed(slot)         (SlotUsage[(slot) / 8] & (1 << ((slot) % 8)))
        RunStart = InRun = 0;
+       j = 0;
        for (i = 0; i < MAX_UNIT_SLOTS; ++i) {
                if (!InRun && SlotUsed(i)) {
                        InRun = 1;
@@ -3742,16 +3744,21 @@
                }
                if (!SlotUsed(i) && InRun) {
                        InRun = 0;
+                       if (!j) {
+                               j = 1;
+                       } else {
+                               CLprintf(file, ", ");
+                       }
                        if (i - 1 == RunStart) {
-                               CLprintf(file, "%d, ", i - 1);
+                               CLprintf(file, "%d", i - 1);
                        } else {
-                               CLprintf(file, "%d, \"-\", %d, ", RunStart, i - 
1);
+                               CLprintf(file, "%d, \"-\", %d", RunStart, i - 
1);
                        }
                }
        }
 #endif
 
-       CLprintf (file, "})\n");
+       CLprintf (file, ")\n");
 
        for (table = Units; table < &Units[NumUnits]; ++table) {
                SaveUnit(*table, file);




reply via email to

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