|
27 | 27 |
|
28 | 28 | #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine |
29 | 29 |
|
| 30 | +#include "Common/BuildAssistant.h" |
30 | 31 | #include "Common/GameAudio.h" |
31 | 32 | #include "Common/Player.h" |
32 | 33 | #include "Common/PlayerList.h" |
| 34 | +#include "Common/SpecialPower.h" |
33 | 35 | #include "Common/ThingTemplate.h" |
34 | | -#include "Common/BuildAssistant.h" |
35 | | - |
36 | | -#include "GameLogic/Object.h" |
37 | | -#include "GameLogic/GameLogic.h" |
38 | 36 |
|
39 | 37 | #include "GameClient/CommandXlat.h" |
40 | | -#include "GameClient/PlaceEventTranslator.h" |
| 38 | +#include "GameClient/ControlBar.h" |
41 | 39 | #include "GameClient/Drawable.h" |
42 | 40 | #include "GameClient/Eva.h" |
| 41 | +#include "GameClient/PlaceEventTranslator.h" |
| 42 | + |
| 43 | +#include "GameLogic/GameLogic.h" |
| 44 | +#include "GameLogic/Object.h" |
| 45 | + |
| 46 | +#include "GameLogic/Module/ProductionUpdate.h" |
| 47 | + |
| 48 | + |
43 | 49 |
|
44 | 50 | //------------------------------------------------------------------------------------------------- |
45 | 51 | PlaceEventTranslator::PlaceEventTranslator() : m_frameOfUpButton(-1) |
@@ -218,13 +224,42 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess |
218 | 224 | BuildAssistant::TERRAIN_RESTRICTIONS | |
219 | 225 | BuildAssistant::CLEAR_PATH | |
220 | 226 | BuildAssistant::NO_OBJECT_OVERLAP | |
221 | | - BuildAssistant::SHROUD_REVEALED, |
| 227 | + BuildAssistant::SHROUD_REVEALED | |
| 228 | + BuildAssistant::IGNORE_STEALTHED | |
| 229 | + BuildAssistant::FAIL_STEALTHED_WITHOUT_FEEDBACK, |
222 | 230 | builderObj, nullptr ); |
223 | 231 | if( lbc == LBC_OK ) |
224 | 232 | { |
225 | | - |
226 | | - /** @todo Do not send local player id as argument once we have player ids |
227 | | - tied into all messages automatically */ |
| 233 | + //Are we building this structure via the special power system? (special case for sneak attack) |
| 234 | + if( builderObj ) |
| 235 | + { |
| 236 | + ProductionUpdateInterface *puInterface = builderObj->getProductionUpdateInterface(); |
| 237 | + if( puInterface ) |
| 238 | + { |
| 239 | + const CommandButton *commandButton = puInterface->getSpecialPowerConstructionCommandButton(); |
| 240 | + if( commandButton ) |
| 241 | + { |
| 242 | + //If we get this far, then we aren't going to really build the object using the production update |
| 243 | + //interface. Instead, we're going to trigger the special power to create it magically without a |
| 244 | + //dozer/worker. |
| 245 | + placeMsg = TheMessageStream->appendMessage( GameMessage::MSG_DO_SPECIAL_POWER_AT_LOCATION ); |
| 246 | + placeMsg->appendIntegerArgument( commandButton->getSpecialPowerTemplate()->getID() ); //The ID of the special power template. |
| 247 | + placeMsg->appendLocationArgument( world ); //Position of special to be fired. |
| 248 | + placeMsg->appendRealArgument( angle ); //Angle of special to be fired. |
| 249 | + placeMsg->appendObjectIDArgument( INVALID_ID ); //There is no object in the way. |
| 250 | + placeMsg->appendIntegerArgument( commandButton->getOptions() ); //Command button options. |
| 251 | + placeMsg->appendObjectIDArgument( builderObj->getID() ); //The source object responsible for firing the special. |
| 252 | + |
| 253 | + // get out of pending placement mode, this will also clear the arrow anchor status |
| 254 | + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); |
| 255 | + |
| 256 | + // used the input |
| 257 | + disp = DESTROY_MESSAGE; |
| 258 | + m_frameOfUpButton = TheGameLogic->getFrame(); |
| 259 | + break; |
| 260 | + } |
| 261 | + } |
| 262 | + } |
228 | 263 |
|
229 | 264 | // create the right kind of message |
230 | 265 | if( isLineBuild ) |
|
0 commit comments