Merged revision(s) 7251 from branches/ja2_source_official_2014:

code cleanup & removed some warnings

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7252 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2014-06-01 21:50:14 +00:00
parent be52b5bf76
commit 6448b332ec
8 changed files with 168 additions and 325 deletions
+3 -3
View File
@@ -468,7 +468,7 @@ DropDownBase::SelectDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
UINT8 ubSelected = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
mSelectedEntry = min(ubSelected + mFirstShownEntry, mEntryVector.size() -1) ;
mSelectedEntry = min(ubSelected + mFirstShownEntry, max(0, mEntryVector.size() -1) );
Destroy_Drop();
}
@@ -538,10 +538,10 @@ DropDownBase::SelectScrollAreaDropDownMovementCallBack(MOUSE_REGION * pRegion, I
}
else if( mFirstShownEntry + ubCityNum > mSelectedEntry )
{
mSelectedEntry = min(mFirstShownEntry + ubCityNum, mEntryVector.size() - 1);
mSelectedEntry = min( mFirstShownEntry + ubCityNum, max( 0, mEntryVector.size( ) - 1 ) );
if ( ubCityNum == mNumDisplayedEntries - 1 )
mFirstShownEntry = min(mFirstShownEntry + 1, mEntryVector.size() - 1);
mFirstShownEntry = min( mFirstShownEntry + 1, max( 0, mEntryVector.size( ) - 1 ) );
}
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
+103 -254
View File
File diff suppressed because it is too large Load Diff
+14 -17
View File
@@ -4076,26 +4076,23 @@ static int l_FadeOutGameScreen(lua_State *L)
int l_InitMapProfil (lua_State *L)
{
if ( lua_gettop(L) >= 1 )
{
UINT8 prof = lua_tointeger(L,1);
INT16 x = lua_tointeger(L,2);
INT16 y = lua_tointeger(L,3);
INT16 z = lua_tointeger(L,4);
UINT32 gridno = lua_tointeger(L,5);
gMercProfiles[ prof ].sSectorX = x;
gMercProfiles[ prof ].sSectorY = y;
gMercProfiles[ prof ].bSectorZ = z;
gMercProfiles[ prof ].sGridNo = gridno;
gMercProfiles[ prof ].fUseProfileInsertionInfo = TRUE;
gMercProfiles[ prof ].ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
gMercProfiles[ prof ].usStrategicInsertionData = gridno;
{
UINT8 prof = lua_tointeger(L,1);
INT16 x = lua_tointeger(L,2);
INT16 y = lua_tointeger(L,3);
INT8 z = lua_tointeger(L,4);
UINT32 gridno = lua_tointeger(L,5);
gMercProfiles[ prof ].sSectorX = x;
gMercProfiles[ prof ].sSectorY = y;
gMercProfiles[ prof ].bSectorZ = z;
gMercProfiles[ prof ].sGridNo = gridno;
gMercProfiles[ prof ].fUseProfileInsertionInfo = TRUE;
gMercProfiles[ prof ].ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
gMercProfiles[ prof ].usStrategicInsertionData = gridno;
}
return 0;
return 0;
}
static int l_ProfilesStrategicInsertionData (lua_State *L)
+1 -1
View File
@@ -4006,7 +4006,7 @@ void DisplayDistancesForHelicopter( void )
UINT32 uiCostRed = __max(0,gGameExternalOptions.usHelicopterBaseCostPerRedTile + gsSkyriderCostModifier);
uiTripCost = ( sNumSafeSectors * uiCostGreen ) + ( sNumUnSafeSectors * uiCostRed );
if( uiTripCost > LaptopSaveInfo.iCurrentBalance )
if( (INT32)uiTripCost > LaptopSaveInfo.iCurrentBalance )
SetFontForeground( FONT_LTRED );
swprintf( sString, L"%d", uiTripCost );
+2 -1
View File
@@ -5756,7 +5756,7 @@ void RemoveProhibitedAttachments(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, UINT16
// put it on the ground //dnl ch75 281013
INT32 sGridNo = NOWHERE;
UINT8 ubLevel = 0;
for(int i=0; i<guiNumWorldItems; i++)
for(UINT32 i=0; i<guiNumWorldItems; ++i)
{
if(gWorldItems[i].fExists && (pObj == &gWorldItems[i].object))
{
@@ -5765,6 +5765,7 @@ void RemoveProhibitedAttachments(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, UINT16
break;
}
}
if(sGridNo != NOWHERE)
{
if(guiCurrentItemDescriptionScreen == MAP_SCREEN && fShowMapInventoryPool)
+1 -1
View File
@@ -415,7 +415,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos, BOOLEA
ubMaxBullets = DefaultAutofireBulletsByGunClass( pSoldier );
if( ubMaxBullets == 0 )
{
ubMaxBullets = usShotsLeft;
ubMaxBullets = (UINT8)usShotsLeft;
bMaxAim = maxAimLevels;
}
+1 -5
View File
@@ -12150,17 +12150,13 @@ INT16 GetAPsToReload( OBJECTTYPE *pObj )
else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER )
fModifier = gItemSettings.fAPtoReloadModifierLauncher;
return ( Weapon[ pObj->usItem ].APsToReload * fModifier *
( 100 - GetPercentReloadTimeAPReduction(pObj) ) ) / 100;
return ( Weapon[ pObj->usItem ].APsToReload * fModifier * ( 100 - GetPercentReloadTimeAPReduction(pObj) ) ) / 100;
}
// HEADROCK HAM 3.4: Estimates the number of bullets left in the gun. For use during combat.
CHAR16 gBulletCount[10]; // This is a global containing the bullet count string
void EstimateBulletsLeft( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj )
{
UINT16 usExpLevel;
UINT32 usDexterity;
UINT32 usWisdom;
+43 -43
View File
@@ -41,14 +41,14 @@ int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubPathMode,
if ((sGridNo < 0) || (sGridNo >= GRIDSIZE))
{
#ifdef RECORDNET
fprintf(NetDebugFile,"LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno %d",GridNo);
fprintf(NetDebugFile,"LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno %d",GridNo);
#endif
#ifdef BETAVERSION
NumMessage("LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno ",GridNo);
NumMessage("LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno ",GridNo);
#endif
return(FALSE);
return(FALSE);
}
//dnl ch53 121009 Return false if gridno on different level from merc or inside unvisible area
@@ -58,33 +58,32 @@ int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubPathMode,
// skip mercs if turnbased and adjacent AND not doing an IGNORE_PATH check (which is used almost exclusively by GoAsFarAsPossibleTowards)
fSkipTilesWithMercs = (gfTurnBasedAI && ubPathMode != IGNORE_PATH && SpacesAway( pSoldier->sGridNo, sGridNo ) == 1 );
// if this gridno is an OK destination
// AND the gridno is NOT in a tear-gassed tile when we have no gas mask
// AND someone is NOT already standing there
// AND we're NOT already standing at that gridno
// AND the gridno hasn't been black-listed for us
// if this gridno is an OK destination
// AND the gridno is NOT in a tear-gassed tile when we have no gas mask
// AND someone is NOT already standing there
// AND we're NOT already standing at that gridno
// AND the gridno hasn't been black-listed for us
// Nov 28 98: skip people in destination tile if in turnbased
if ( ( NewOKDestination(pSoldier, sGridNo, fSkipTilesWithMercs, pSoldier->pathing.bLevel ) ) &&
// Nov 28 98: skip people in destination tile if in turnbased
if ( ( NewOKDestination(pSoldier, sGridNo, fSkipTilesWithMercs, pSoldier->pathing.bLevel ) ) &&
( !InGas( pSoldier, sGridNo ) ) &&
( sGridNo != pSoldier->sGridNo ) &&
( sGridNo != pSoldier->pathing.sBlackList ) )
/*
if ( ( NewOKDestination(pSoldier, sGridno, FALSE, pSoldier->pathing.bLevel ) ) &&
( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) &&
( sGridno != pSoldier->sGridNo ) &&
( sGridno != pSoldier->pathing.sBlackList ) )*/
/*
if ( ( NewOKDestination(pSoldier,sGridno,ALLPEOPLE, pSoldier->pathing.bLevel ) ) &&
( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) &&
( sGridno != pSoldier->sGridNo ) &&
( sGridno != pSoldier->pathing.sBlackList ) )
*/
/*
if ( ( NewOKDestination(pSoldier, sGridno, FALSE, pSoldier->pathing.bLevel ) ) &&
( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) &&
( sGridno != pSoldier->sGridNo ) &&
( sGridno != pSoldier->pathing.sBlackList ) )*/
/*
if ( ( NewOKDestination(pSoldier,sGridno,ALLPEOPLE, pSoldier->pathing.bLevel ) ) &&
( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) &&
( sGridno != pSoldier->sGridNo ) &&
( sGridno != pSoldier->pathing.sBlackList ) )
*/
{
// if water's a problem, and gridno is in a water tile (bridges are OK)
// if water's a problem, and gridno is in a water tile (bridges are OK)
if (!ubWaterOK && Water(sGridNo))
return(FALSE);
return(FALSE);
//Madd: added to prevent people from running into gas and fire
if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) &&
@@ -97,34 +96,35 @@ int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubPathMode,
return( FALSE );
}
// passed all checks, now try to make sure we can get there!
switch (ubPathMode)
{
// if finding a path wasn't asked for (could have already been done,
// for example), don't bother
case IGNORE_PATH : return(TRUE);
// passed all checks, now try to make sure we can get there!
switch (ubPathMode)
{
// if finding a path wasn't asked for (could have already been done,
// for example), don't bother
case IGNORE_PATH : return(TRUE);
case ENSURE_PATH : if ( FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, COPYROUTE, fFlags ) )
{
return(TRUE); // legal destination
}
else // got this far, but found no clear path,
{
// so test fails
return(FALSE);
}
case ENSURE_PATH : if ( FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, COPYROUTE, fFlags ) )
{
return(TRUE); // legal destination
}
else // got this far, but found no clear path,
{
// so test fails
return(FALSE);
}
// *** NOTE: movement mode hardcoded to WALKING !!!!!
// *** NOTE: movement mode hardcoded to WALKING !!!!!
case ENSURE_PATH_COST: return(PlotPath(pSoldier,sGridNo,FALSE,FALSE,FALSE,WALKING,FALSE,FALSE,0));
default :
default :
#ifdef BETAVERSION
NumMessage("LegalNPC->pathing.sDestination: ERROR - illegal pathMode = ",ubPathMode);
#endif
return(FALSE);
}
}
}
else // something failed - didn't even have to test path
// something failed - didn't even have to test path
return(FALSE); // illegal destination
}