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.

fix(gamelogic): ignore an enter order a transport cannot carry out

Olcay Seygan827384ef9f74
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e6a311e10..d165a0636 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -397,6 +397,8 @@ found and fixed — EA's own, not port damage.**
- A unit that has to deploy before firing does it standing still. It used to set up wherever it happened to be when the target came into range, then pack straight back up because it was still on its way somewhere.
- An Aurora that went supersonic to attack comes back down again. The timer ran out and nothing put the normal engine back.
- Calling in a gunship selects it for the player who called it, not for everyone watching the match.
+- A transport told to load into something it cannot enter - or into itself, which happens when it is part of the group you gave the order to - ignores the order instead of flying over and hovering beside it.
+- A pilot ejecting from a wreck no longer plays a promotion sound and animation somewhere out in the map.
- Something going wrong now writes a readable crash report.
## Long orders stopped hitching
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp
index 79e7b2075..6b81868c6 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp
@@ -1022,7 +1022,9 @@ protected:
DEBUG_LOG(("Object %s inherits veterancy level %d from %s\n",
obj->getTemplate()->getName().str(), sourceObj->getVeterancyLevel(), sourceObj->getTemplate()->getName().str()));
VeterancyLevel v = sourceObj->getVeterancyLevel();
- obj->getExperienceTracker()->setVeterancyLevel(v);
+ // no fanfare: the object has only just been created and its transform is not set yet,
+ // so the level-up sound and animation would play somewhere it is not
+ obj->getExperienceTracker()->setVeterancyLevel(v, FALSE);
//In order to make things easier for the designers, we are going to transfer the unit name
//to the ejected thing... so the designer can control the pilot with the scripts.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp
index 23e0bb804..9d9132a40 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp
@@ -1297,6 +1297,19 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms)
}
break;
+ case AICMD_ENTER:
+ {
+ // A group order goes to every unit in the group, so a transport told to load into
+ // something can be handed itself, or something it cannot enter at all - it would then
+ // fly off and hover beside it forever.
+ if (parms->m_obj && parms->m_obj->getID() == getObject()->getID())
+ return;
+
+ if (!TheActionManager->canEnterObject(getObject(), parms->m_obj, parms->m_cmdSource, DONT_CHECK_CAPACITY))
+ return;
+ }
+ break;
+
case AICMD_MOVE_TO_POSITION_AND_EVACUATE:
case AICMD_MOVE_TO_POSITION_AND_EVACUATE_AND_EXIT:
{