Prevent overflow for planet weight when scanning a planet.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2893 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2008-01-05 19:27:48 +00:00
parent 7a82c28524
commit 98488b97e4
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.7: Changes towards version 0.7:
- Prevent overflow for planet weight when scanning a planet
- from Benjamin Alan Weaver
- Don't set _POSIX_THREAD_SAFE_FUNCTIONS - SvdB - Don't set _POSIX_THREAD_SAFE_FUNCTIONS - SvdB
- Support for Windows CE. - SvdB with Pavel Chernikov - Support for Windows CE. - SvdB with Pavel Chernikov
- Added support to the unix build system for explicitely specifying the name - Added support to the unix build system for explicitely specifying the name
+2 -2
View File
@@ -301,7 +301,7 @@ PrintCoarseScanPC (void)
PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 11), PrintScanTitlePC (&t, &r, GAME_STRING (ORBITSCAN_STRING_BASE + 11),
RIGHT_SIDE_BASELINE_X_PC); // "Mass: " RIGHT_SIDE_BASELINE_X_PC); // "Mass: "
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius; val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
val = (val * val * val / 100L val = ((DWORD) val * (DWORD) val * (DWORD) val / 100L
* pSolarSysState->SysInfo.PlanetInfo.PlanetDensity * pSolarSysState->SysInfo.PlanetInfo.PlanetDensity
+ ((100L * 100L) >> 1)) / (100L * 100L); + ((100L * 100L) >> 1)) / (100L * 100L);
if (val == 0) if (val == 0)
@@ -522,7 +522,7 @@ PrintCoarseScan3DO (void)
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf; t.pStr = buf;
val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius; val = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
val = (val * val * val / 100L val = ((DWORD) val * (DWORD) val * (DWORD) val / 100L
* pSolarSysState->SysInfo.PlanetInfo.PlanetDensity * pSolarSysState->SysInfo.PlanetInfo.PlanetDensity
+ ((100L * 100L) >> 1)) / (100L * 100L); + ((100L * 100L) >> 1)) / (100L * 100L);
if (val == 0) if (val == 0)