Prepared NEW_ORDERS.
This commit is contained in:
parent
5e1e812888
commit
222dc883d7
1 changed files with 71 additions and 1 deletions
|
@ -244,6 +244,47 @@ global void DrawButtonPanel(void)
|
|||
// with the buttons.
|
||||
//
|
||||
if( NumSelected==1 ) {
|
||||
#ifdef NEW_ORDERS
|
||||
switch( buttons[i].Action ) {
|
||||
case B_Stop:
|
||||
if( Selected[0]->Orders[0].Action==UnitActionStill ) {
|
||||
v=IconSelected;
|
||||
}
|
||||
break;
|
||||
case B_StandGround:
|
||||
if( Selected[0]->Orders[0].Action
|
||||
==UnitActionStandGround ) {
|
||||
v=IconSelected;
|
||||
}
|
||||
break;
|
||||
case B_Move:
|
||||
if( Selected[0]->Orders[0].Action==UnitActionMove ) {
|
||||
v=IconSelected;
|
||||
}
|
||||
break;
|
||||
case B_Attack:
|
||||
if( Selected[0]->Orders[0].Action==UnitActionAttack ) {
|
||||
v=IconSelected;
|
||||
}
|
||||
break;
|
||||
case B_Demolish:
|
||||
if( Selected[0]->Orders[0].Action==UnitActionDemolish ) {
|
||||
v=IconSelected;
|
||||
}
|
||||
break;
|
||||
case B_AttackGround:
|
||||
if( Selected[0]->Orders[0].Action
|
||||
==UnitActionAttackGround ) {
|
||||
v=IconSelected;
|
||||
}
|
||||
break;
|
||||
|
||||
// FIXME: must handle more actions
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
switch( buttons[i].Action ) {
|
||||
case B_Stop:
|
||||
if( Selected[0]->Command.Action==UnitActionStill ) {
|
||||
|
@ -283,6 +324,7 @@ global void DrawButtonPanel(void)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
DrawUnitIcon(ThisPlayer,buttons[i].Icon.Icon
|
||||
|
@ -484,6 +526,20 @@ global void UpdateButtonPanel(void)
|
|||
strcpy(unit_ident,",cancel-build,");
|
||||
// FIXME: johns: my ->Constructed didn't seem ok. if (unit->Constructed)
|
||||
} else */
|
||||
#ifdef NEW_ORDERS
|
||||
if( unit->Orders[0].Action==UnitActionBuilded ) {
|
||||
// Trick 17 to get the cancel-build button
|
||||
strcpy(unit_ident,",cancel-build,");
|
||||
} else if( unit->Orders[0].Action==UnitActionUpgradeTo ) {
|
||||
// Trick 17 to get the cancel-upgrade button
|
||||
strcpy(unit_ident,",cancel-upgrade,");
|
||||
} else if( unit->Orders[0].Action==UnitActionResearch ) {
|
||||
// Trick 17 to get the cancel-upgrade button
|
||||
strcpy(unit_ident,",cancel-upgrade,");
|
||||
} else {
|
||||
sprintf(unit_ident, ",%s,", unit->Type->Ident);
|
||||
}
|
||||
#else
|
||||
if( unit->Command.Action==UnitActionBuilded ) {
|
||||
// Trick 17 to get the cancel-build button
|
||||
strcpy(unit_ident,",cancel-build,");
|
||||
|
@ -496,6 +552,7 @@ global void UpdateButtonPanel(void)
|
|||
} else {
|
||||
sprintf(unit_ident, ",%s,", unit->Type->Ident);
|
||||
}
|
||||
#endif
|
||||
|
||||
for( z = 0; z < UnitButtonCount; z++ ) {
|
||||
//FIXME: we have to check and if these unit buttons are available
|
||||
|
@ -655,11 +712,19 @@ global void DoButtonButtonClicked(int button)
|
|||
|
||||
case B_Cancel:
|
||||
if ( NumSelected==1 && Selected[0]->Type->Building ) {
|
||||
#ifdef NEW_ORDERS
|
||||
if( Selected[0]->Orders[0].Action==UnitActionUpgradeTo ) {
|
||||
SendCommandCancelUpgradeTo(Selected[0]);
|
||||
} else if( Selected[0]->Orders[0].Action==UnitActionResearch ) {
|
||||
SendCommandCancelResearch(Selected[0]);
|
||||
}
|
||||
#else
|
||||
if( Selected[0]->Command.Action == UnitActionUpgradeTo ) {
|
||||
SendCommandCancelUpgradeTo(Selected[0]);
|
||||
} else if( Selected[0]->Command.Action == UnitActionResearch ) {
|
||||
SendCommandCancelResearch(Selected[0]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ClearStatusLine();
|
||||
ClearCosts();
|
||||
|
@ -672,8 +737,13 @@ global void DoButtonButtonClicked(int button)
|
|||
break;
|
||||
|
||||
case B_CancelTrain:
|
||||
#ifdef NEW_ORDERS
|
||||
DebugCheck( Selected[0]->Orders[0].Action!=UnitActionTrain
|
||||
|| !Selected[0]->Data.Train.Count );
|
||||
#else
|
||||
DebugCheck( Selected[0]->Command.Action!=UnitActionTrain
|
||||
|| !Selected[0]->Command.Data.Train.Count );
|
||||
#endif
|
||||
SendCommandCancelTraining(Selected[0],0);
|
||||
ClearStatusLine();
|
||||
ClearCosts();
|
||||
|
@ -712,7 +782,7 @@ global void DoButtonButtonClicked(int button)
|
|||
// FIXME: enough resources are available.
|
||||
// FIXME: training queue full check is not correct for network.
|
||||
#ifdef NEW_ORDERS
|
||||
if( Selected[0]->Command.Action==UnitActionTrain
|
||||
if( Selected[0]->Orders[0].Action==UnitActionTrain
|
||||
&& Selected[0]->Data.Train.Count==MAX_UNIT_TRAIN ) {
|
||||
#else
|
||||
if( Selected[0]->Command.Action==UnitActionTrain
|
||||
|
|
Loading…
Add table
Reference in a new issue