stratagus-cvs
[Top][All Lists]
Advanced

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

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


From: Russell Smith
Subject: [Stratagus-CVS] stratagus/src/clone unit.c
Date: Sun, 21 Sep 2003 22:49:55 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Russell Smith <address@hidden>  03/09/21 22:49:55

Modified files:
        src/clone      : unit.c 

Log message:
        Fixed Crash when Stats not defined

Patches:
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.302 stratagus/src/clone/unit.c:1.303
--- stratagus/src/clone/unit.c:1.302    Sun Sep 21 08:13:42 2003
+++ stratagus/src/clone/unit.c  Sun Sep 21 22:49:55 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.c,v 1.302 2003/09/21 12:13:42 mr-russ Exp $
+//     $Id: unit.c,v 1.303 2003/09/22 02:49:55 mr-russ Exp $
 
 //@{
 
@@ -1604,28 +1604,31 @@
 
     for( table=Units; table<Units+NumUnits; table++ ) {
        unit=*table;
-       if (HitPointRegeneration && unit->HP<unit->Stats->HitPoints) {
-           ++unit->HP;
-
-           if( 0 ) {           // some frames delayed done my color cycling
-               CheckUnitToBeDrawn(unit);
-           }
-           if( unit->Selected ) {
-               MustRedraw|=RedrawInfoPanel;
-           }
-       }
-       if( unit->Stats->RegenerationRate && unit->HP<unit->Stats->HitPoints ) {
-           unit->HP+=unit->Stats->RegenerationRate;
-           if( unit->HP > unit->Stats->HitPoints ) {
-               unit->HP = unit->Stats->HitPoints;
-           }
+       //Unit may not have stats assigned to it
+       if (unit->Stats) {
+           if (HitPointRegeneration && unit->HP<unit->Stats->HitPoints) {
+               ++unit->HP;
+
+               if( 0 ) {       // some frames delayed done my color cycling
+                   CheckUnitToBeDrawn(unit);
+               }
+               if( unit->Selected ) {
+                   MustRedraw|=RedrawInfoPanel;
+               }
+           }
+           if( unit->Stats->RegenerationRate && 
unit->HP<unit->Stats->HitPoints ) {
+               unit->HP+=unit->Stats->RegenerationRate;
+               if( unit->HP > unit->Stats->HitPoints ) {
+                   unit->HP = unit->Stats->HitPoints;
+               }
 
            // some frames delayed done my color cycling
-           if( 0 ) {
-               CheckUnitToBeDrawn(unit);
-           }
-           if( unit->Selected ) {
-               MustRedraw|=RedrawInfoPanel;
+               if( 0 ) {
+                   CheckUnitToBeDrawn(unit);
+               }
+               if( unit->Selected ) {
+                   MustRedraw|=RedrawInfoPanel;
+               }
            }
        }
     }
@@ -3959,7 +3962,7 @@
     int InRun, RunStart;
 
     CLprintf(file,"\n;;; -----------------------------------------\n");
-    CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.302 2003/09/21 12:13:42 
mr-russ Exp $\n\n");
+    CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.303 2003/09/22 02:49:55 
mr-russ Exp $\n\n");
 
     //
     // Local variables




reply via email to

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