mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Convert to SoldierID
This commit is contained in:
@@ -166,8 +166,8 @@ void InsuranceContractUserTextFieldCallBack( UINT8 ubID, BOOLEAN fEntering );
|
|||||||
INT8 CountInsurableMercs();
|
INT8 CountInsurableMercs();
|
||||||
void DisableInsuranceContractNextPreviousbuttons();
|
void DisableInsuranceContractNextPreviousbuttons();
|
||||||
void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate);
|
void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate);
|
||||||
void HandleAcceptButton( UINT16 ubSoldierID, UINT8 ubFormID );
|
void HandleAcceptButton( SoldierID ubSoldierID, UINT8 ubFormID );
|
||||||
FLOAT DiffFromNormRatio( INT16 sThisValue, INT16 sNormalValue );
|
FLOAT DiffFromNormRatio( INT16 sThisValue, INT16 sNormalValue );
|
||||||
void InsContractNoMercsPopupCallBack( UINT8 bExitValue );
|
void InsContractNoMercsPopupCallBack( UINT8 bExitValue );
|
||||||
void BuildInsuranceArray();
|
void BuildInsuranceArray();
|
||||||
BOOLEAN MercIsInsurable( SOLDIERTYPE *pSoldier );
|
BOOLEAN MercIsInsurable( SOLDIERTYPE *pSoldier );
|
||||||
@@ -177,8 +177,8 @@ UINT32 GetTimeRemainingOnSoldiersContract( SOLDIERTYPE *pSoldier );
|
|||||||
UINT32 GetTimeRemainingOnSoldiersInsuranceContract( SOLDIERTYPE *pSoldier );
|
UINT32 GetTimeRemainingOnSoldiersInsuranceContract( SOLDIERTYPE *pSoldier );
|
||||||
void EnableDisableIndividualInsuranceContractButton( UINT8 ubMercIDForMercInForm1, UINT32 *puiAcceptButton );
|
void EnableDisableIndividualInsuranceContractButton( UINT8 ubMercIDForMercInForm1, UINT32 *puiAcceptButton );
|
||||||
BOOLEAN CanSoldierExtendInsuranceContract( SOLDIERTYPE *pSoldier );
|
BOOLEAN CanSoldierExtendInsuranceContract( SOLDIERTYPE *pSoldier );
|
||||||
INT32 CalculateSoldiersInsuranceContractLength( SOLDIERTYPE *pSoldier );
|
INT32 CalculateSoldiersInsuranceContractLength( SOLDIERTYPE *pSoldier );
|
||||||
INT32 CalcStartDayOfInsurance( SOLDIERTYPE *pSoldier );
|
INT32 CalcStartDayOfInsurance( SOLDIERTYPE *pSoldier );
|
||||||
|
|
||||||
BOOLEAN AreAnyAimMercsOnTeam( );
|
BOOLEAN AreAnyAimMercsOnTeam( );
|
||||||
//ppp
|
//ppp
|
||||||
@@ -394,12 +394,14 @@ void RenderInsuranceContract()
|
|||||||
{
|
{
|
||||||
sMercID = gubInsuranceMercArray[ sNextMercID ];
|
sMercID = gubInsuranceMercArray[ sNextMercID ];
|
||||||
|
|
||||||
pSoldier = &Menptr[ GetSoldierIDFromMercID( (UINT8) sMercID ) ];
|
SoldierID ID = GetSoldierIDFromMercID( sMercID );
|
||||||
|
if ( ID != NOBODY )
|
||||||
if( ( sMercID != -1 ) && MercIsInsurable( pSoldier ) )
|
|
||||||
{
|
{
|
||||||
DisplayOrderGrid( ubCount, (UINT8)sMercID );
|
if( ( sMercID != -1 ) && MercIsInsurable( ID ) )
|
||||||
ubCount++;
|
{
|
||||||
|
DisplayOrderGrid( ubCount, (UINT8)sMercID );
|
||||||
|
ubCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sNextMercID++;
|
sNextMercID++;
|
||||||
@@ -499,18 +501,22 @@ void BtnInsContractNextButtonCallBack(GUI_BUTTON *btn,INT32 reason)
|
|||||||
|
|
||||||
BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID )
|
BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID )
|
||||||
{
|
{
|
||||||
VOBJECT_DESC VObjectDesc;
|
VOBJECT_DESC VObjectDesc;
|
||||||
HVOBJECT hPixHandle;
|
HVOBJECT hPixHandle;
|
||||||
UINT16 usPosX, usPosY;
|
UINT16 usPosX, usPosY;
|
||||||
UINT32 uiInsMercFaceImage;
|
UINT32 uiInsMercFaceImage;
|
||||||
INT32 iCostOfContract=0;
|
INT32 iCostOfContract=0;
|
||||||
char sTemp[100];
|
char sTemp[100];
|
||||||
CHAR16 sText[800];
|
CHAR16 sText[800];
|
||||||
BOOLEAN fDisplayMercContractStateTextColorInRed = FALSE;
|
BOOLEAN fDisplayMercContractStateTextColorInRed = FALSE;
|
||||||
|
SoldierID usID = GetSoldierIDFromMercID( ubMercID );
|
||||||
SOLDIERTYPE *pSoldier = &Menptr[ GetSoldierIDFromMercID( ubMercID ) ];
|
|
||||||
|
|
||||||
|
if ( usID == NOBODY )
|
||||||
|
{
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
SOLDIERTYPE *pSoldier = usID;
|
||||||
usPosX=usPosY=0;
|
usPosX=usPosY=0;
|
||||||
|
|
||||||
switch( ubGridNumber )
|
switch( ubGridNumber )
|
||||||
@@ -747,8 +753,8 @@ void BtnInsuranceAcceptClearForm1ButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
{
|
{
|
||||||
if (btn->uiFlags & BUTTON_CLICKED_ON)
|
if (btn->uiFlags & BUTTON_CLICKED_ON)
|
||||||
{
|
{
|
||||||
UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 );
|
UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 );
|
||||||
INT16 ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm1 );
|
SoldierID ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm1 );
|
||||||
|
|
||||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||||
|
|
||||||
@@ -759,7 +765,7 @@ void BtnInsuranceAcceptClearForm1ButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
HandleAcceptButton( ubSoldierID, 1 );
|
HandleAcceptButton( ubSoldierID, 1 );
|
||||||
|
|
||||||
//specify the length of the insurance contract
|
//specify the length of the insurance contract
|
||||||
Menptr[ ubSoldierID ].iTotalLengthOfInsuranceContract = gsForm1InsuranceLengthNumber;
|
ubSoldierID->iTotalLengthOfInsuranceContract = gsForm1InsuranceLengthNumber;
|
||||||
|
|
||||||
//reset the insurance length
|
//reset the insurance length
|
||||||
gsForm1InsuranceLengthNumber = 0;
|
gsForm1InsuranceLengthNumber = 0;
|
||||||
@@ -791,8 +797,8 @@ void BtnInsuranceAcceptClearForm2ButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
{
|
{
|
||||||
if (btn->uiFlags & BUTTON_CLICKED_ON)
|
if (btn->uiFlags & BUTTON_CLICKED_ON)
|
||||||
{
|
{
|
||||||
UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 );
|
UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 );
|
||||||
INT16 ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm2 );
|
SoldierID ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm2 );
|
||||||
|
|
||||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||||
|
|
||||||
@@ -803,7 +809,7 @@ void BtnInsuranceAcceptClearForm2ButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
HandleAcceptButton( ubSoldierID, 2 );
|
HandleAcceptButton( ubSoldierID, 2 );
|
||||||
|
|
||||||
//specify the length of the insurance contract
|
//specify the length of the insurance contract
|
||||||
Menptr[ ubSoldierID ].iTotalLengthOfInsuranceContract = gsForm2InsuranceLengthNumber;
|
ubSoldierID->iTotalLengthOfInsuranceContract = gsForm2InsuranceLengthNumber;
|
||||||
|
|
||||||
//reset the insurance length
|
//reset the insurance length
|
||||||
gsForm2InsuranceLengthNumber = 0;
|
gsForm2InsuranceLengthNumber = 0;
|
||||||
@@ -836,8 +842,8 @@ void BtnInsuranceAcceptClearForm3ButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
{
|
{
|
||||||
if (btn->uiFlags & BUTTON_CLICKED_ON)
|
if (btn->uiFlags & BUTTON_CLICKED_ON)
|
||||||
{
|
{
|
||||||
UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 );
|
UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 );
|
||||||
INT16 ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm3 );
|
SoldierID ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm3 );
|
||||||
|
|
||||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||||
|
|
||||||
@@ -848,7 +854,7 @@ void BtnInsuranceAcceptClearForm3ButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
HandleAcceptButton( ubSoldierID, 3 );
|
HandleAcceptButton( ubSoldierID, 3 );
|
||||||
|
|
||||||
//specify the length of the insurance contract
|
//specify the length of the insurance contract
|
||||||
Menptr[ ubSoldierID ].iTotalLengthOfInsuranceContract = gsForm3InsuranceLengthNumber;
|
ubSoldierID->iTotalLengthOfInsuranceContract = gsForm3InsuranceLengthNumber;
|
||||||
|
|
||||||
//reset the insurance length
|
//reset the insurance length
|
||||||
gsForm3InsuranceLengthNumber = 0;
|
gsForm3InsuranceLengthNumber = 0;
|
||||||
@@ -1067,12 +1073,12 @@ void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HandleAcceptButton( UINT16 ubSoldierID, UINT8 ubFormID )
|
void HandleAcceptButton( SoldierID ubSoldierID, UINT8 ubFormID )
|
||||||
{
|
{
|
||||||
//passed in either 1,2,3 should be 0,1,2
|
//passed in either 1,2,3 should be 0,1,2
|
||||||
ubFormID--;
|
ubFormID--;
|
||||||
|
|
||||||
PurchaseOrExtendInsuranceForSoldier( &Menptr[ ubSoldierID ], CalculateSoldiersInsuranceContractLength( &Menptr[ ubSoldierID ] ) );
|
PurchaseOrExtendInsuranceForSoldier( ubSoldierID, CalculateSoldiersInsuranceContractLength( ubSoldierID ) );
|
||||||
|
|
||||||
RenderInsuranceContract();
|
RenderInsuranceContract();
|
||||||
}
|
}
|
||||||
@@ -1139,7 +1145,7 @@ INT32 CalculateInsuranceContractCost( INT32 iLength, UINT8 ubMercID )
|
|||||||
SOLDIERTYPE *pSoldier;
|
SOLDIERTYPE *pSoldier;
|
||||||
|
|
||||||
|
|
||||||
pSoldier = &Menptr[ GetSoldierIDFromMercID( ubMercID ) ];
|
pSoldier = GetSoldierIDFromMercID( ubMercID );
|
||||||
|
|
||||||
|
|
||||||
// only mercs with at least 2 days to go on their employment contract are insurable
|
// only mercs with at least 2 days to go on their employment contract are insurable
|
||||||
@@ -1458,7 +1464,7 @@ void EndInsuranceInvestigation( UINT16 ubPayoutID )
|
|||||||
void InsuranceContractPayLifeInsuranceForDeadMerc( UINT16 ubPayoutID )
|
void InsuranceContractPayLifeInsuranceForDeadMerc( UINT16 ubPayoutID )
|
||||||
{
|
{
|
||||||
//if the mercs id number is the same what is in the soldier array
|
//if the mercs id number is the same what is in the soldier array
|
||||||
if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID == Menptr[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID ].ubID )
|
if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID == LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID->ubID )
|
||||||
{
|
{
|
||||||
// and if the soldier is still active ( player hasn't removed carcass yet ), reset insurance flag
|
// and if the soldier is still active ( player hasn't removed carcass yet ), reset insurance flag
|
||||||
if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID->bActive )
|
if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID->bActive )
|
||||||
@@ -1552,14 +1558,12 @@ void EnableDisableInsuranceContractAcceptButtons()
|
|||||||
|
|
||||||
void EnableDisableIndividualInsuranceContractButton( UINT8 ubMercIDForMercInForm, UINT32 *puiAcceptButton )
|
void EnableDisableIndividualInsuranceContractButton( UINT8 ubMercIDForMercInForm, UINT32 *puiAcceptButton )
|
||||||
{
|
{
|
||||||
INT16 sSoldierID = 0;
|
SoldierID sSoldierID = GetSoldierIDFromMercID( ubMercIDForMercInForm );
|
||||||
|
if( sSoldierID == NOBODY)
|
||||||
sSoldierID = GetSoldierIDFromMercID( ubMercIDForMercInForm );
|
|
||||||
if( sSoldierID == - 1)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if the soldiers contract can be extended, enable the button
|
// if the soldiers contract can be extended, enable the button
|
||||||
if( CanSoldierExtendInsuranceContract( &Menptr[ sSoldierID ] ) )
|
if( CanSoldierExtendInsuranceContract( sSoldierID ) )
|
||||||
EnableButton( *puiAcceptButton );
|
EnableButton( *puiAcceptButton );
|
||||||
|
|
||||||
// else the soldier cant extend their insurance contract, disable the button
|
// else the soldier cant extend their insurance contract, disable the button
|
||||||
|
|||||||
Reference in New Issue
Block a user