netpanzer-cvs
[Top][All Lists]
Advanced

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

[netPanzer-CVS] netpanzer ./ChangeLog src/Lib/2D/Surface.cpp sr...


From: Matthias Braun
Subject: [netPanzer-CVS] netpanzer ./ChangeLog src/Lib/2D/Surface.cpp sr...
Date: Sun, 12 Oct 2003 18:44:01 -0400

CVSROOT:        /cvsroot/netpanzer
Module name:    netpanzer
Branch:         
Changes by:     Matthias Braun <address@hidden> 03/10/12 18:44:01

Modified files:
        .              : ChangeLog 
        src/Lib/2D     : Surface.cpp 
        src/NetPanzer/Views/Game: MiniMapView.cpp 
                                  VehicleSelectionView.cpp 

Log message:
        fixed another crasher when opening outpost menus

Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.11 netpanzer/ChangeLog:1.12
--- netpanzer/ChangeLog:1.11    Sun Oct 12 18:09:34 2003
+++ netpanzer/ChangeLog Sun Oct 12 18:44:01 2003
@@ -9,6 +9,7 @@
  Surface to the blit functions. C++ was evil enough to use the
  Surface::Surface(bool) constructor to create a new Surface instead of getting
  me an error.
+-fixed another crasher when outpost was selected from a strange position
 
 11-Oct-2003 by Matthias Braun
 -added a release script
Index: netpanzer/src/Lib/2D/Surface.cpp
diff -u netpanzer/src/Lib/2D/Surface.cpp:1.34 
netpanzer/src/Lib/2D/Surface.cpp:1.35
--- netpanzer/src/Lib/2D/Surface.cpp:1.34       Sun Oct 12 18:09:34 2003
+++ netpanzer/src/Lib/2D/Surface.cpp    Sun Oct 12 18:44:01 2003
@@ -246,6 +246,7 @@
 //---------------------------------------------------------------------------
 Surface::~Surface()
 {
+    assert(mem != (PIX*) 0xDEADBEEF);
     if ((doesExist != false) && (myMem != false)) {
         free();
     }
@@ -254,6 +255,7 @@
     totalByteCount -= sizeof(Surface);
 
     assert(totalByteCount >= 0);
+    mem = (PIX*) 0xDEADBEEF;
 } // end Surface::~Surface
 
 //---------------------------------------------------------------------------
@@ -511,8 +513,8 @@
 
     iXY max;
     max = min + pix;
-    if (max.x < 0) return;
-    if (max.y < 0) return;
+    if (max.x <= 0) return;
+    if (max.y <= 0) return;
 
     int        pixelsPerRow = pix.x;
     int        numRows      = pix.y;
@@ -594,10 +596,8 @@
 
     iXY max;
     max = min + pix;
-    //int      x2 = x1 + pix.x;
-    //int      y2 = y1 + pix.y;
-    if (max.x < 0) return;
-    if (max.y < 0) return;
+    if (max.x <= 0) return;
+    if (max.y <= 0) return;
 
     int        pixelsPerRow = pix.x;
     int        numRows      = pix.y;
@@ -683,8 +683,8 @@
 
     iXY max;
     max = min + pix;
-    if (max.x < 0) return;
-    if (max.y < 0) return;
+    if (max.x <= 0) return;
+    if (max.y <= 0) return;
 
     int        pixelsPerRow = pix.x;
     int        numRows      = pix.y;
@@ -1634,8 +1634,8 @@
     if (min.y >= pix.y) return;
 
     iXY max = destRect.max + offset;
-    if (max.x < 0) return;
-    if (max.y < 0) return;
+    if (max.x <= 0) return;
+    if (max.y <= 0) return;
 
     // Clip destination rectangle
     if (min.x < 0) min.x = 0;
Index: netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.17 
netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.18
--- netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.17     Sun Oct 12 
18:09:36 2003
+++ netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp  Sun Oct 12 18:44:01 2003
@@ -331,6 +331,7 @@
         } else {
             moveTo(destXPos, min.y);
         }
+        checkArea(screen->getPix());
     }
 
     // Check the validity of the Y dimension.
@@ -345,6 +346,7 @@
         } else {
             moveTo(min.x, destYPos);
         }
+        checkArea(screen->getPix());
     }
 
     // Resize the x dimension.
Index: netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.18 
netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.19
--- netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.18    Sun Oct 
12 18:09:36 2003
+++ netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp Sun Oct 12 
18:44:01 2003
@@ -673,11 +673,6 @@
         case _objective_disposition_player: {
 
                 iXY objectiveScreenPos(objectiveBounds.min - gameViewRect.min);
-                printf("GameViewRect: %d %d %d %d\n", gameViewRect.min.x,
-                        gameViewRect.min.y, gameViewRect.max.x,
-                        gameViewRect.max.y);
-                printf("ObjectiveScreenPos: %d %d\n", objectiveBounds.min.x,
-                        objectiveBounds.min.y);
 
                 outpostStatus = 
ObjectiveInterface::getOutpostStatus(objectiveID);
 
@@ -716,8 +711,7 @@
                     //pos.y = (miniProductionRect.getSizeY() - CHAR_YPIX) / 2 
+ miniProductionRect.min.y;
 
                     // Objective is off.
-                    // XXX
-                    //dest.bltLookup(miniProductionRect, 
Palette::darkGray256.getColorArray());
+                    dest.bltLookup(miniProductionRect, 
Palette::darkGray256.getColorArray());
 
                     dest.bltString(pos, outpostNameBuf, Color::white);
                     pos.y += 16;
@@ -751,8 +745,7 @@
                                 % 60);
                     checkMiniProductionRect(timeLeftBuf);
 
-                    // XXX
-                    // dest.bltLookup(miniProductionRect, 
Palette::darkGray256.getColorArray());
+                    dest.bltLookup(miniProductionRect, 
Palette::darkGray256.getColorArray());
 
                     dest.bltString(pos, outpostNameBuf, Color::white);
                     pos.y += 16;
@@ -801,8 +794,7 @@
                     }
                     checkMiniProductionRect(outpostNameBuf);
 
-                    // XXX
-                    //dest.bltLookup(miniProductionRect, 
Palette::darkGray256.getColorArray());
+                    dest.bltLookup(miniProductionRect, 
Palette::darkGray256.getColorArray());
 
                     dest.bltString(pos, outpostNameBuf, Color::white);
                 }
@@ -838,6 +830,7 @@
         pos = mouse.getScreenPos() - getSize() / 2;
 
         moveTo(pos);
+        checkArea(screen->getPix());
     }
 
     GameTemplateView::doActivate();




reply via email to

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