use FormatMoney everywhere

This commit is contained in:
Marco Antonio J. Costa
2025-10-08 05:36:37 -03:00
committed by majcosta
parent 0dd32c4670
commit 3d29eff4d8
25 changed files with 160 additions and 477 deletions
+3 -6
View File
@@ -474,7 +474,6 @@ void HandleDialogue( )
BOOLEAN fDoneTalking = FALSE;
SOLDIERTYPE *pSoldier = NULL;
CHAR16 zText[ 512 ];
CHAR16 zMoney[128];
// we don't want to just delay action of some events, we want to pause the whole queue, regardless of the event
if( gfDialogueQueuePaused )
@@ -1055,18 +1054,16 @@ void HandleDialogue( )
if ( QItem.uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_SHOPKEEPER )
{
std::wstring zMoney{};
if( QItem.uiSpecialEventData < 3 )
{
// post a notice if the player wants to withdraw money from thier account to cover the difference?
swprintf( zMoney, L"%d", QItem.uiSpecialEventData2 );
InsertCommasForDollarFigure( zMoney );
InsertDollarSignInToString( zMoney );
zMoney = FormatMoney(QItem.uiSpecialEventData2);
}
else if ( QItem.uiSpecialEventData > 7 )
{
// post a notice if the player wants to withdraw money from thier account to cover the difference?
swprintf( zMoney, L"%d", QItem.uiSpecialEventData2 );
InsertCommasForDollarFigure( zMoney );
zMoney = FormatMoney(QItem.uiSpecialEventData2);
}
switch( QItem.uiSpecialEventData )
+4 -8
View File
@@ -4634,8 +4634,7 @@ void StartDialogueMessageBox( UINT8 ubProfileID, UINT16 usMessageBoxType )
case NPC_ACTION_ASK_ABOUT_PAYING_RPC:
case NPC_ACTION_ASK_ABOUT_PAYING_RPC_WITH_DAILY_SALARY:
case NPC_ACTION_REDUCE_CONRAD_SALARY_CONDITIONS:
swprintf( zTemp2, L"%d", gMercProfiles[ubProfileID].sSalary );
InsertDollarSignInToString( zTemp2 );
swprintf( zTemp2, L"%s", FormatMoney(gMercProfiles[ubProfileID].sSalary).data());
swprintf( zTemp, TacticalStr[ HIRE_PROMPT ], gMercProfiles[ubProfileID].zNickname, zTemp2 );
DoMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, DialogueMessageBoxCallBack, NULL );
break;
@@ -4644,8 +4643,7 @@ void StartDialogueMessageBox( UINT8 ubProfileID, UINT16 usMessageBoxType )
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ BOXING_PROMPT ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, DialogueMessageBoxCallBack, NULL );
break;
case NPC_ACTION_BUY_LEATHER_KEVLAR_VEST:
swprintf( zTemp2, L"%d", Item[LEATHER_JACKET_W_KEVLAR].usPrice );
InsertDollarSignInToString( zTemp2 );
swprintf( zTemp2, L"%s", FormatMoney(Item[LEATHER_JACKET_W_KEVLAR].usPrice).data());
swprintf( zTemp, TacticalStr[ BUY_VEST_PROMPT ], ItemNames[LEATHER_JACKET_W_KEVLAR], zTemp2 );
DoMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, DialogueMessageBoxCallBack, NULL );
break;
@@ -4666,15 +4664,13 @@ void StartDialogueMessageBox( UINT8 ubProfileID, UINT16 usMessageBoxType )
{
iTemp -= giHospitalRefund;
}
swprintf( zTemp2, L"%ld", iTemp );
InsertDollarSignInToString( zTemp2 );
swprintf( zTemp2, L"%s", FormatMoney(iTemp).data());
swprintf( zTemp, TacticalStr[ PAY_MONEY_PROMPT ], zTemp2 );
DoMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, DialogueMessageBoxCallBack, NULL );
break;
case NPC_ACTION_BUY_VEHICLE_REQUESTOR:
swprintf( zTemp2, L"%ld", 10000 );
InsertDollarSignInToString( zTemp2 );
swprintf( zTemp2, L"%s", FormatMoney(10000).data());
swprintf( zTemp, TacticalStr[ PAY_MONEY_PROMPT ], zTemp2 );
DoMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, DialogueMessageBoxCallBack, NULL );
+6 -18
View File
@@ -7931,9 +7931,7 @@ void RenderItemDescriptionBox( )
//Display the total amount of money remaining
SetFontForeground( 5 );
swprintf( pStr, L"%ld", gRemoveMoney.uiMoneyRemaining );
InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr );
swprintf( pStr, L"%s", FormatMoney(gRemoveMoney.uiMoneyRemaining).data() );
if (UsingNewInventorySystem() == true)
FindFontRightCoordinates( gMoneyStats[ 4 ].sX + 50, gMoneyStats[ 4 ].sY, ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
else
@@ -7942,9 +7940,7 @@ void RenderItemDescriptionBox( )
//Display the total amount of money removing
SetFontForeground( 5 );
swprintf( pStr, L"%ld", gRemoveMoney.uiMoneyRemoving );
InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr );
swprintf( pStr, L"%s", FormatMoney(gRemoveMoney.uiMoneyRemoving).data() );
if (UsingNewInventorySystem() == true)
FindFontRightCoordinates( gMoneyStats[ 5 ].sX + 50, gMoneyStats[ 5 ].sY, ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
else
@@ -7973,9 +7969,7 @@ void RenderItemDescriptionBox( )
// {
SetFontForeground( FONT_FCOLOR_WHITE );
SetFontShadow( DEFAULT_SHADOW );
swprintf( pStr, L"%ld", (*gpItemDescObject)[gubItemDescStatusIndex]->data.money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr );
swprintf( pStr, L"%s", FormatMoney((*gpItemDescObject)[gubItemDescStatusIndex]->data.money.uiMoneyAmount).data() );
if( guiCurrentItemDescriptionScreen == MAP_SCREEN )
FindFontRightCoordinates( (INT16)(ITEMDESC_NAME_X), (INT16)(ITEMDESC_NAME_Y ), 245, ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
else if ( UsingEDBSystem() > 0 )
@@ -11470,9 +11464,7 @@ void RenderItemPickupMenu( )
if ( Item[ pObject->usItem ].usItemClass == IC_MONEY )
{
CHAR16 pStr2[20];
swprintf( pStr2, L"%ld", (*pObject)[0]->data.money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr2 );
InsertDollarSignInToString( pStr2 );
swprintf( pStr2, L"%s", FormatMoney((*pObject)[0]->data.money.uiMoneyAmount ).data());
swprintf( pStr, L"%s (%ls)", ItemNames[ pObject->usItem ], pStr2 );
}
@@ -12216,9 +12208,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
case MONEY:
//Money
{
swprintf( pStr, L"%ld", (*pObject)[subObject]->data.money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr );
swprintf( pStr, L"%s", FormatMoney((*pObject)[subObject]->data.money.uiMoneyAmount ).data());
}
break;
@@ -12227,9 +12217,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
//if ( Item[ usItem ].usItemClass == IC_MONEY )
{
CHAR16 pStr2[20];
swprintf( pStr2, L"%ld", (*pObject)[subObject]->data.money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr2 );
InsertDollarSignInToString( pStr2 );
swprintf( pStr2, L"%s", FormatMoney((*pObject)[subObject]->data.money.uiMoneyAmount ).data());
swprintf( pStr, L"%s (%ls)", ItemNames[ usItem ], pStr2 );
}
+1 -4
View File
@@ -7783,10 +7783,7 @@ void SMInvMoneyButtonCallback( MOUSE_REGION * pRegion, INT32 iReason )
guiPendingOverrideEvent = A_CHANGE_TO_MOVE;
HandleTacticalUI( );
swprintf( zMoney, L"%d", (*gpItemPointer)[0]->data.money.uiMoneyAmount );
InsertCommasForDollarFigure( zMoney );
InsertDollarSignInToString( zMoney );
swprintf( zMoney, L"%s", FormatMoney((*gpItemPointer)[0]->data.money.uiMoneyAmount ).data());
//ask the user if they are sure they want to deposit the money
swprintf( zText, gzMoneyWithdrawMessageText[ CONFIRMATION_TO_DEPOSIT_MONEY_TO_ACCOUNT ], zMoney );
+7 -16
View File
@@ -1524,9 +1524,7 @@ BOOLEAN RenderShopKeeperInterface()
// display shopkeeper budget
DisplayWrappedString( SKI_BUDGET_X, SKI_BUDGET_Y, SKI_BUDGET_WIDTH, 2, SKI_LABEL_FONT, SKI_TITLE_COLOR, SKI_Text[SKI_TEXT_BUDGET], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
swprintf( zMoney, L"%d", gArmsDealerStatus[gbSelectedArmsDealerID].uiArmsDealersCash );
InsertCommasForDollarFigure( zMoney );
swprintf( zMoney, L"%s", FormatMoney(gArmsDealerStatus[gbSelectedArmsDealerID].uiArmsDealersCash).data() );
CHAR16 zTemp2[64];
if ( armsDealerInfo[gbSelectedArmsDealerID].uiFlags & ARMS_DEALER_DEALWITHINTEL )
@@ -1554,14 +1552,12 @@ BOOLEAN RenderShopKeeperInterface()
//Display the players current balance value
if ( armsDealerInfo[gbSelectedArmsDealerID].uiFlags & ARMS_DEALER_DEALWITHINTEL )
{
swprintf( zMoney, L"%d", (int)(GetIntel()) );
InsertCommasForDollarFigure( zMoney );
swprintf( zMoney, L"%s", FormatMoney((int)(GetIntel()) ).data());
swprintf( zTemp2, L"%s Intel", zMoney );
}
else
{
swprintf( zMoney, L"%d", LaptopSaveInfo.iCurrentBalance );
InsertCommasForDollarFigure( zMoney );
swprintf( zMoney, L"%s", FormatMoney(LaptopSaveInfo.iCurrentBalance ).data());
swprintf( zTemp2, L"$%s", zMoney );
}
@@ -1732,9 +1728,7 @@ void DisplayAllDealersCash()
DrawTextToScreen( gMercProfiles[ armsDealerInfo[ bArmsDealer ].ubShopKeeperID ].zNickname, SCREEN_X_OFFSET + 540, SCREEN_Y_OFFSET + usPosY, 0, FONT10ARIAL, SKI_TITLE_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED );
//Display the arms dealer cash on hand
swprintf( zTemp, L"%d", gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash );
InsertCommasForDollarFigure( zTemp );
swprintf( zTemp, L"%s", FormatMoney(gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash ).data());
if ( armsDealerInfo[gbSelectedArmsDealerID].uiFlags & ARMS_DEALER_DEALWITHINTEL )
swprintf( zTemp2, L"%s Intel", zTemp );
@@ -2789,8 +2783,7 @@ UINT32 DisplayInvSlot( UINT16 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT
//if the item has a price, display it
if( uiItemCost != 0 )
{
swprintf( zTemp, L"%d", uiItemCost );
InsertCommasForDollarFigure( zTemp );
swprintf( zTemp, L"%s", FormatMoney(uiItemCost).data() );
CHAR16 zTemp2[64];
if ( armsDealerInfo[gbSelectedArmsDealerID].uiFlags & ARMS_DEALER_DEALWITHINTEL )
@@ -3462,8 +3455,7 @@ void DisplayArmsDealerOfferArea()
if( gubSkiDirtyLevel == SKI_DIRTY_LEVEL2 )
{
//Display the total cost text
swprintf( zTemp, L"%d", uiTotalCost );
InsertCommasForDollarFigure( zTemp );
swprintf( zTemp, L"%s", FormatMoney(uiTotalCost).data() );
CHAR16 zTemp2[64];
if ( armsDealerInfo[gbSelectedArmsDealerID].uiFlags & ARMS_DEALER_DEALWITHINTEL )
@@ -3727,8 +3719,7 @@ void DisplayPlayersOfferArea()
if( gubSkiDirtyLevel == SKI_DIRTY_LEVEL2 )
{
//Display the total cost text
swprintf( zTemp, L"%d", uiTotalCost );
InsertCommasForDollarFigure( zTemp );
swprintf( zTemp, L"%s", FormatMoney(uiTotalCost).data() );
CHAR16 zTemp2[64];
if ( armsDealerInfo[gbSelectedArmsDealerID].uiFlags & ARMS_DEALER_DEALWITHINTEL )