- fixed bug with CAMO_REMOVING = TRUE

Too much of a camo kit was used when the character was wearing an outfit with different camo bonus.

- fixed bug with DYNAMIC_IMP_PROFILE_COST = TRUE
The game was always one step behind in cost display but charged the correct price. Now charged price and display match.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6565 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2013-11-07 19:11:35 +00:00
parent d054395b59
commit 6c9d6cec68
2 changed files with 22 additions and 5 deletions
+14 -5
View File
@@ -338,7 +338,11 @@ void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason)
*/ */
// SANDRO - changed to find the actual profile cost // SANDRO - changed to find the actual profile cost
//if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE ) //if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE )
if( LaptopSaveInfo.iCurrentBalance < iGetProfileCost() )
// silversurfer: We need to store the profile cost here because right now our new IMP doesn't occupy a slot yet.
// However function iGetProfileCost() will already calculate price including that slot. We would charge too much money after the IMP is created below.
INT32 iIMPCost = iGetProfileCost();
if( LaptopSaveInfo.iCurrentBalance < iIMPCost )
{ {
// not enough // not enough
return; return;
@@ -352,7 +356,7 @@ void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason)
// charge the player // charge the player
// SANDRO - changed to find the actual profile cost // SANDRO - changed to find the actual profile cost
//AddTransactionToPlayersBook(IMP_PROFILE, (UINT8)(LaptopSaveInfo.iIMPIndex), GetWorldTotalMin( ), - ( COST_OF_PROFILE ) ); //AddTransactionToPlayersBook(IMP_PROFILE, (UINT8)(LaptopSaveInfo.iIMPIndex), GetWorldTotalMin( ), - ( COST_OF_PROFILE ) );
AddTransactionToPlayersBook(IMP_PROFILE, (UINT8)(LaptopSaveInfo.iIMPIndex), GetWorldTotalMin( ), - ( iGetProfileCost() ) ); AddTransactionToPlayersBook(IMP_PROFILE, (UINT8)(LaptopSaveInfo.iIMPIndex), GetWorldTotalMin( ), - ( iIMPCost ) );
AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 ); AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 );
AddCharacterToPlayersTeam( ); AddCharacterToPlayersTeam( );
@@ -1519,6 +1523,10 @@ BOOLEAN LoadImpCharacter( STR nickName )
{ {
LaptopSaveInfo.iIMPIndex = iProfileId; LaptopSaveInfo.iIMPIndex = iProfileId;
// silversurfer: Store current IMP cost. Function iGetProfileCost() already takes the new slot into account.
// If we create the IMP first we would charge too much.
INT32 iIMPCost = iGetProfileCost();
// read in the profile // read in the profile
//if ( !gMercProfiles[ iProfileId ].Load(hFile, false) ) //if ( !gMercProfiles[ iProfileId ].Load(hFile, false) )
if ( !gMercProfiles[ iProfileId ].Load(hFile, isOldVersion, false, false) ) if ( !gMercProfiles[ iProfileId ].Load(hFile, isOldVersion, false, false) )
@@ -1534,7 +1542,7 @@ BOOLEAN LoadImpCharacter( STR nickName )
DistributeInitialGear(&gMercProfiles[iProfileId]); DistributeInitialGear(&gMercProfiles[iProfileId]);
// Changed to find actual IMP cost - SANDRO // Changed to find actual IMP cost - SANDRO
if( LaptopSaveInfo.iCurrentBalance < iGetProfileCost() ) if( LaptopSaveInfo.iCurrentBalance < iIMPCost )
{ {
DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 3 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 3 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL);
@@ -1558,7 +1566,7 @@ BOOLEAN LoadImpCharacter( STR nickName )
fCharacterIsMale = ( gMercProfiles[ iProfileId ].bSex == MALE ); fCharacterIsMale = ( gMercProfiles[ iProfileId ].bSex == MALE );
fLoadingCharacterForPreviousImpProfile = TRUE; fLoadingCharacterForPreviousImpProfile = TRUE;
// Changed to find actual IMP cost - SANDRO // Changed to find actual IMP cost - SANDRO
AddTransactionToPlayersBook(IMP_PROFILE,0, GetWorldTotalMin( ), - ( iGetProfileCost() ) ); AddTransactionToPlayersBook(IMP_PROFILE,0, GetWorldTotalMin( ), - ( iIMPCost ) );
AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 ); AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 );
LaptopSaveInfo.iIMPIndex = iProfileId; LaptopSaveInfo.iIMPIndex = iProfileId;
AddCharacterToPlayersTeam( ); AddCharacterToPlayersTeam( );
@@ -1773,7 +1781,8 @@ INT32 iGetProfileCost()
{ {
INT32 iIMPProfileCost; INT32 iIMPProfileCost;
iIMPProfileCost = gGameExternalOptions.iIMPProfileCost * CountFilledIMPSlots(-1); // silversurfer: When we create an IMP he doesn't occupy a slot yet so we need to add 1 to get the correct price in advance.
iIMPProfileCost = gGameExternalOptions.iIMPProfileCost * ( CountFilledIMPSlots(-1) + 1 );
if (iIMPProfileCost >= gGameExternalOptions.iIMPProfileCost) if (iIMPProfileCost >= gGameExternalOptions.iIMPProfileCost)
return(iIMPProfileCost); return(iIMPProfileCost);
+8
View File
@@ -9194,6 +9194,8 @@ BOOLEAN ApplyCammo( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodAP
{ {
pSoldier->bCamo = __min( 100, pSoldier->bCamo + iJungleCamoAdded ); pSoldier->bCamo = __min( 100, pSoldier->bCamo + iJungleCamoAdded );
} }
// update with amount that we really used
bPointsToUse = __min( bPointsToUse, (iJungleCamoAdded + 1) / 2 );
} }
// Second, check if we have an item with major URBAN camobonus // Second, check if we have an item with major URBAN camobonus
else if ( (Item[pObj->usItem].urbanCamobonus > Item[pObj->usItem].camobonus) && else if ( (Item[pObj->usItem].urbanCamobonus > Item[pObj->usItem].camobonus) &&
@@ -9234,6 +9236,8 @@ BOOLEAN ApplyCammo( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodAP
{ {
pSoldier->urbanCamo = __min( 100, pSoldier->urbanCamo + iUrbanCamoAdded ); pSoldier->urbanCamo = __min( 100, pSoldier->urbanCamo + iUrbanCamoAdded );
} }
// update with amount that we really used
bPointsToUse = __min( bPointsToUse, (iUrbanCamoAdded + 1) / 2 );
} }
// Third, check if we have an item with major DESERT camobonus // Third, check if we have an item with major DESERT camobonus
else if ( (Item[pObj->usItem].desertCamobonus > Item[pObj->usItem].camobonus) && else if ( (Item[pObj->usItem].desertCamobonus > Item[pObj->usItem].camobonus) &&
@@ -9274,6 +9278,8 @@ BOOLEAN ApplyCammo( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodAP
{ {
pSoldier->desertCamo = __min( 100, pSoldier->desertCamo + iDesertCamoAdded ); pSoldier->desertCamo = __min( 100, pSoldier->desertCamo + iDesertCamoAdded );
} }
// update with amount that we really used
bPointsToUse = __min( bPointsToUse, (iDesertCamoAdded + 1) / 2 );
} }
// Fourth, check if we have an item with major SNOW camobonus // Fourth, check if we have an item with major SNOW camobonus
else if ( (Item[pObj->usItem].snowCamobonus > Item[pObj->usItem].camobonus) && else if ( (Item[pObj->usItem].snowCamobonus > Item[pObj->usItem].camobonus) &&
@@ -9314,6 +9320,8 @@ BOOLEAN ApplyCammo( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodAP
{ {
pSoldier->snowCamo = __min( 100, pSoldier->snowCamo + iSnowCamoAdded ); pSoldier->snowCamo = __min( 100, pSoldier->snowCamo + iSnowCamoAdded );
} }
// update with amount that we really used
bPointsToUse = __min( bPointsToUse, (iSnowCamoAdded + 1) / 2 );
} }
else // the item has no major camo, return else // the item has no major camo, return
return( FALSE ); return( FALSE );