refactor UpDateStateOfStartButton

This commit is contained in:
Marco Antonio J. Costa
2025-10-07 23:09:53 -03:00
committed by majcosta
parent 0ebcf0fa06
commit 3d95c47356
+2 -15
View File
@@ -5998,19 +5998,14 @@ void UpDateStateOfStartButton( void )
ButtonList[giPersonnelATMStartButton[gubPersonnelInfoState]]->uiFlags |= BUTTON_CLICKED_ON; ButtonList[giPersonnelATMStartButton[gubPersonnelInfoState]]->uiFlags |= BUTTON_CLICKED_ON;
// if in current mercs and the currently selected guy is valid, enable button, else disable it // if in current mercs and the currently selected guy is valid, enable button, else disable it
if (fCurrentTeamMode) if (fCurrentTeamMode && currentTeamIndex != -1)
{
// is the current guy valid
if (currentTeamIndex != -1)
{ {
for ( int i = 0; i < PERSONNEL_NUM_BTN; ++i ) for ( int i = 0; i < PERSONNEL_NUM_BTN; ++i )
EnableButton( giPersonnelATMStartButton[ i ] ); EnableButton( giPersonnelATMStartButton[ i ] );
SoldierID iId = currentTeamList[currentTeamIndex]; SoldierID iId = currentTeamList[currentTeamIndex];
if (iId != NOBODY) if (iId != NOBODY && iId->bAssignment == ASSIGNMENT_POW )
{
if ( iId->bAssignment == ASSIGNMENT_POW )
{ {
DisableButton( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ); DisableButton( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] );
@@ -6021,14 +6016,6 @@ void UpDateStateOfStartButton( void )
} }
} }
} }
}
else
{
// not valid, disable
for ( int i = 0; i < PERSONNEL_NUM_BTN; ++i )
DisableButton( giPersonnelATMStartButton[ i ] );
}
}
else else
{ {
// disable button // disable button