mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
use FormatMoney everywhere
This commit is contained in:
committed by
majcosta
parent
0dd32c4670
commit
3d29eff4d8
@@ -15169,14 +15169,12 @@ void CreateContractBox( SOLDIERTYPE *pCharacter )
|
||||
|
||||
if( pCharacter->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC )
|
||||
{
|
||||
swprintf( sDollarString, L"%d", 0 );
|
||||
swprintf( sDollarString, L"%s", FormatMoney(0).data() );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( sDollarString, L"%d", gMercProfiles[ pCharacter->ubProfile ].sSalary );
|
||||
swprintf( sDollarString, L"%s", FormatMoney(gMercProfiles[ pCharacter->ubProfile ].sSalary).data() );
|
||||
}
|
||||
InsertCommasForDollarFigure( sDollarString );
|
||||
InsertDollarSignInToString( sDollarString );
|
||||
swprintf( sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString);
|
||||
AddMonoString(&hStringHandle, sString);
|
||||
break;
|
||||
@@ -15184,15 +15182,13 @@ void CreateContractBox( SOLDIERTYPE *pCharacter )
|
||||
|
||||
if( pCharacter->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC )
|
||||
{
|
||||
swprintf( sDollarString, L"%d", 0 );
|
||||
swprintf( sDollarString, L"%s", FormatMoney(0).data() );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( sDollarString, L"%d", gMercProfiles[ pCharacter->ubProfile ].uiWeeklySalary );
|
||||
swprintf( sDollarString, L"%s", FormatMoney(gMercProfiles[ pCharacter->ubProfile ].uiWeeklySalary).data() );
|
||||
}
|
||||
|
||||
InsertCommasForDollarFigure( sDollarString );
|
||||
InsertDollarSignInToString( sDollarString );
|
||||
swprintf( sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString );
|
||||
AddMonoString(&hStringHandle, sString);
|
||||
break;
|
||||
@@ -15200,16 +15196,14 @@ void CreateContractBox( SOLDIERTYPE *pCharacter )
|
||||
|
||||
if( pCharacter->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC )
|
||||
{
|
||||
swprintf( sDollarString, L"%d", 0 );
|
||||
swprintf( sDollarString, L"%s", FormatMoney(0).data() );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( sDollarString, L"%d", gMercProfiles[ pCharacter->ubProfile ].uiBiWeeklySalary );
|
||||
swprintf( sDollarString, L"%s", FormatMoney(gMercProfiles[ pCharacter->ubProfile ].uiBiWeeklySalary).data() );
|
||||
}
|
||||
|
||||
|
||||
InsertCommasForDollarFigure( sDollarString );
|
||||
InsertDollarSignInToString( sDollarString );
|
||||
swprintf( sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString);
|
||||
AddMonoString(&hStringHandle, sString);
|
||||
break;
|
||||
@@ -15299,10 +15293,8 @@ void CreateContractBoxMultiSelect(INT32 DailySalaries, INT32 WeeklySalaries, INT
|
||||
//}
|
||||
//else
|
||||
{
|
||||
swprintf(sDollarString, L"%d", DailySalaries);
|
||||
swprintf(sDollarString, L"%s", FormatMoney(DailySalaries).data() );
|
||||
}
|
||||
InsertCommasForDollarFigure(sDollarString);
|
||||
InsertDollarSignInToString(sDollarString);
|
||||
swprintf(sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString);
|
||||
AddMonoString(&hStringHandle, sString);
|
||||
break;
|
||||
@@ -15314,11 +15306,9 @@ void CreateContractBoxMultiSelect(INT32 DailySalaries, INT32 WeeklySalaries, INT
|
||||
//}
|
||||
//else
|
||||
{
|
||||
swprintf(sDollarString, L"%d", WeeklySalaries);
|
||||
swprintf(sDollarString, L"%s", FormatMoney(WeeklySalaries).data());
|
||||
}
|
||||
|
||||
InsertCommasForDollarFigure(sDollarString);
|
||||
InsertDollarSignInToString(sDollarString);
|
||||
swprintf(sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString);
|
||||
AddMonoString(&hStringHandle, sString);
|
||||
break;
|
||||
@@ -15330,12 +15320,10 @@ void CreateContractBoxMultiSelect(INT32 DailySalaries, INT32 WeeklySalaries, INT
|
||||
//}
|
||||
//else
|
||||
{
|
||||
swprintf(sDollarString, L"%d", BiweeklySalaries);
|
||||
swprintf(sDollarString, L"%s", FormatMoney(BiweeklySalaries).data());
|
||||
}
|
||||
|
||||
|
||||
InsertCommasForDollarFigure(sDollarString);
|
||||
InsertDollarSignInToString(sDollarString);
|
||||
swprintf(sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString);
|
||||
AddMonoString(&hStringHandle, sString);
|
||||
break;
|
||||
|
||||
@@ -1562,7 +1562,7 @@ void DisplayCurrentBalanceTitleForMapBottom( void )
|
||||
void DisplayCurrentBalanceForMapBottom( void )
|
||||
{
|
||||
// show the current balance for the player on the map panel bottom
|
||||
CHAR16 sString[ 128 ];
|
||||
std::wstring sString;
|
||||
INT16 sFontX, sFontY;
|
||||
|
||||
// ste the font buffer
|
||||
@@ -1573,22 +1573,18 @@ void DisplayCurrentBalanceForMapBottom( void )
|
||||
SetFontForeground( 183 );
|
||||
SetFontBackground( FONT_BLACK );
|
||||
|
||||
swprintf( sString, L"%d", LaptopSaveInfo.iCurrentBalance );
|
||||
|
||||
// insert
|
||||
InsertCommasForDollarFigure( sString );
|
||||
InsertDollarSignInToString( sString );
|
||||
sString = FormatMoney( LaptopSaveInfo.iCurrentBalance );
|
||||
|
||||
VarFindFontCenterCoordinates(
|
||||
UI_BOTTOM.Text.CurrentBalance.x,
|
||||
UI_BOTTOM.Text.CurrentBalance.y,
|
||||
UI_BOTTOM.Text.CurrentBalance.width,
|
||||
UI_BOTTOM.Text.CurrentBalance.height,
|
||||
COMPFONT, &sFontX, &sFontY, sString
|
||||
COMPFONT, &sFontX, &sFontY, sString.data()
|
||||
);
|
||||
|
||||
// print it
|
||||
mprintf( sFontX, sFontY, L"%s", sString );
|
||||
mprintf( sFontX, sFontY, L"%s", sString.data() );
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1667,7 +1663,7 @@ void DisplayProjectedDailyMineIncome( void )
|
||||
{
|
||||
INT32 iRate = 0;
|
||||
static INT32 iOldRate = -1;
|
||||
CHAR16 sString[ 128 ];
|
||||
std::wstring sString;
|
||||
INT16 sFontX, sFontY;
|
||||
|
||||
// grab the rate from the financial system
|
||||
@@ -1692,22 +1688,18 @@ void DisplayProjectedDailyMineIncome( void )
|
||||
SetFontForeground( 183 );
|
||||
SetFontBackground( FONT_BLACK );
|
||||
|
||||
swprintf( sString, L"%d", iRate );
|
||||
|
||||
// insert
|
||||
InsertCommasForDollarFigure( sString );
|
||||
InsertDollarSignInToString( sString );
|
||||
sString = FormatMoney( iRate );
|
||||
|
||||
VarFindFontCenterCoordinates(
|
||||
UI_BOTTOM.Text.CurrentIncome.x,
|
||||
UI_BOTTOM.Text.CurrentIncome.y,
|
||||
UI_BOTTOM.Text.CurrentIncome.width,
|
||||
UI_BOTTOM.Text.CurrentIncome.height,
|
||||
COMPFONT, &sFontX, &sFontY, sString
|
||||
COMPFONT, &sFontX, &sFontY, sString.data()
|
||||
);
|
||||
|
||||
// print it
|
||||
mprintf( sFontX, sFontY, L"%s", sString );
|
||||
mprintf( sFontX, sFontY, L"%s", sString.data() );
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1716,7 +1708,6 @@ void DisplayProjectedDailyExpenses( void )
|
||||
{
|
||||
INT32 iRate = 0;
|
||||
static INT32 iOldExpensesRate = -1;
|
||||
CHAR16 sString[ 128 ];
|
||||
INT16 sFontX, sFontY;
|
||||
|
||||
// grab the rate from the financial system
|
||||
@@ -1749,22 +1740,18 @@ void DisplayProjectedDailyExpenses( void )
|
||||
}
|
||||
SetFontBackground( FONT_BLACK );
|
||||
|
||||
swprintf( sString, L"%d", iRate );
|
||||
|
||||
// insert extra characters
|
||||
InsertCommasForDollarFigure( sString );
|
||||
InsertDollarSignInToString( sString );
|
||||
auto rate{FormatMoney(iRate)};
|
||||
|
||||
VarFindFontCenterCoordinates(
|
||||
UI_BOTTOM.Text.CurrentExpenses.x,
|
||||
UI_BOTTOM.Text.CurrentExpenses.y,
|
||||
UI_BOTTOM.Text.CurrentExpenses.width,
|
||||
UI_BOTTOM.Text.CurrentExpenses.height,
|
||||
COMPFONT, &sFontX, &sFontY, sString
|
||||
COMPFONT, &sFontX, &sFontY, rate.data()
|
||||
);
|
||||
|
||||
// print it
|
||||
mprintf( sFontX, sFontY, L"%s", sString );
|
||||
mprintf( sFontX, sFontY, L"%s", rate.data());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4378,9 +4378,7 @@ void DisplayDistancesForHelicopter( void )
|
||||
if( (INT32)uiTripCost > LaptopSaveInfo.iCurrentBalance )
|
||||
SetFontForeground( FONT_LTRED );
|
||||
|
||||
swprintf( sString, L"%d", uiTripCost );
|
||||
InsertCommasForDollarFigure( sString );
|
||||
InsertDollarSignInToString( sString );
|
||||
swprintf( sString, L"%s", FormatMoney(uiTripCost).data());
|
||||
FindFontRightCoordinates(UI_MAP.HeliETA.PopupBox.x + 5, ( INT16 ) (UI_MAP.HeliETA.PopupBox.y + 5 + 3 * GetFontHeight( MAP_FONT ) ), UI_MAP.HeliETA.PopupBox.width, 0, sString, MAP_FONT, &sX, &sY );
|
||||
mprintf( sX, ( INT16 ) ( sYPosition + 5 + 3 * GetFontHeight( MAP_FONT ) ), sString );
|
||||
|
||||
@@ -4857,9 +4855,7 @@ void BlitMineText( INT16 sMapX, INT16 sMapY )
|
||||
if (PlayerControlsMine(ubMineIndex) && !gMineStatus[ ubMineIndex ].fEmpty)
|
||||
{
|
||||
// show current production
|
||||
swprintf( wSubString, L"%d", PredictDailyIncomeFromAMine(ubMineIndex, TRUE) );
|
||||
InsertCommasForDollarFigure( wSubString );
|
||||
InsertDollarSignInToString( wSubString );
|
||||
swprintf( wSubString, L"%s", FormatMoney(PredictDailyIncomeFromAMine(ubMineIndex, TRUE)).data());
|
||||
wcscpy( wString, wSubString );
|
||||
|
||||
/*
|
||||
|
||||
@@ -549,20 +549,14 @@ void AddTextToMineBox( void )
|
||||
swprintf( wString, L"%s:", pwMineStrings[ 3 ]);
|
||||
AddMonoString( &hStringHandle, wString );
|
||||
|
||||
swprintf( wString, L"%d", PredictDailyIncomeFromAMine( ubMineIndex, TRUE ) );
|
||||
InsertCommasForDollarFigure( wString );
|
||||
InsertDollarSignInToString( wString );
|
||||
AddSecondColumnMonoString( &hStringHandle, wString );
|
||||
AddSecondColumnMonoString( &hStringHandle, FormatMoney(PredictDailyIncomeFromAMine(ubMineIndex, TRUE)).data() );
|
||||
|
||||
|
||||
// potential production
|
||||
swprintf( wString, L"%s:", pwMineStrings[ 4 ]);
|
||||
AddMonoString( &hStringHandle, wString );
|
||||
|
||||
swprintf( wString, L"%d", GetMaxDailyRemovalFromMine( ubMineIndex ) );
|
||||
InsertCommasForDollarFigure( wString );
|
||||
InsertDollarSignInToString( wString );
|
||||
AddSecondColumnMonoString( &hStringHandle, wString );
|
||||
AddSecondColumnMonoString( &hStringHandle, FormatMoney(GetMaxDailyRemovalFromMine(ubMineIndex)).data());
|
||||
|
||||
|
||||
// if potential is not nil
|
||||
@@ -616,9 +610,7 @@ void AddTextToMineBox( void )
|
||||
wcscpy( wString, L"Remaining (DEBUG):");
|
||||
AddMonoString( &hStringHandle, wString );
|
||||
|
||||
swprintf( wString, L"%d", GetTotalLeftInMine( ubMineIndex ) );
|
||||
InsertCommasForDollarFigure( wString );
|
||||
InsertDollarSignInToString( wString );
|
||||
swprintf( wString, L"%s", FormatMoney( GetTotalLeftInMine( ubMineIndex ) ).data() );
|
||||
AddSecondColumnMonoString( &hStringHandle, wString );
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6261,11 +6261,7 @@ BOOLEAN NotifyPlayerWhenEnemyTakesControlOfImportantSector( INT16 sSectorX, INT1
|
||||
iValue = GetProjectedTotalDailyIncome( );
|
||||
|
||||
// parse the string
|
||||
swprintf( sStringC, L"%d", iValue );
|
||||
|
||||
// insert
|
||||
InsertCommasForDollarFigure( sStringC );
|
||||
InsertDollarSignInToString( sStringC );
|
||||
swprintf( sStringC, L"%s", FormatMoney(iValue).data());
|
||||
|
||||
swprintf( sStringB, pMapErrorString[ 16 ], sString, sStringC );
|
||||
|
||||
|
||||
@@ -1518,16 +1518,8 @@ void HandleNotifyPlayerCantAffordInsurance( void )
|
||||
void HandleNotifyPlayerCanAffordInsurance( SOLDIERTYPE *pSoldier, UINT8 ubLength, INT32 iCost )
|
||||
{
|
||||
CHAR16 sString[ 128 ];
|
||||
CHAR16 sStringA[ 32 ];
|
||||
|
||||
//parse the cost
|
||||
swprintf( sStringA, L"%d",iCost );
|
||||
|
||||
// insert the commans and dollar sign
|
||||
InsertCommasForDollarFigure( sStringA );
|
||||
InsertDollarSignInToString( sStringA );
|
||||
|
||||
swprintf( sString, zMarksMapScreenText[ 10 ], pSoldier->GetName(), sStringA, ubLength );
|
||||
swprintf( sString, zMarksMapScreenText[ 10 ], pSoldier->GetName(), FormatMoney(iCost).data(), ubLength );
|
||||
|
||||
//Set the length to the global variable ( so we know how long the contract is in the callback )
|
||||
gubContractLength = ubLength;
|
||||
|
||||
@@ -318,15 +318,8 @@ void MercDailyUpdate()
|
||||
}
|
||||
else
|
||||
{
|
||||
CHAR16 zMoney[128];
|
||||
|
||||
//create a string for the salary owed to the npc
|
||||
swprintf( zMoney, L"%d", sSalary );
|
||||
InsertCommasForDollarFigure( zMoney );
|
||||
InsertDollarSignInToString( zMoney );
|
||||
|
||||
//Display a screen msg indicating that the npc was NOT paid
|
||||
ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, pMessageStrings[ MSG_CANT_AFFORD_TO_PAY_NPC_DAILY_SALARY_MSG ], gMercProfiles[ pSoldier->ubProfile ].zNickname, zMoney );
|
||||
ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, pMessageStrings[ MSG_CANT_AFFORD_TO_PAY_NPC_DAILY_SALARY_MSG ], gMercProfiles[ pSoldier->ubProfile ].zNickname, FormatMoney(sSalary).data() );
|
||||
|
||||
//if the merc hasnt been paid for NUM_DAYS_TILL_UNPAID_RPC_QUITS days, the merc will quit
|
||||
if( ( gMercProfiles[ pSoldier->ubProfile ].iBalance - sSalary ) <= -( sSalary * NUM_DAYS_TILL_UNPAID_RPC_QUITS ) )
|
||||
|
||||
+6
-12
@@ -3228,35 +3228,29 @@ void DrawCharacterInfo(INT16 sCharNumber)
|
||||
iDailyCost = gMercProfiles[ pSoldier->ubProfile ].sSalary;
|
||||
}
|
||||
|
||||
swprintf(sString, L"%d", iDailyCost );
|
||||
|
||||
// insert commas and dollar sign
|
||||
InsertCommasForDollarFigure( sString );
|
||||
InsertDollarSignInToString( sString );
|
||||
{
|
||||
auto tmpMoney{ FormatMoney(iDailyCost) };
|
||||
const auto x = UI_CHARPANEL.Text.Salary.x;
|
||||
const auto y = UI_CHARPANEL.Text.Salary.y;
|
||||
const auto w = UI_CHARPANEL.Text.Salary.width;
|
||||
const auto h = UI_CHARPANEL.Text.Salary.height;
|
||||
FindFontRightCoordinates(x, y, w, h, sString, CHAR_FONT, &usX, &usY);
|
||||
DrawString(sString, usX, usY, CHAR_FONT);
|
||||
FindFontRightCoordinates(x, y, w, h, tmpMoney.data(), CHAR_FONT, &usX, &usY);
|
||||
DrawString(tmpMoney.data(), usX, usY, CHAR_FONT);
|
||||
}
|
||||
|
||||
// medical deposit
|
||||
if( gMercProfiles[ gCharactersList[ sCharNumber ].usSolID->ubProfile ].sMedicalDepositAmount > 0 )
|
||||
{
|
||||
swprintf(sString, L"%d", gMercProfiles[ gCharactersList[ sCharNumber ].usSolID->ubProfile ].sMedicalDepositAmount );
|
||||
auto tmpMoney{ FormatMoney(gMercProfiles[gCharactersList[sCharNumber].usSolID->ubProfile].sMedicalDepositAmount) };
|
||||
|
||||
// insert commas and dollar sign
|
||||
InsertCommasForDollarFigure( sString );
|
||||
InsertDollarSignInToString( sString );
|
||||
{
|
||||
const auto x = UI_CHARPANEL.Text.Medical.x;
|
||||
const auto y = UI_CHARPANEL.Text.Medical.y;
|
||||
const auto w = UI_CHARPANEL.Text.Medical.width;
|
||||
const auto h = UI_CHARPANEL.Text.Medical.height;
|
||||
FindFontRightCoordinates(x, y, w, h, sString, CHAR_FONT, &usX, &usY);
|
||||
DrawString(sString, usX, y, CHAR_FONT);
|
||||
FindFontRightCoordinates(x, y, w, h, tmpMoney.data(), CHAR_FONT, &usX, &usY);
|
||||
DrawString(tmpMoney.data(), usX, y, CHAR_FONT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user