2019-11-21 11:38 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000882Spring engineGeneralpublic2008-04-02 11:56
ReporterFlaamwing 
Assigned ToKloot 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000882: Aircraft outside bounds of map cause crash.
DescriptionOccasionally aircraft go beyond the limits of the map. Specifically when they are near the edge of the map, and are told to change direction. But fortunately the air combat test was able to show this problem every time by using the SpeedMetalDuo map.

Also, as a side note - air combat test would also try to create units outside the map area with that map.
Additional InformationI considered changing things such that aircraft modifications to location were always capped to the map coordinates, however that would change the flight path and I'm not sure what else would be affected.

I judged it safest to just do a check prior to accessing the height map. The patch is as follows.

--- Unit.cpp-revBASE.svn000.tmp.cpp Tue Apr 01 21:22:48 2008
+++ C:/Projects/Spring76b1/rts/Sim/Units/Unit.cpp Mon Mar 31 23:38:11 2008
@@ -715,7 +715,11 @@
bool inWater = (pos.y <= -3);
bool isFloating = (physicalState == CSolidObject::Floating);
bool onGround = (physicalState == CSolidObject::OnGround);
- bool waterSquare = (readmap->mipHeightmap[1][int((pos.z / (SQUARE_SIZE * 2)) * gs->hmapx + (pos.x / (SQUARE_SIZE * 2)))] < -1);
+ // Cap the units, because occasionally air units can go off the map.
+ // they will come back on, but in the mean time we can't access unavailable memory!
+ int posx = min<float>(max<float>(pos.x, 0), pos.maxxpos);
+ int posz = min<float>(max<float>(pos.z, 0), pos.maxzpos);
+ bool waterSquare = (readmap->mipHeightmap[1][int((posz / (SQUARE_SIZE * 2)) * gs->hmapx + (posx / (SQUARE_SIZE * 2)))] < -1);

// old: "floating or (on ground and height < -3 and mapheight < -1)"
// new: "height < -3 and (floating or on ground) and mapheight < -1"
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0002026

Kloot (developer)

This one's already fixed in SVN, thanks for your time though!
+Notes

-Issue History
Date Modified Username Field Change
2008-04-02 04:08 Flaamwing New Issue
2008-04-02 11:55 Kloot Note Added: 0002026
2008-04-02 11:56 Kloot Status new => resolved
2008-04-02 11:56 Kloot Resolution open => fixed
2008-04-02 11:56 Kloot Assigned To => Kloot
+Issue History