Skip to content

Commit 49cbb9f

Browse files
committed
tweak: Sneak Attack selection now persists
1 parent 6c6e05b commit 49cbb9f

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CreateObjectDie.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class CreateObjectDieModuleData : public DieModuleData
4848

4949
const ObjectCreationList* m_ocl; ///< object creaton list to make
5050
Bool m_transferPreviousHealth; ///< Transfers previous health before death to the new object created.
51+
Bool m_transferSelection; ///< Transfers selection state before death to the new object created.
5152

5253
CreateObjectDieModuleData();
5354

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "GameLogic/Object.h"
3939
#include "GameLogic/ObjectCreationList.h"
4040
#include "GameLogic/Module/BodyModule.h"
41-
41+
#include "GameClient/InGameUI.h"
4242

4343
// ------------------------------------------------------------------------------------------------
4444
// ------------------------------------------------------------------------------------------------
@@ -47,7 +47,7 @@ CreateObjectDieModuleData::CreateObjectDieModuleData()
4747

4848
m_ocl = NULL;
4949
m_transferPreviousHealth = FALSE;
50-
50+
m_transferSelection = FALSE;
5151
}
5252

5353
// ------------------------------------------------------------------------------------------------
@@ -60,6 +60,7 @@ CreateObjectDieModuleData::CreateObjectDieModuleData()
6060
{
6161
{ "CreationList", INI::parseObjectCreationList, NULL, offsetof( CreateObjectDieModuleData, m_ocl ) },
6262
{ "TransferPreviousHealth", INI::parseBool, NULL ,offsetof( CreateObjectDieModuleData, m_transferPreviousHealth ) },
63+
{ "TransferSelection", INI::parseBool, NULL ,offsetof( CreateObjectDieModuleData, m_transferSelection ) },
6364
{ 0, 0, 0, 0 }
6465
};
6566
p.add(dataFieldParse);
@@ -95,11 +96,13 @@ void CreateObjectDie::onDie( const DamageInfo * damageInfo )
9596
Object *damageDealer = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID );
9697

9798
Object *newObject = ObjectCreationList::create( data->m_ocl, getObject(), damageDealer );
99+
if (!newObject)
100+
return;
98101

99102
//If we're transferring previous health, we're transfering the last known
100103
//health before we died. In the case of the sneak attack tunnel network, it
101104
//is killed after the lifetime update expires.
102-
if( newObject && data->m_transferPreviousHealth )
105+
if( data->m_transferPreviousHealth )
103106
{
104107
//Convert old health to new health.
105108
Object *oldObject = getObject();
@@ -140,7 +143,20 @@ void CreateObjectDie::onDie( const DamageInfo * damageInfo )
140143
}
141144
}
142145

146+
if (data->m_transferSelection)
147+
{
148+
Object* oldObject = getObject();
149+
Drawable* selectedDrawable = TheInGameUI->getFirstSelectedDrawable();
150+
Bool oldObjectSelected = selectedDrawable && selectedDrawable->getID() == oldObject->getDrawable()->getID();
143151

152+
if (oldObjectSelected)
153+
{
154+
GameMessage* msg = TheMessageStream->appendMessage(GameMessage::MSG_CREATE_SELECTED_GROUP_NO_SOUND);
155+
msg->appendBooleanArgument(TRUE);
156+
msg->appendObjectIDArgument(newObject->getID());
157+
TheInGameUI->selectDrawable(newObject->getDrawable());
158+
}
159+
}
144160
}
145161

146162
// ------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)