NEW_ORDERS are now only supported, old code removed.

This commit is contained in:
johns 2001-03-26 00:05:28 +00:00
parent 3a2d4a75d4
commit 6ddfc14397
4 changed files with 6 additions and 164 deletions

View file

@ -34,7 +34,6 @@
#define noUSE_SDLA /// Remove no for sdl audio support
#define noUSE_X11 /// Remove no for x11 support
#define noUSE_SVGALIB /// Remove no for svgalib support
#define NEW_ORDERS /// New orders are now forced
/**
** Define this to support load of compressed (gzip) pud files

View file

@ -401,7 +401,6 @@ global void DrawButtonPanel(void)
// with the buttons.
//
if( NumSelected==1 ) {
#ifdef NEW_ORDERS
switch( buttons[i].Action ) {
case ButtonStop:
if( Selected[0]->Orders[0].Action==UnitActionStill ) {
@ -437,7 +436,8 @@ global void DrawButtonPanel(void)
}
break;
case ButtonDemolish:
if( Selected[0]->Orders[0].Action==UnitActionDemolish ) {
if( Selected[0]->Orders[0].Action
==UnitActionDemolish ) {
v=IconSelected;
}
break;
@ -453,47 +453,6 @@ global void DrawButtonPanel(void)
default:
break;
}
#else
switch( buttons[i].Action ) {
case ButtonStop:
if( Selected[0]->Command.Action==UnitActionStill ) {
v=IconSelected;
}
break;
case ButtonStandGround:
if( Selected[0]->Command.Action
==UnitActionStandGround ) {
v=IconSelected;
}
break;
case ButtonMove:
if( Selected[0]->Command.Action==UnitActionMove ) {
v=IconSelected;
}
break;
case ButtonAttack:
if( Selected[0]->Command.Action==UnitActionAttack ) {
v=IconSelected;
}
break;
case ButtonDemolish:
if( Selected[0]->Command.Action==UnitActionDemolish ) {
v=IconSelected;
}
break;
case ButtonAttackGround:
if( Selected[0]->Command.Action
==UnitActionAttackGround ) {
v=IconSelected;
}
break;
// FIXME: must handle more actions
default:
break;
}
#endif
}
DrawUnitIcon(ThisPlayer,buttons[i].Icon.Icon
@ -694,7 +653,6 @@ global void UpdateButtonPanel(void)
//
// FIXME: johns: some hacks for cancel buttons
//
#ifdef NEW_ORDERS
if( unit->Orders[0].Action==UnitActionBuilded ) {
// Trick 17 to get the cancel-build button
strcpy(unit_ident,",cancel-build,");
@ -707,25 +665,11 @@ global void UpdateButtonPanel(void)
} 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,");
} else if( unit->Command.Action==UnitActionUpgradeTo ) {
// Trick 17 to get the cancel-upgrade button
strcpy(unit_ident,",cancel-upgrade,");
} else if( unit->Command.Action==UnitActionResearch ) {
// Trick 17 to get the cancel-upgrade button
strcpy(unit_ident,",cancel-upgrade,");
} 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
// i.e. if button action is ButtonTrain for example check if required
// unit is not restricted etc...
// i.e. if button action is ButtonTrain for example check if
// required unit is not restricted etc...
buttonaction=UnitButtonTable[z];
@ -901,19 +845,11 @@ global void DoButtonButtonClicked(int button)
case ButtonCancel:
case ButtonCancelUpgrade:
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();
@ -926,13 +862,8 @@ global void DoButtonButtonClicked(int button)
break;
case ButtonCancelTrain:
#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();
@ -942,11 +873,7 @@ global void DoButtonButtonClicked(int button)
// FIXME: johns is this not sure, only building should have this?
if( NumSelected==1 && Selected[0]->Type->Building ) {
SendCommandCancelBuilding(Selected[0],
#ifdef NEW_ORDERS
Selected[0]->Data.Builded.Worker);
#else
Selected[0]->Command.Data.Builded.Worker);
#endif
}
ClearStatusLine();
ClearCosts();
@ -972,13 +899,8 @@ global void DoButtonButtonClicked(int button)
// FIXME: Johns: I want to place commands in queue, even if not
// FIXME: enough resources are available.
// FIXME: training queue full check is not correct for network.
#ifdef NEW_ORDERS
if( Selected[0]->Orders[0].Action==UnitActionTrain
&& Selected[0]->Data.Train.Count==MAX_UNIT_TRAIN ) {
#else
if( Selected[0]->Command.Action==UnitActionTrain
&& Selected[0]->Command.Data.Train.Count==MAX_UNIT_TRAIN ) {
#endif
SetMessage( "Unit training queue is full" );
} else if( PlayerCheckFood(ThisPlayer,type)
&& !PlayerCheckUnitType(ThisPlayer,type) ) {

View file

@ -44,10 +44,6 @@
-- Defines
----------------------------------------------------------------------------*/
#ifdef NEW_ORDERS
#define Command Orders[0]
#endif
// FIXME: should become global configurable
#define OriginalTraining 0 /// 1 for the original training display
@ -209,7 +205,6 @@ global void DrawUnitInfo(const Unit* unit)
//
// Show progress for buildings only, if they are selected.
//
#ifdef NEW_ORDERS
if( type->Building && NumSelected==1 && Selected[0]==unit ) {
//
// Building under constuction.
@ -282,67 +277,6 @@ global void DrawUnitInfo(const Unit* unit)
return;
}
}
#else
if( type->Building && NumSelected==1 && Selected[0]==unit ) {
if( unit->Command.Action==UnitActionBuilded ) {
// FIXME: not correct must use build time!!
DrawCompleted(stats->HitPoints,unit->HP);
return;
}
if( unit->Command.Action==UnitActionTrain ) {
if( OriginalTraining || unit->Command.Data.Train.Count==1 ) {
DrawText(x+37,y+8+78,GameFont,"Training:");
DrawUnitIcon(unit->Player
,unit->Command.Data.Train.What[0]->Icon.Icon
,0,x+107,y+8+70);
DrawCompleted(
unit->Command.Data.Train.What[0]
->Stats[unit->Player->Player].Costs[TimeCost]
,unit->Command.Data.Train.Ticks);
} else {
DrawTextCentered(x+114,y+8+29,GameFont,"Training...");
for( i = 0; i < unit->Command.Data.Train.Count; i++ ) {
DrawUnitIcon(unit->Player
,unit->Command.Data.Train.What[i]->Icon.Icon
,(ButtonUnderCursor==i+4)
? (IconActive|(MouseButtons&LeftButton)) : 0
,TheUI.Buttons2[i].X,TheUI.Buttons2[i].Y);
}
DrawCompleted(
unit->Command.Data.Train.What[0]
->Stats[unit->Player->Player].Costs[TimeCost]
,unit->Command.Data.Train.Ticks);
}
return;
}
if( unit->Command.Action==UnitActionUpgradeTo ) {
DrawText(x+29,y+8+78,GameFont,"Upgrading:");
DrawUnitIcon(unit->Player
,unit->Command.Data.UpgradeTo.What->Icon.Icon
,0,x+107,y+8+70);
DrawCompleted(
unit->Command.Data.UpgradeTo.What
->Stats[unit->Player->Player].Costs[TimeCost]
,unit->Command.Data.UpgradeTo.Ticks);
return;
}
if( unit->Command.Action==UnitActionResearch ) {
DrawText(16,y+8+78,GameFont,"Researching:");
DrawUnitIcon(unit->Player
,unit->Command.Data.Research.What->Icon
,0,x+107,y+8+70);
DrawCompleted(
unit->Command.Data.Research.What->Costs[TimeCost]
,unit->Command.Data.Research.Ticks);
return;
}
}
#endif
if( type->StoresWood ) {
DrawText(x+20,y+8+78,GameFont,"Production");
@ -463,7 +397,7 @@ global void DrawUnitInfo(const Unit* unit)
DrawStats(x+108,y+8+125,stats->Speed,type->_Speed);
// Show how much wood is harvested already in percents! :) //vladi
if( unit->Command.Action==UnitActionHarvest && unit->SubAction==64 ) {
if( unit->Orders[0].Action==UnitActionHarvest && unit->SubAction==64 ) {
sprintf(buf,"W%%:%d"
,(100*(CHOP_FOR_WOOD-unit->Value))/CHOP_FOR_WOOD);
DrawText(x+120,y+8+140,GameFont,buf);
@ -966,19 +900,10 @@ global void DrawInfoPanel(void)
} else {
// FIXME: not correct for enemies units
if( Selected[0]->Type->Building
#ifdef NEW_ORDERS
&& (Selected[0]->Orders[0].Action==UnitActionBuilded
|| Selected[0]->Orders[0].Action==UnitActionResearch
|| Selected[0]->Orders[0].Action==UnitActionUpgradeTo
/* || Selected[0]->Orders[0].Action==UnitActionUpgrade */
|| Selected[0]->Orders[0].Action==UnitActionTrain) ) {
#else
&& (Selected[0]->Command.Action==UnitActionBuilded
|| Selected[0]->Command.Action==UnitActionResearch
|| Selected[0]->Command.Action==UnitActionUpgradeTo
/* || Selected[0]->Command.Action==UnitActionUpgrade */
|| Selected[0]->Command.Action==UnitActionTrain) ) {
#endif
i=3;
} else if( Selected[0]->Type->Magic ) {
i=2;

View file

@ -1173,12 +1173,8 @@ global void UIHandleButtonUp(int b)
// Other clicks.
//
if( NumSelected==1 ) {
#ifdef NEW_ORDERS
if( Selected[0]->Orders[0].Action==UnitActionBuilded ) {
#else
if( Selected[0]->Command.Action==UnitActionBuilded ) {
#endif
//if( Selected[0]->Constructed )
// FIXME: if( Selected[0]->Constructed )
PlayUnitSound(Selected[0],VoiceBuilding);
} else if( Selected[0]->Burning ) {
// FIXME: use GameSounds.Burning