Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameclient): arm guard with G and post units along a drawn line

Olcay Seygan50c3bca23886
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b049f5b98..19df2791c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -125,6 +125,7 @@ found and fixed — EA's own, not port damage.**
- Selected units draw a thread to wherever they are going, and the marker on the spot is the game's own cursor. Every order that has a cursor gets that cursor: move, attack move, attack, force fire, ground fire, enter, dock, repair, heal, capture, hack, guard, a waypoint path. Green for a move, pink for an attack-move, red for anything that shoots, so a group told three different things reads as three different colours. It is not a flash at the moment of the order: the line is asked of the unit every frame, so it lasts until the unit gets there, changes its mind or leaves your selection, and it shows on the formation line while you are still drawing it. A unit that has walked off the edge of the screen still draws its line, which is how you see where the half of your army you cannot see is headed. The animated ring the ground used to sprout wherever you clicked is gone: it flashed for a second and told you nothing the marker sitting on the destination does not, and that marker stays for as long as the order does. A marker that has just appeared slides the last few pixels up out of the bottom right and fades in as it lands, over about an eighth of a second, so a fresh order catches your eye without anything flashing. Aircraft draw their thread from the click, not from the moment they leave the runway. A plane parked on its airfield answers an order by starting its takeoff and puts the order itself aside until the wheels are up, so the taxi and the climb, which is exactly the stretch where you are wondering whether the strike went out at all, used to show nothing.
- A unit standing guard draws its marker on the ground it is guarding. A guard order clears the unit's goal on the way in, so every guard marker used to sit in the bottom left corner of the map with a thread running the whole way across it, whatever the unit was actually watching.
- A is attack and F is attack move, each arming the next order click. A click on the ground with A held down is a shot at that ground, on your own tank a shot at your own tank, and the mode drops again the moment the order goes out, so nothing stays armed behind your back. The click keeps your group, too: an attack click that was not a drag used to run the same deselect an ordinary left click runs, so the order arrived a moment after the units it was meant for had been dropped. Ctrl still forces fire while you hold it. The two keys turn each other off, and the letters they took were sitting on grid commands that moved.
+- G is guard, armed the same way. The next order click posts the selection on that spot: they hold it, shoot what walks into range and do not chase it off the post you put them on. Drag the right button with G armed and they post along the line you draw, one unit per station, which is how a hill or a bridge approach gets covered in one gesture instead of a click per tank. Guard has its own colour, blue, on the line while you draw it and on the thread and marker afterwards, so a group told to hold ground reads apart from one told to walk there. Hold position, which posts every unit on the spot it is already standing on, has moved to H.
- With A armed, hold the left button and drag a circle instead: everything hostile you can see inside it becomes a target list, nearest first, and the selection works down that list on its own. When the current target dies the next order goes out the same frame, so a strike group clears a circle without you clicking once per tank. It moves on from a target the group has stopped working on, too, rather than only from a dead one: something none of them can reach or hurt used to sit at the head of the list and hold every other target behind it for the rest of the match. That list is the same queue a shift-clicked attack builds, so you can see it: every target still owed has its own thread and marker, in the order they will be taken, instead of one line to whatever is being shot at this second. Hold shift while you draw the circle and its targets go on the end of what the group is already working through; draw it without shift and the circle replaces the lot. The ground inside the circle is washed the same red while you drag it, painted on the map rather than over it, so it runs up the hills inside the circle and your own tanks stand on top of it. Any order you give by hand ends the list. Losing a unit does not: the list belongs to the group that was told and carries on with whoever is left, which is worth saying because for a while it did not, and one tank dying threw away every target still owed. A target with enough of your fire already in the air to kill it counts as done, so the rest of the group takes the next thing on the list rather than emptying itself into something that is dead and has not fallen over yet. Aircraft are what this is for: a flight fires from range and the missiles are seconds behind, and four planes used to spend all four loads on the first tank in the circle. Running out of ammo does not cost you the list either. A flight that empties its racks flies home, lands, rearms and comes back to the target it left, and the queue waits for it instead of counting the trip as the group giving up: a circle drawn for four planes used to be empty by the time they were back in the air, one entry lost every two seconds they were away. The threads stay on the ground for the whole trip, too. A plane flying home has no target and no order to read, so the list it was still holding used to vanish off the map the moment it turned for base and reappear only when it was shooting again, which looks exactly like the list being thrown away. What the circle picks up is what you can shoot: a shell or a missile crossing it is on the enemy's side like everything else and used to go on the list as a target, costing the group a two second stall on something that was about to stop existing. A target that has driven into the shroud since you picked it keeps its place in the list but stops drawing its thread, so the line cannot be used to trace it through the fog. An attack-move queued behind other orders keeps the force fire it was given rather than losing it when the attack key drops.
- Shift queues an attack now, not only a move. A or F held down while you shift-click adds a force-attack or an attack-move to the line of orders a group is already holding, and it fires the moment the order in front of it is finished - a target dead, or nobody left chasing an attack-move point. The coloured thread that shows a queued order covers it too, so a queue of "go here, then attack that, then attack-move over there" reads as one continuous line in three colours. The game's own white waypoint markings, which used to draw over the same ground the moment shift went down, are gone - they only ever duplicated what the coloured thread already showed, and doing both left a queued attack sitting under two different pictures of itself.
- Ctrl+D takes every unit of the kinds you have selected that is on the screen, and pressed twice inside half a second takes them across the whole map. One tank selected and two keystrokes is your whole armour, wherever it is standing. It was on Shift+Ctrl+E, which is three fingers for something you do in every fight, and it only ever reached across the map when the screen had nothing left to give - so the wide selection happened to you instead of being asked for.
diff --git a/GeneralsMD/Code/Data/INI/CommandMap.ini b/GeneralsMD/Code/Data/INI/CommandMap.ini
index 1b7318d7d..590267c47 100644
--- a/GeneralsMD/Code/Data/INI/CommandMap.ini
+++ b/GeneralsMD/Code/Data/INI/CommandMap.ini
@@ -374,9 +374,22 @@ CommandMap STOP
DisplayName = GUI:Stop
End
+; guard. 'G' arms the mode the same way, and the next order click posts the
+; selection where it is pointed; drag the right button with it armed and they
+; post along the line instead of piling onto one spot.
+CommandMap TOGGLE_GUARD
+ Key = KEY_G
+ Transition = DOWN
+ Modifiers = NONE
+ UseableIn = GAME
+ Category = CONTROL
+ Description = GUI:ToggleGuardDescription
+ DisplayName = GUI:ToggleGuard
+End
+
; guard the spot you are standing on, without chasing anything
CommandMap HOLD_POSITION
- Key = KEY_G
+ Key = KEY_H
Transition = DOWN
Modifiers = NONE
UseableIn = GAME
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 9deca3fb0..af6aa0597 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -169,6 +169,14 @@ GUI:ToggleForceAttackDescription
"Arms force fire: the next order click is an attack on whatever is under it, your own units and bare ground included."
END
+GUI:ToggleGuard
+"Guard"
+END
+
+GUI:ToggleGuardDescription
+"Arms guard: the next order click posts the selected units on that spot, and a right drag posts them along the line you draw."
+END
+
GUI:HoldPosition
"Hold Position"
END
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
index f36f9c062..78bad8381 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
@@ -295,6 +295,7 @@ public:
MSG_META_TOGGLE_ATTACKMOVE, ///< enter attack-move mode
MSG_META_TOGGLE_FORCEATTACK, ///< arm force fire for the next order click (fork)
MSG_META_HOLD_POSITION, ///< hold position: guard in place, no pursuit (fork)
+ MSG_META_TOGGLE_GUARD, ///< arm guard for the next order click or drag (fork)
MSG_META_TOGGLE_PAUSE, ///< pause/unpause, single player and replay only (fork)
MSG_META_GAME_SPEED_UP, ///< raise the logic rate (fork)
MSG_META_GAME_SPEED_DOWN, ///< lower the logic rate (fork)
@@ -641,6 +642,7 @@ public:
MSG_DO_FORMATION_MOVETO, ///< (location...) spread the selection along a drawn curve (fork)
MSG_DO_FORMATION_ATTACKMOVETO, ///< (location...) the same curve, taken as an attack move (fork)
MSG_DO_FORMATION_FORCEATTACK, ///< (location...) the same curve, each unit force firing its own point (fork)
+ MSG_DO_FORMATION_GUARD, ///< (location...) the same curve, each unit guarding its own point (fork)
MSG_BEGIN_DEBUG_NETWORK_MESSAGES = 1900, ///< network messages that exist only in debug/internal builds. all grouped separately.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index b39ce5d5f..d0fd326d0 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -858,15 +858,21 @@ public: // ********************************************************************
void setForceAttackMode( Bool enabled ) { m_forceAttackMode = enabled; }
void setPreferSelectionMode( Bool enabled ) { m_preferSelection = enabled; }
- void toggleAttackMoveToMode( void ) { m_attackMoveToMode = !m_attackMoveToMode; m_forceAttackArmed = FALSE; }
+ void toggleAttackMoveToMode( void ) { m_attackMoveToMode = !m_attackMoveToMode; m_forceAttackArmed = FALSE; m_guardArmed = FALSE; }
Bool isInAttackMoveToMode( void ) const { return m_attackMoveToMode; }
- void clearAttackMoveToMode( void ) { m_attackMoveToMode = FALSE; m_forceAttackArmed = FALSE; }
+ void clearAttackMoveToMode( void ) { m_attackMoveToMode = FALSE; m_forceAttackArmed = FALSE; m_guardArmed = FALSE; }
// the attack key arms force fire the way the attack move key arms an attack move: the next
// order click shoots whatever is under it, ground included, and the mode drops again with the
// same call that drops attack move
- void toggleForceAttackArmed( void ) { m_forceAttackArmed = !m_forceAttackArmed; m_attackMoveToMode = FALSE; }
+ void toggleForceAttackArmed( void ) { m_forceAttackArmed = !m_forceAttackArmed; m_attackMoveToMode = FALSE; m_guardArmed = FALSE; }
Bool isForceAttackArmed( void ) const { return m_forceAttackArmed; }
+
+ // and the guard key arms guard the same way: the next order click posts the selection on that
+ // spot, or on that object, and a drag posts them along the line instead of stacking them all
+ // on one point. All three modes are one mode at a time
+ void toggleGuardArmed( void ) { m_guardArmed = !m_guardArmed; m_attackMoveToMode = FALSE; m_forceAttackArmed = FALSE; }
+ Bool isGuardArmed( void ) const { return m_guardArmed; }
// zeroing the repeat clock makes the first quantized step happen on the very next update, so a
// tap of the key is one eighth and a hold is one eighth every CAMERA_SNAP_REPEAT_MS.
@@ -1311,6 +1317,7 @@ protected:
Bool m_forceMoveToMode; ///< are we in force move mode?
Bool m_attackMoveToMode; ///< are we in attack move mode?
Bool m_forceAttackArmed; ///< is the attack key holding force fire for the next click?
+ Bool m_guardArmed; ///< is the guard key holding a guard order for the next click?
Bool m_preferSelection; ///< the shift key has been depressed.
// wall clock of the previous update(), so a held camera key can be stepped by elapsed
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp
index 0e2aeb74f..cee1abfc0 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp
@@ -371,6 +371,7 @@ AsciiString GameMessage::getCommandTypeAsAsciiString(GameMessage::Type t)
CHECK_IF(MSG_META_TOGGLE_FORCEATTACK)
CHECK_IF(MSG_META_TOGGLE_PURCHASE_SCIENCE)
CHECK_IF(MSG_META_HOLD_POSITION)
+ CHECK_IF(MSG_META_TOGGLE_GUARD)
CHECK_IF(MSG_META_TOGGLE_PAUSE)
CHECK_IF(MSG_META_GAME_SPEED_UP)
CHECK_IF(MSG_META_GAME_SPEED_DOWN)
@@ -651,6 +652,7 @@ AsciiString GameMessage::getCommandTypeAsAsciiString(GameMessage::Type t)
CHECK_IF(MSG_DO_FORMATION_MOVETO)
CHECK_IF(MSG_DO_FORMATION_ATTACKMOVETO)
CHECK_IF(MSG_DO_FORMATION_FORCEATTACK)
+ CHECK_IF(MSG_DO_FORMATION_GUARD)
CHECK_IF(MSG_DO_GUARD_OBJECT)
CHECK_IF(MSG_DO_STOP)
CHECK_IF(MSG_DO_SCATTER)
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 791a07ab1..b1ce42c85 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -1218,6 +1218,7 @@ InGameUI::InGameUI()
m_forceMoveToMode = false;
m_attackMoveToMode = false;
m_forceAttackArmed = false;
+ m_guardArmed = false;
m_preferSelection = false;
m_isAttackCircling = FALSE;
m_shiftAttackQueueRunning = FALSE;
@@ -2436,6 +2437,7 @@ void InGameUI::reset( void )
m_forceMoveToMode = false;
m_attackMoveToMode = false;
m_forceAttackArmed = false;
+ m_guardArmed = false;
m_preferSelection = false;
m_isAttackCircling = FALSE;
m_shiftAttackQueue.clear();
@@ -2960,6 +2962,7 @@ void InGameUI::updateFormationHints( void )
OrderHint hint;
hint.kind = isInAttackMoveToMode() ? ORDER_HINT_ATTACK_MOVE
: isForceAttackArmed() ? ORDER_HINT_ATTACK
+ : isGuardArmed() ? ORDER_HINT_GUARD
: ORDER_HINT_MOVE;
hint.owner = movers[ i ]->getID();
hint.from = *movers[ i ]->getPosition();
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
index 1811b9382..0a0da8c79 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
@@ -142,6 +142,24 @@ Bool Command_formationDragArmed( Bool setting, Bool haveMovableSelection, Bool g
return setting && !guiCommandPending && haveMovableSelection;
}
+//-------------------------------------------------------------------------------------------------
+/**
+ * Which order a finished formation line carries.
+ * The armed modes turn each other off as they are armed, so at most one of these is ever set; the
+ * order they are read in only decides what a line drawn out of a state nobody can reach would do.
+ */
+GameMessage::Type Command_formationMessage( Bool attackMoveArmed, Bool forceAttackArmed,
+ Bool guardArmed )
+{
+ if( attackMoveArmed )
+ return GameMessage::MSG_DO_FORMATION_ATTACKMOVETO;
+ if( forceAttackArmed )
+ return GameMessage::MSG_DO_FORMATION_FORCEATTACK;
+ if( guardArmed )
+ return GameMessage::MSG_DO_FORMATION_GUARD;
+ return GameMessage::MSG_DO_FORMATION_MOVETO;
+}
+
static Bool isFormationDragArmed( void )
{
return Command_formationDragArmed( TheGlobalData->m_formationDrag,
@@ -936,7 +954,13 @@ GameMessage::Type CommandTranslator::issueMoveToLocationCommand( const Coord3D *
Bool queuedAttack = TheInGameUI->isInWaypointMode()
&& ( TheInGameUI->isInAttackMoveToMode() || forceAttackHere );
- if( queuedAttack )
+ // the guard key posts the selection where it is pointed. It outranks the queue: a guard has
+ // no next point to walk to, so there is nothing for shift to add it to
+ if( TheInGameUI->isGuardArmed() )
+ {
+ msgType = GameMessage::MSG_DO_GUARD_POSITION;
+ }
+ else if( queuedAttack )
{
msgType = forceAttackHere ? GameMessage::MSG_DO_ATTACK_OBJECT : GameMessage::MSG_DO_ATTACKMOVETO;
if( commandType == DO_COMMAND )
@@ -975,6 +999,11 @@ GameMessage::Type CommandTranslator::issueMoveToLocationCommand( const Coord3D *
if (msgType == GameMessage::MSG_DO_ATTACKMOVETO)
movemsg->appendBooleanArgument( TheInGameUI->isInForceAttackMode() );
+ // a posted unit holds its spot and shoots what walks into range, rather than chasing it
+ // off the post the player put it on
+ if (msgType == GameMessage::MSG_DO_GUARD_POSITION)
+ movemsg->appendIntegerArgument( GUARDMODE_GUARD_WITHOUT_PURSUIT );
+
} // end if
}
@@ -3402,6 +3431,13 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
TheInGameUI->toggleForceAttackArmed( );
break;
+ //-----------------------------------------------------------------------------------------
+ // the guard key, armed the same way again: the next order click posts the selection where it
+ // is pointed instead of walking them there and leaving them idle
+ case GameMessage::MSG_META_TOGGLE_GUARD:
+ TheInGameUI->toggleGuardArmed( );
+ break;
+
//-----------------------------------------------------------------------------------------
// the general's promotion screen. It is one click away on the stars button and nowhere on
// the keyboard, which is the wrong way round for something you open the moment a promotion
@@ -3974,11 +4010,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
// the same curve means "attack along this" while one of the attack modes is armed, which
// is the artillery gesture: a line of fire instead of a line of tanks. Attack move
// walks it and shoots what it meets; the attack key fires on the line where it stands
- GameMessage::Type formationType = GameMessage::MSG_DO_FORMATION_MOVETO;
- if( TheInGameUI->isInAttackMoveToMode() )
- formationType = GameMessage::MSG_DO_FORMATION_ATTACKMOVETO;
- else if( TheInGameUI->isForceAttackArmed() )
- formationType = GameMessage::MSG_DO_FORMATION_FORCEATTACK;
+ const GameMessage::Type formationType =
+ Command_formationMessage( TheInGameUI->isInAttackMoveToMode(),
+ TheInGameUI->isForceAttackArmed(),
+ TheInGameUI->isGuardArmed() );
// the traced curve becomes world points; who stands where along it is decided on
// the logic side, where every machine decides it the same way
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp
index 6b5b64a28..8e30b07d7 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp
@@ -181,6 +181,7 @@ static const LookupListRec GameMessageMetaTypeNames[] =
{ "TOGGLE_FORCEATTACK", GameMessage::MSG_META_TOGGLE_FORCEATTACK },
{ "TOGGLE_PURCHASE_SCIENCE", GameMessage::MSG_META_TOGGLE_PURCHASE_SCIENCE },
{ "HOLD_POSITION", GameMessage::MSG_META_HOLD_POSITION },
+ { "TOGGLE_GUARD", GameMessage::MSG_META_TOGGLE_GUARD },
{ "TOGGLE_PAUSE", GameMessage::MSG_META_TOGGLE_PAUSE },
{ "GAME_SPEED_UP", GameMessage::MSG_META_GAME_SPEED_UP },
{ "GAME_SPEED_DOWN", GameMessage::MSG_META_GAME_SPEED_DOWN },
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
index d66c7a294..98119cd11 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
@@ -982,12 +982,14 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
case GameMessage::MSG_DO_FORMATION_MOVETO:
case GameMessage::MSG_DO_FORMATION_ATTACKMOVETO:
case GameMessage::MSG_DO_FORMATION_FORCEATTACK:
+ case GameMessage::MSG_DO_FORMATION_GUARD:
{
if (currentlySelectedGroup == NULL)
break;
const Bool attackAlong = (msg->getType() == GameMessage::MSG_DO_FORMATION_ATTACKMOVETO);
const Bool fireAlong = (msg->getType() == GameMessage::MSG_DO_FORMATION_FORCEATTACK);
+ const Bool guardAlong = (msg->getType() == GameMessage::MSG_DO_FORMATION_GUARD);
// the curve the cursor traced, however many corners the player's hand put in it
std::vector<Coord3D> path;
@@ -1036,7 +1038,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
pointAlongPath( path, arc, span * t, &station );
station.z = TheTerrainLogic->getGroundHeight( station.x, station.y );
- if (fireAlong)
+ if (guardAlong)
+ movers[ i ]->getAIUpdateInterface()->aiGuardPosition( &station, GUARDMODE_GUARD_WITHOUT_PURSUIT, CMD_FROM_PLAYER );
+ else if (fireAlong)
movers[ i ]->getAIUpdateInterface()->aiAttackPosition( &station, NO_MAX_SHOTS_LIMIT, CMD_FROM_PLAYER );
else if (attackAlong)
movers[ i ]->getAIUpdateInterface()->aiAttackMoveToPosition( &station, NO_MAX_SHOTS_LIMIT, CMD_FROM_PLAYER );
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
index 544a4dea4..bb21c803f 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
@@ -862,6 +862,7 @@ void W3DInGameUI::drawFormationLine( void )
// the line says which order it is about to be, in the colours the order hints already use
const UnsignedInt color = isInAttackMoveToMode() ? 0xCCFF66CC
: isForceAttackArmed() ? 0xCCFF5555
+ : isGuardArmed() ? 0xCC55CCFF
: 0xCC33FF33; //0xAARRGGBB
const std::vector<ICoord2D>& curve = m_formationDragPoints;
const Int points = (Int)curve.size();
@@ -937,8 +938,9 @@ void W3DInGameUI::drawAttackCircle( void )
* and a group given four different jobs reads as four different markers rather than four arrows. */
//-------------------------------------------------------------------------------------------------
/** The thread is coloured by what it is for: anything that ends in a shot is red, an attack move
- * is pink, everything else is green. The marker on the end of it is the plain pointer in the same
- * colour - one shape for every order, so the colour is the whole message. */
+ * is pink, a post to be held is blue, everything else is green. The marker on the end of it is
+ * the plain pointer in the same colour - one shape for every order, so the colour is the whole
+ * message. */
//-------------------------------------------------------------------------------------------------
static UnsignedInt orderHintLineColor( InGameUI::OrderHintKind kind )
{
@@ -950,6 +952,8 @@ static UnsignedInt orderHintLineColor( InGameUI::OrderHintKind kind )
case InGameUI::ORDER_HINT_FORCE_ATTACK:
case InGameUI::ORDER_HINT_ATTACK_GROUND:
return 0x66FF5555;
+ case InGameUI::ORDER_HINT_GUARD:
+ return 0x6655CCFF;
default:
return 0x6655FF55;
}
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index aa5a589a9..cd759a232 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -1009,6 +1009,21 @@ TEST(formation_drag_takes_the_right_button_only_when_it_is_asked_for)
CHECK( !Command_formationDragArmed( true, true, true ) );
}
+/* CommandXlat.cpp: the line carries whichever mode the player armed before drawing it. */
+extern GameMessage::Type Command_formationMessage( Bool attackMoveArmed, Bool forceAttackArmed,
+ Bool guardArmed );
+
+TEST(a_formation_line_carries_the_armed_order)
+{
+ /* nothing armed: the line is a move. */
+ CHECK( Command_formationMessage( false, false, false ) == GameMessage::MSG_DO_FORMATION_MOVETO );
+
+ /* one mode at a time is all the UI can arm, and each names its own message. */
+ CHECK( Command_formationMessage( true, false, false ) == GameMessage::MSG_DO_FORMATION_ATTACKMOVETO );
+ CHECK( Command_formationMessage( false, true, false ) == GameMessage::MSG_DO_FORMATION_FORCEATTACK );
+ CHECK( Command_formationMessage( false, false, true ) == GameMessage::MSG_DO_FORMATION_GUARD );
+}
+
/* DrawnPath.cpp: the drawn curve is measured by arc length, not by segment, so the stations divide
the whole line however uneven the hand that drew it was. */
#include "Common/DrawnPath.h"