stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus/src action/action_board.c action/acti...


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src action/action_board.c action/acti...
Date: 31 Jan 2004 01:02:53 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/31 01:02:52

Modified files:
        src/action     : action_board.c action_resource.c 
                         action_unload.c actions.c 
        src/ai         : ai.c 
        src/include    : unit.h 
        src/stratagus  : script_player.c 
        src/ui         : botpanel.c mainscr.c mouse.c 
        src/unit       : script_unit.c unit.c unit_draw.c 

Log message:
        Fix for transporters as depots. Proper actions.c Destroyed unit 
filtering.

Patches:
Index: stratagus/src/action/action_board.c
diff -u stratagus/src/action/action_board.c:1.48 
stratagus/src/action/action_board.c:1.49
--- stratagus/src/action/action_board.c:1.48    Thu Jan 15 09:31:01 2004
+++ stratagus/src/action/action_board.c Sat Jan 31 01:02:46 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: action_board.c,v 1.48 2004/01/14 22:31:01 nobody_ Exp $
+//      $Id: action_board.c,v 1.49 2004/01/30 14:02:46 nobody_ Exp $
 
 //@{
 
@@ -156,8 +156,10 @@
        // Place the unit inside the transporter.
        //
 
-       if (transporter->InsideCount < transporter->Type->MaxOnBoard) {
-                       RemoveUnit(unit, transporter);
+       if (transporter->BoardCount < transporter->Type->MaxOnBoard) {
+               RemoveUnit(unit, transporter);
+               transporter->BoardCount++;
+               unit->Boarded = 1;
                if (!unit->Player->AiEnabled) {
                        // Don't make anything funny after going out of the 
transporter.
                        // FIXME: This is probably wrong, but it works for me 
(n0b0dy)
@@ -165,7 +167,7 @@
                        unit->Orders[0].Action = UnitActionStill;
                }
 
-                       if (IsOnlySelected(transporter)) {
+               if (IsOnlySelected(transporter)) {
                        SelectedUnitChanged();
                        MustRedraw |= RedrawInfoPanel;
                }
Index: stratagus/src/action/action_resource.c
diff -u stratagus/src/action/action_resource.c:1.75 
stratagus/src/action/action_resource.c:1.76
--- stratagus/src/action/action_resource.c:1.75 Thu Jan 29 23:50:29 2004
+++ stratagus/src/action/action_resource.c      Sat Jan 31 01:02:46 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: action_resource.c,v 1.75 2004/01/29 12:50:29 nobody_ Exp $
+//      $Id: action_resource.c,v 1.76 2004/01/30 14:02:46 nobody_ Exp $
 
 //@{
 
@@ -441,7 +441,9 @@
                                //
                                LoseResource(unit,source);
                                for (i = source->InsideCount; i; --i, uins = 
uins->NextContained) {
-                                       LoseResource(uins,source);
+                                       if (uins->Orders->Action == 
UnitActionResource) {
+                                               LoseResource(uins,source);
+                                       }
                                }
 
                                // Don't destroy the resource twice.
Index: stratagus/src/action/action_unload.c
diff -u stratagus/src/action/action_unload.c:1.45 
stratagus/src/action/action_unload.c:1.46
--- stratagus/src/action/action_unload.c:1.45   Sun Dec 14 19:10:37 2003
+++ stratagus/src/action/action_unload.c        Sat Jan 31 01:02:46 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: action_unload.c,v 1.45 2003/12/14 08:10:37 wizzard Exp $
+//      $Id: action_unload.c,v 1.46 2004/01/30 14:02:46 nobody_ Exp $
 
 //@{
 
@@ -156,6 +156,7 @@
        unit->X = x;
        unit->Y = y;
        unit->Wait = 1;                 // should be correct unit has still 
action
+       unit->Boarded = 0;
        PlaceUnit(unit, x, y);
        return 1;
 }
@@ -344,15 +345,21 @@
                goal->X = unit->X;
                goal->Y = unit->Y;
                // Try to unload the unit. If it doesn't work there is no 
problem.
-               UnloadUnit(goal);
+               if (UnloadUnit(goal)) {
+                       unit->BoardCount--;
+               }
        } else {
                // Unload all units.
                goal = unit->UnitInside;
                for (i = unit->InsideCount; i; --i, goal = goal->NextContained) 
{
-                       goal->X = unit->X;
-                       goal->Y = unit->Y;
-                       if (!UnloadUnit(goal)) {
-                               ++stillonboard;
+                       if (goal->Boarded) {
+                               goal->X = unit->X;
+                               goal->Y = unit->Y;
+                               if (!UnloadUnit(goal)) {
+                                       ++stillonboard;
+                               } else {
+                                       unit->BoardCount--;
+                               }
                        }
                }
        }
Index: stratagus/src/action/actions.c
diff -u stratagus/src/action/actions.c:1.119 
stratagus/src/action/actions.c:1.120
--- stratagus/src/action/actions.c:1.119        Fri Jan 30 18:55:23 2004
+++ stratagus/src/action/actions.c      Sat Jan 31 01:02:46 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: actions.c,v 1.119 2004/01/30 07:55:23 wizzard Exp $
+//      $Id: actions.c,v 1.120 2004/01/30 14:02:46 nobody_ Exp $
 
 //@{
 
@@ -53,6 +53,7 @@
 ----------------------------------------------------------------------------*/
 
 global unsigned SyncHash;                      /// Hash calculated to find 
sync failures
+#define DEBUG_ACTIONS
 
 /*----------------------------------------------------------------------------
 --  Functions
@@ -494,25 +495,11 @@
        int i;
        int tabsize;
 
-       buffsthiscycle = regenthiscycle =
-               blinkthiscycle = !(GameCycle % CYCLES_PER_SECOND);
+       buffsthiscycle = regenthiscycle = blinkthiscycle =
+                       !(GameCycle % CYCLES_PER_SECOND);
 
-       //
-       // Must copy table, units could be removed.
-       //
-       memcpy(table, Units, sizeof(Unit*) * NumUnits);
-
-       //
-       // Check for dead/destroyed units in table...
-       // Filter them out
-       //
-       for (i = tabsize = 0; i < NumUnits; ++i) {
-               if (!table[i]->Destroyed) {             // Ignore destroyed 
units
-                       table[tabsize++] = table[i];
-               } else {
-                       DebugLevel3Fn("Destroyed unit %d in table, should be 
ok\n" _C_ table[i]->Slot);
-               }
-       }
+       memcpy(table, Units, NumUnits * sizeof(Unit*));
+       tabsize = NumUnits;
 
        //
        // Check for things that only happen every few cycles
@@ -522,6 +509,9 @@
        // 1) Blink flag.
        if (blinkthiscycle) {
                for (i = 0; i < tabsize; ++i) {
+                       while(table[i]->Destroyed) {
+                               table[i] = table[--tabsize];
+                       }
                        if (table[i]->Blink) {
                                --table[i]->Blink;
                        }
@@ -531,22 +521,20 @@
        // 2) Buffs...
        if (buffsthiscycle) {
                for (i = 0; i < tabsize; ++i) {
-                       HandleBuffs(table[i], CYCLES_PER_SECOND);
-                       if (table[i]->Destroyed) {
+                       while(table[i]->Destroyed) {
                                table[i] = table[--tabsize];
-                               --i;
                        }
+                       HandleBuffs(table[i], CYCLES_PER_SECOND);
                }
        }
 
        // 3) Increase health mana, burn and stuff
        if (regenthiscycle) {
                for (i = 0; i < tabsize; ++i) {
-                       HandleRegenerations(table[i]);
-                       if (table[i]->Destroyed) {
+                       while(table[i]->Destroyed) {
                                table[i] = table[--tabsize];
-                               --i;
                        }
+                       HandleRegenerations(table[i]);
                }
        }
 
@@ -554,6 +542,9 @@
        // Do all actions
        //
        for (i = 0; i < tabsize; ++i) {
+               while(table[i]->Destroyed) {
+                       table[i] = table[--tabsize];
+               }
                unit = table[i];
 
                if (--unit->Wait) {                     // Wait until counter 
reached
Index: stratagus/src/ai/ai.c
diff -u stratagus/src/ai/ai.c:1.112 stratagus/src/ai/ai.c:1.113
--- stratagus/src/ai/ai.c:1.112 Mon Jan 19 09:36:23 2004
+++ stratagus/src/ai/ai.c       Sat Jan 31 01:02:47 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai.c,v 1.112 2004/01/18 22:36:23 nobody_ Exp $
+//      $Id: ai.c,v 1.113 2004/01/30 14:02:47 nobody_ Exp $
 
 
 //@{
@@ -820,7 +820,7 @@
 {
        CLprintf(file, "\n--- -----------------------------------------\n");
        CLprintf(file,
-               "--- MODULE: AI $Id: ai.c,v 1.112 2004/01/18 22:36:23 nobody_ 
Exp $\n\n");
+               "--- MODULE: AI $Id: ai.c,v 1.113 2004/01/30 14:02:47 nobody_ 
Exp $\n\n");
 #if 0
        SaveAiTypesWcName(file);
        SaveAiHelper(file);
@@ -1510,7 +1510,7 @@
 
                result = 1;
 
-               if (unit->InsideCount >= unit->Type->MaxOnBoard) {
+               if (unit->BoardCount >= unit->Type->MaxOnBoard) {
                        continue;
                }
 
@@ -1531,7 +1531,7 @@
                                unit->OrderCount < MAX_ORDERS - 1 &&
                                unit->Orders[unit->OrderFlush ? 1 : 0].Action 
== UnitActionFollow &&
                                unit->Orders[unit->OrderCount - 1].Action == 
UnitActionUnload &&
-                               unit->InsideCount + unit->OrderCount - 
(unit->OrderFlush ? 1 : 0) <= unit->Type->MaxOnBoard) {
+                               unit->BoardCount + unit->OrderCount - 
(unit->OrderFlush ? 1 : 0) <= unit->Type->MaxOnBoard) {
 
                        // Check that it will unload in the dest zone
                        ZoneSetClear(&TransporterZones);
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.252 stratagus/src/include/unit.h:1.253
--- stratagus/src/include/unit.h:1.252  Thu Jan 29 23:50:32 2004
+++ stratagus/src/include/unit.h        Sat Jan 31 01:02:48 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: unit.h,v 1.252 2004/01/29 12:50:32 nobody_ Exp $
+//      $Id: unit.h,v 1.253 2004/01/30 14:02:48 nobody_ Exp $
 
 #ifndef __UNIT_H__
 #define __UNIT_H__
@@ -110,10 +110,13 @@
 **
 **             Unit::InsideCount
 **
-**                             The number of units inside the container. This 
used to be
-**                             Value for transporters, but since gold mines 
also use this
-**                             field, it has changed to InsideCount, to allow 
counting
-**                             units inside a gold mine.)
+**                             The number of units inside the container.
+**
+**             Unit::BoardCount
+**
+**                             The number of units transported inside the 
container. This
+**                             does not include for instance stuff like 
harvesters returning
+**                             cargo.
 **
 **             Unit::Name
 **
@@ -243,6 +246,10 @@
 **                             01 The building in being built when last seen.
 **                             10 The building was been upgraded when last 
seen.
 **
+**             Unit::Boarded
+**
+**                             This is 1 if the unit is on board a transporter.
+**
 **             Unit::Mana
 **
 **
@@ -516,6 +523,7 @@
 #endif
 
        int                             InsideCount;                            
/// Number of units inside.
+       int                             BoardCount;                             
/// Number of units transported inside.
        Unit*               UnitInside;                         /// Pointer to 
one of the units inside.
        Unit*               Container;                          /// Pointer to 
the unit containing it (or 0)
        Unit*               NextContained;                              /// 
Next unit in the container.
@@ -547,6 +555,7 @@
 
        unsigned                Constructed : 1;                /// Unit is in 
construction
        unsigned                Active : 1;                             /// 
Unit is active for AI
+       unsigned                Boarded : 1;                    /// Unit is on 
board a transporter.
        Player*  RescuedFrom;                                   /// The 
original owner of a rescued unit.
                                                                                
        /// NULL if the unit was not rescued.
        /* Seen stuff. */
Index: stratagus/src/stratagus/script_player.c
diff -u stratagus/src/stratagus/script_player.c:1.59 
stratagus/src/stratagus/script_player.c:1.60
--- stratagus/src/stratagus/script_player.c:1.59        Thu Jan 29 23:50:35 2004
+++ stratagus/src/stratagus/script_player.c     Sat Jan 31 01:02:49 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: script_player.c,v 1.59 2004/01/29 12:50:35 nobody_ Exp $
+//      $Id: script_player.c,v 1.60 2004/01/30 14:02:49 nobody_ Exp $
 
 //@{
 
@@ -742,7 +742,7 @@
        }
        if (i == MaxCosts) {
                // FIXME: this leaves a half initialized player
-               lua_pushfstring(l, "Invalid resource", res);
+               lua_pushfstring(l, "Invalid resource \"%s\"", res);
                lua_error(l);
        }
        lua_pushnumber(l, plyr->Resources[i]);
Index: stratagus/src/ui/botpanel.c
diff -u stratagus/src/ui/botpanel.c:1.105 stratagus/src/ui/botpanel.c:1.106
--- stratagus/src/ui/botpanel.c:1.105   Fri Jan 30 12:47:48 2004
+++ stratagus/src/ui/botpanel.c Sat Jan 31 01:02:49 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: botpanel.c,v 1.105 2004/01/30 01:47:48 wizzard Exp $
+//     $Id: botpanel.c,v 1.106 2004/01/30 14:02:49 nobody_ Exp $
 
 //@{
 
@@ -104,7 +104,7 @@
        char* cp;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: buttons $Id: botpanel.c,v 1.105 2004/01/30 
01:47:48 wizzard Exp $\n\n");
+       CLprintf(file, ";;; MODULE: buttons $Id: botpanel.c,v 1.106 2004/01/30 
14:02:49 nobody_ Exp $\n\n");
 
        for (i = 0; i < NumUnitButtons; ++i) {
                CLprintf(file, "(define-button 'pos %d 'level %d 'icon '%s\n",
@@ -803,7 +803,7 @@
                                                UpgradeIdentAllowed(player, 
buttonaction->ValueStr) == 'R';
                                        break;
                                case ButtonUnload:
-                                       allow = (Selected[0]->Type->Transporter 
&& Selected[0]->InsideCount);
+                                       allow = (Selected[0]->Type->Transporter 
&& Selected[0]->BoardCount);
                                        break;
                                case ButtonCancel:
                                        allow = 1;
Index: stratagus/src/ui/mainscr.c
diff -u stratagus/src/ui/mainscr.c:1.156 stratagus/src/ui/mainscr.c:1.157
--- stratagus/src/ui/mainscr.c:1.156    Thu Jan 29 18:20:33 2004
+++ stratagus/src/ui/mainscr.c  Sat Jan 31 01:02:49 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: mainscr.c,v 1.156 2004/01/29 07:20:33 wizzard Exp $
+//      $Id: mainscr.c,v 1.157 2004/01/30 14:02:49 nobody_ Exp $
 
 //@{
 
@@ -294,7 +294,7 @@
        //
        //              Draw unit kills and experience.
        //
-       if (stats->Level && !(type->Transporter && unit->InsideCount)) {
+       if (stats->Level && !(type->Transporter && unit->BoardCount)) {
                sprintf(buf, "XP:~<%d~> Kills:~<%d~>", unit->XP, unit->Kills);
                VideoDrawTextCentered(x + 114, y + 8 + 15 + 33, GameFont, buf);
        }
@@ -406,6 +406,33 @@
                }
        }
 
+       if (type->Transporter && unit->BoardCount) {
+               int j;
+
+               if (TheUI.TransportingText) {
+                       VideoDrawText(TheUI.TransportingTextX, 
TheUI.TransportingTextY,
+                               TheUI.TransportingFont, TheUI.TransportingText);
+               }
+               uins = unit->UnitInside;
+               for (i = j = 0; i < unit->InsideCount; ++i, uins = 
uins->NextContained) {
+                       if (uins->Boarded) {
+                               DrawUnitIcon(unit->Player,uins->Type->Icon.Icon,
+                                       (ButtonAreaUnderCursor == 
ButtonAreaTransporting && ButtonUnderCursor == j) ?
+                                               (IconActive | (MouseButtons & 
LeftButton)) : 0,
+                                       TheUI.TransportingButtons[j].X, 
TheUI.TransportingButtons[j].Y);
+                               UiDrawLifeBar(uins, 
TheUI.TransportingButtons[j].X, TheUI.TransportingButtons[j].Y);
+                               if (uins->Type->CanCastSpell && 
unit->Type->_MaxMana) {
+                                       UiDrawManaBar(uins, 
TheUI.TransportingButtons[j].X, TheUI.TransportingButtons[j].Y);
+                               }
+                               if (ButtonAreaUnderCursor == 
ButtonAreaTransporting && ButtonUnderCursor == j) {
+                                       SetStatusLine(uins->Type->Name);
+                               }
+                               ++j;
+                       }
+               }
+               return;
+       }
+
        vpos = 77; // Start of resource drawing
        for (i = 1; i < MaxCosts; ++i) {
                if (type->CanStore[i]) {
@@ -429,28 +456,6 @@
        }
        if (vpos != 77) {
                // We displayed at least one resource
-               return;
-       }
-
-       if (type->Transporter && unit->InsideCount) {
-               if (TheUI.TransportingText) {
-                       VideoDrawText(TheUI.TransportingTextX, 
TheUI.TransportingTextY,
-                               TheUI.TransportingFont, TheUI.TransportingText);
-               }
-               uins = unit->UnitInside;
-               for (i = 0; i < unit->InsideCount; ++i, uins = 
uins->NextContained) {
-                       DrawUnitIcon(unit->Player,uins->Type->Icon.Icon,
-                               (ButtonAreaUnderCursor == 
ButtonAreaTransporting && ButtonUnderCursor == i) ?
-                                       (IconActive | (MouseButtons & 
LeftButton)) : 0,
-                               TheUI.TransportingButtons[i].X, 
TheUI.TransportingButtons[i].Y);
-                       UiDrawLifeBar(uins, TheUI.TransportingButtons[i].X, 
TheUI.TransportingButtons[i].Y);
-                       if (uins->Type->CanCastSpell && unit->Type->_MaxMana) {
-                               UiDrawManaBar(uins, 
TheUI.TransportingButtons[i].X, TheUI.TransportingButtons[i].Y);
-                       }
-                       if (ButtonAreaUnderCursor == ButtonAreaTransporting && 
ButtonUnderCursor == i) {
-                               SetStatusLine(uins->Type->Name);
-                       }
-               }
                return;
        }
 
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.174 stratagus/src/ui/mouse.c:1.175
--- stratagus/src/ui/mouse.c:1.174      Fri Jan 30 12:47:48 2004
+++ stratagus/src/ui/mouse.c    Sat Jan 31 01:02:50 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: mouse.c,v 1.174 2004/01/30 01:47:48 wizzard Exp $
+//     $Id: mouse.c,v 1.175 2004/01/30 14:02:50 nobody_ Exp $
 
 //@{
 
@@ -431,8 +431,8 @@
                        }
                }
        }
-       if (NumSelected == 1 && Selected[0]->Type->Transporter && 
Selected[0]->InsideCount) {
-               for (i = Selected[0]->InsideCount - 1; i >= 0; --i) {
+       if (NumSelected == 1 && Selected[0]->Type->Transporter && 
Selected[0]->BoardCount) {
+               for (i = Selected[0]->BoardCount - 1; i >= 0; --i) {
                        if (x >= TheUI.TransportingButtons[i].X &&
                                        x < TheUI.TransportingButtons[i].X + 
TheUI.TransportingButtons[i].Width + 7 &&
                                        y >= TheUI.TransportingButtons[i].Y &&
@@ -460,7 +460,7 @@
                                        return;
                                }
                        } else {
-                               for (i = 0; i < TheUI.NumTrainingButtons; ++i) {
+                               for (i = TheUI.NumTrainingButtons; i >= 0; --i) 
{
                                        if (x >= TheUI.TrainingButtons[i].X &&
                                                        x < 
TheUI.TrainingButtons[i].X + TheUI.TrainingButtons[i].Width + 7 &&
                                                        y >= 
TheUI.TrainingButtons[i].Y &&
@@ -1618,13 +1618,14 @@
                                //
                                if (!GameObserve && !GamePaused &&
                                        PlayersTeamed(ThisPlayer->Player, 
Selected[0]->Player->Player)) {
-                                       if (Selected[0]->InsideCount >= 
ButtonUnderCursor) {
-                                               // FIXME: should check if valid 
here.
-                                               // n0b0dy: check WHAT?
+                                       if (Selected[0]->BoardCount >= 
ButtonUnderCursor) {
                                                uins = Selected[0]->UnitInside;
-                                               for (i = 0; i < 
ButtonUnderCursor; ++i) {
-                                                       uins = 
uins->NextContained;
+                                               for (i = ButtonUnderCursor; i; 
uins = uins->NextContained) {
+                                                       if (uins->Boarded) {
+                                                               --i;
+                                                       }
                                                }
+                                               DebugCheck(!uins->Boarded);
                                                SendCommandUnload(Selected[0],
                                                        Selected[0]->X, 
Selected[0]->Y, uins,
                                                        !(KeyModifiers & 
ModifierShift));
Index: stratagus/src/unit/script_unit.c
diff -u stratagus/src/unit/script_unit.c:1.102 
stratagus/src/unit/script_unit.c:1.103
--- stratagus/src/unit/script_unit.c:1.102      Fri Jan 30 07:36:22 2004
+++ stratagus/src/unit/script_unit.c    Sat Jan 31 01:02:50 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: script_unit.c,v 1.102 2004/01/29 20:36:22 nobody_ Exp $
+//      $Id: script_unit.c,v 1.103 2004/01/30 14:02:50 nobody_ Exp $
 
 //@{
 
@@ -633,7 +633,6 @@
        Player* player;
        int slot;
        int i;
-       int insidecount;
        const char* s;
        int args;
        int j;
@@ -641,7 +640,6 @@
        args = lua_gettop(l);
        j = 0;
 
-       insidecount = -1;
        slot = LuaToNumber(l, j + 1);
        ++j;
        DebugLevel3Fn("parsing unit #%d\n" _C_ slot);
@@ -860,8 +858,8 @@
                        --j;
                } else if (!strcmp(value, "rs")) {
                        unit->Rs = LuaToNumber(l, j + 1);
-               } else if (!strcmp(value, "units-contained-count")) {
-                       insidecount = LuaToNumber(l, j + 1);
+               } else if (!strcmp(value, "units-boarded-count")) {
+                       unit->BoardCount = LuaToNumber(l, j + 1);
                } else if (!strcmp(value, "units-contained")) {
                        int subargs;
                        int k;
Index: stratagus/src/unit/unit.c
diff -u stratagus/src/unit/unit.c:1.382 stratagus/src/unit/unit.c:1.383
--- stratagus/src/unit/unit.c:1.382     Fri Jan 30 20:49:38 2004
+++ stratagus/src/unit/unit.c   Sat Jan 31 01:02:51 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: unit.c,v 1.382 2004/01/30 09:49:38 nobody_ Exp $
+//      $Id: unit.c,v 1.383 2004/01/30 14:02:51 nobody_ Exp $
 
 //@{
 
@@ -3632,7 +3632,7 @@
                CLprintf(file, " \"moving\",");
        }
        CLprintf(file, " \"rs\", %d,", unit->Rs);
-       CLprintf(file, " \"units-contained-count\", %d,", unit->InsideCount);
+       CLprintf(file, " \"units-boarded-count\", %d,", unit->BoardCount);
        CLprintf(file, "\n  \"units-contained\", {");
        uins = unit->UnitInside;
        for (i = unit->InsideCount; i; --i, uins = uins->NextContained) {
@@ -3769,7 +3769,7 @@
        int j;
 
        CLprintf(file, "\n--- -----------------------------------------\n");
-       CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.382 2004/01/30 
09:49:38 nobody_ Exp $\n\n");
+       CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.383 2004/01/30 
14:02:51 nobody_ Exp $\n\n");
 
 #if 0
        //
Index: stratagus/src/unit/unit_draw.c
diff -u stratagus/src/unit/unit_draw.c:1.219 
stratagus/src/unit/unit_draw.c:1.220
--- stratagus/src/unit/unit_draw.c:1.219        Fri Jan 30 20:48:01 2004
+++ stratagus/src/unit/unit_draw.c      Sat Jan 31 01:02:51 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: unit_draw.c,v 1.219 2004/01/30 09:48:01 nobody_ Exp $
+//      $Id: unit_draw.c,v 1.220 2004/01/30 14:02:51 nobody_ Exp $
 
 //@{
 
@@ -644,7 +644,7 @@
 {
 #if 0
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.219 
2004/01/30 09:48:01 nobody_ Exp $\n\n");
+       CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.220 
2004/01/30 14:02:51 nobody_ Exp $\n\n");
 
        CLprintf(file, "(mana-sprite \"%s\"  %d %d  %d %d)\n",
                ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
@@ -1041,7 +1041,7 @@
                        //              Transporter with units on board.
                        //
                        } else if (unit->Type->Transporter) {
-                               DrawManaBar(x, y, type, unit->Type->MaxOnBoard, 
unit->InsideCount);
+                               DrawManaBar(x, y, type, unit->Type->MaxOnBoard, 
unit->BoardCount);
                        }
                }
        }
@@ -1109,7 +1109,7 @@
                        //              Transporter with units on board.
                        //
                        } else if (unit->Type->Transporter) {
-                               DrawManaSprite(x, y, type, 
unit->Type->MaxOnBoard, unit->InsideCount);
+                               DrawManaSprite(x, y, type, 
unit->Type->MaxOnBoard, unit->BoardCount);
                        }
                }
        }
@@ -1635,7 +1635,7 @@
        const UnitStats* stats;
        int r;
 
-#if 1 // This is for showing vis counts and refs.
+#if 0 && DEBUG // This is for showing vis counts and refs.
        char buf[10];
        sprintf(buf, "%d%c%c%d", unit->VisCount[ThisPlayer->Player],
                unit->Seen.ByPlayer & (1 << ThisPlayer->Player) ? 'Y' : 'N',




reply via email to

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