View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0000882 | Spring engine | General | public | 2008-04-02 04:08 | 2008-04-02 11:56 | ||||
Reporter | Flaamwing | ||||||||
Assigned To | Kloot | ||||||||
Priority | normal | Severity | crash | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0000882: Aircraft outside bounds of map cause crash. | ||||||||
Description | Occasionally 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 Information | I 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" | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
Kloot (developer) 2008-04-02 11:55 |
This one's already fixed in SVN, thanks for your time though! |