else if( command && (command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_CONSTRUCT
|| command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT) )
{
//We're using the build placement interface to determine where to build our special power item.
//Because of that, we only care about DO_COMMAND. The context evaluation and hint feedback system
//is already taken care of. But what we need to do is trigger the special power to actually build
//the object and reset the timer.
if( type == DO_COMMAND )
{
switch( command->getCommandType() )
{
case GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT:
{
Object* unit = ThePlayerList->getLocalPlayer()->findMostReadyShortcutSpecialPowerOfType( command->getSpecialPowerTemplate()->getSpecialPowerType() );
if( unit )
msgType = issueSpecialPowerCommand( command, type, draw, pos, unit );
break;
}
case GUI_COMMAND_SPECIAL_POWER://lorenzen
msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr );
break;
}
}
}
The outer else if only enters this block when commandType is GUI_COMMAND_SPECIAL_POWER_CONSTRUCT or GUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT, but the inner switch tests the same value against GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT and GUI_COMMAND_SPECIAL_POWER — entirely different enum values. No case will ever match, so issueSpecialPowerCommand is never called and the command silently does nothing. The case labels should be GUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT and GUI_COMMAND_SPECIAL_POWER_CONSTRUCT respectively. Note: the identical pattern exists in GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp (line 1799), so the same bug is present in the Zero Hour build as well.
The outer
else ifonly enters this block whencommandTypeisGUI_COMMAND_SPECIAL_POWER_CONSTRUCTorGUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT, but the innerswitchtests the same value againstGUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUTandGUI_COMMAND_SPECIAL_POWER— entirely different enum values. No case will ever match, soissueSpecialPowerCommandis never called and the command silently does nothing. The case labels should beGUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUTandGUI_COMMAND_SPECIAL_POWER_CONSTRUCTrespectively. Note: the identical pattern exists inGeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp(line 1799), so the same bug is present in the Zero Hour build as well.