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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameengine): plain move to the rally point without a real weapon
Olcay Seyganbe4256002d9d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ba4d57400..c8d92b9a7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -100,7 +100,7 @@ found and fixed — EA's own, not port damage.**- A unit on attack move looks half as far again as it can shoot, and nothing to do with how far it can see. The two have nothing to do with each other: artillery outranges its own eyes and found nothing this way, while a scout with a long view stopped for things it would spend a minute driving to. One rule, measured against the gun.- An aircraft only makes that long look forward. It cannot stop and it turns in a wide circle, so a target off to one side or behind is one it has to come all the way round for - which is how a flight of bombers ends up orbiting a corner of the map instead of arriving. Inside sixty degrees of the nose it looks the full distance; outside it, no further than it can already shoot, so it still takes what it is passing.- Attack-moving through a base shoots the base; buildings were filtered out.-- A new unit heading for its rally point attack-moves there, so it fights what it meets on the way. A dozer, a supply truck or an empty ambulance has nothing to fight with, and it now just drives there instead of wearing the attack-move order and its colour the whole trip.+- A new unit heading for its rally point attack-moves there, so it fights what it meets on the way. A dozer, a GLA worker, a supply truck or an empty ambulance has nothing to fight with, and it now just drives there instead of wearing the attack-move order and its colour the whole trip.- Aircraft make their pass, fly home, rearm and resume your order.- Nothing walks off the map chasing a target that keeps retreating.- Being pulled off a chase no longer blinds a unit on the way back. It owes the order a stretch of ground before it is allowed to drive to another fight, and it used to spend that stretch refusing to see anything at all - so a tank rolled past an enemy parked beside it without firing a shot. It still will not go chasing during that stretch. It will shoot whatever is already in front of its gun, which costs the advance nothing.diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cppindex 37e679652..f4470b849 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp@@ -1102,6 +1102,21 @@ void AIUpdateInterface::friend_notifyStateMachineChanged()wakeUpNow();}+//-------------------------------------------------------------------------------------------------+static Bool hasFightingWeapon( const Object *obj )+{+ for (Int slot = PRIMARY_WEAPON; slot < WEAPONSLOT_COUNT; ++slot)+ {+ const Weapon *weapon = obj->getWeaponInWeaponSlot( (WeaponSlotType)slot );+ if (weapon == NULL)+ continue;+ const DamageType damageType = weapon->getDamageType();+ if (damageType != DAMAGE_DISARM && damageType != DAMAGE_HAZARD_CLEANUP)+ return TRUE;+ }+ return FALSE;+}+//-------------------------------------------------------------------------------------------------/*** The "main loop" of the AI subsystem@@ -1139,12 +1154,14 @@ UpdateSleepTime AIUpdateInterface::update( void )// instead of taking the shots and walking on. This is checked right after the machine ran,// because finishing (or failing) the exit path is what drops us into idle in the first place.// Something with nothing to fight with - a dozer, a supply truck, an empty ambulance - has no- // reason to stop for what it meets, so it takes the plain move instead.+ // reason to stop for what it meets, so it takes the plain move instead. isAbleToAttack alone+ // does not say that: a dozer or a GLA worker carries a mine disarming weapon and an ambulance a+ // hazard cleanup one, and both count as weapons there.if (m_hasExitProductionRallyPoint && getAIStateType() == AI_IDLE){Coord3D rallyPoint = m_exitProductionRallyPoint;m_hasExitProductionRallyPoint = FALSE;- if (getObject()->isAbleToAttack())+ if (getObject()->isAbleToAttack() && hasFightingWeapon(getObject()))privateAttackMoveToPosition( &rallyPoint, NO_MAX_SHOTS_LIMIT, CMD_FROM_AI );elseprivateMoveToPosition( &rallyPoint, CMD_FROM_AI );