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): allied transfers, propaganda inside transports, rappellers

Olcay Seygan274b94a91881
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp
index 8b17f6bdf..156a86bee 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp
@@ -40,6 +40,7 @@
#include "GameLogic/Object.h"
#include "GameLogic/PartitionManager.h"
#include "GameLogic/Weapon.h"
+#include "GameLogic/Module/ContainModule.h"
#include "GameLogic/Module/PropagandaTowerBehavior.h"
#include "GameLogic/Module/BodyModule.h"
@@ -212,11 +213,13 @@ UpdateSleepTime PropagandaTowerBehavior::update( void )
}
}
- if( self->getContainedBy() && self->getContainedBy()->getContainedBy() )
+ /* Turn off inside anything that encloses us. The old test counted containers - one is allowed,
+ two is not - which is not the question. A unit riding a bike is contained but not hidden, and
+ a unit with its own Propaganda Tower behaviour was influencing the whole map from inside a
+ transport that was itself inside nothing. Whether a container encloses what it holds is a
+ thing the container knows, so ask it. */
+ if( self->getEnclosingContainedBy() )
{
- // If our container is contained, we turn the heck off. Seems like a weird specific check, but all of
- // attacking is guarded by the same check in isPassengersAllowedToFire. We similarly work in a container,
- // but not in a double container.
removeAllInfluence();
return UPDATE_SLEEP_NONE;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp
index 99e429722..a544284f2 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp
@@ -659,8 +659,11 @@ void TransportContain::onCapture( Player *oldOwner, Player *newOwner )
}
else
{
- //Use standard
- orderAllPassengersToExit( CMD_FROM_AI, FALSE );
+ // Handing a transport to an ally is not a capture the passengers need to escape from -
+ // they are on the same side afterwards. Emptying it made a scripted or a voluntary
+ // transfer dump everybody on the ground.
+ if( oldOwner->getRelationship( newOwner->getDefaultTeam() ) != ALLIES )
+ orderAllPassengersToExit( CMD_FROM_AI, FALSE );
}
}
}
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 9d9132a40..122d289bc 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp
@@ -588,15 +588,13 @@ public:
Object* rappeller = getPotentialRappeller(obj);
if (rappeller != NULL)
{
- ExitInterface *exitInterface = obj->getObjectExitInterface();
- ExitDoorType exitDoor = exitInterface ? exitInterface->reserveDoorForExit(rappeller->getTemplate(), rappeller) : DOOR_NONE_AVAILABLE;
- if(exitDoor != DOOR_NONE_AVAILABLE)
+ /* A rappeller on a combat drop goes out of the door, full stop - it does not queue for
+ one. Reserving a door meant asking getAiFreeToExit, and that answered yes for any
+ rappeller while the drop state was running, which is what let a player order a
+ rappeller out of a Chinook in mid-air and have it simply fall. */
+ if (ExitInterface *exitInterface = obj->getObjectExitInterface())
{
- exitInterface->exitObjectViaDoor(rappeller, exitDoor);
- }
- else
- {
- DEBUG_CRASH(("rappeller is not free to exit... what?"));
+ exitInterface->exitObjectViaDoor(rappeller, DOOR_1);
}
rappeller->setTransformMatrix(&it->dropStartMtx);
@@ -1045,8 +1043,9 @@ ObjectID ChinookAIUpdate::getBuildingToNotPathAround() const
//-------------------------------------------------------------------------------------------------
AIFreeToExitType ChinookAIUpdate::getAiFreeToExit(const Object* exiter) const
{
- if (m_flightStatus == CHINOOK_LANDED
- || (m_flightStatus == CHINOOK_DOING_COMBAT_DROP && exiter->isKindOf(KINDOF_CAN_RAPPEL)))
+ // Only a landed Chinook lets anybody out. The combat drop puts its rappellers out itself, so
+ // the exception here was doing nothing but letting a player eject one manually in mid-air.
+ if (m_flightStatus == CHINOOK_LANDED)
return FREE_TO_EXIT;
return WAIT_TO_EXIT;