Fixed the starmap fuel range circle overflow; bug #1130; also cap the range circle at a sensible level to prevent further overflows
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3646 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Changes towards version 0.8:
|
||||
- Fixed starmap fuel range circle shrinking (bug #1130) - Alex
|
||||
- Added gamma correction to the setup menu (bug #977) - Alex, Nic
|
||||
- Refactor Melnorme comm code to make modding easier; step 1 (bug #1128),
|
||||
from Scott A. Colcord
|
||||
|
||||
@@ -68,18 +68,18 @@ signedDivWithError (long val, long divisor)
|
||||
#define MAP_FIT_X ((MAX_X_UNIVERSE + 1) / SIS_SCREEN_WIDTH + 1)
|
||||
|
||||
static inline COORD
|
||||
universeToDispx (COORD ux)
|
||||
universeToDispx (long ux)
|
||||
{
|
||||
return signedDivWithError ((((long)ux - mapOrigin.x) << zoomLevel)
|
||||
return signedDivWithError (((ux - mapOrigin.x) << zoomLevel)
|
||||
* SIS_SCREEN_WIDTH, MAX_X_UNIVERSE + MAP_FIT_X)
|
||||
+ ((SIS_SCREEN_WIDTH - 1) >> 1);
|
||||
}
|
||||
#define UNIVERSE_TO_DISPX(ux) universeToDispx(ux)
|
||||
|
||||
static inline COORD
|
||||
universeToDispy (COORD uy)
|
||||
universeToDispy (long uy)
|
||||
{
|
||||
return signedDivWithError ((((long)mapOrigin.y - uy) << zoomLevel)
|
||||
return signedDivWithError (((mapOrigin.y - uy) << zoomLevel)
|
||||
* SIS_SCREEN_HEIGHT, MAX_Y_UNIVERSE + 2)
|
||||
+ ((SIS_SCREEN_HEIGHT - 1) >> 1);
|
||||
}
|
||||
@@ -343,6 +343,7 @@ DrawStarMap (COUNT race_update, RECT *pClipRect)
|
||||
}
|
||||
ClearDrawable ();
|
||||
|
||||
// Draw the fuel range circle
|
||||
if (race_update == 0
|
||||
&& which_space < 2
|
||||
&& (diameter = (long)GLOBAL_SIS (FuelOnBoard) << 1))
|
||||
@@ -357,6 +358,10 @@ DrawStarMap (COUNT race_update, RECT *pClipRect)
|
||||
r.corner.y = LOGY_TO_UNIVERSE (GLOBAL_SIS (log_y));
|
||||
}
|
||||
|
||||
// Cap the diameter to a sane range
|
||||
if (diameter > MAX_X_UNIVERSE * 4)
|
||||
diameter = MAX_X_UNIVERSE * 4;
|
||||
|
||||
r.extent.width = UNIVERSE_TO_DISPX (diameter)
|
||||
- UNIVERSE_TO_DISPX (0);
|
||||
if (r.extent.width < 0)
|
||||
|
||||
Reference in New Issue
Block a user