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(gameengine): show a hacker's earnings from inside the building

Olcay Seygan0e4157fd8fe5
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
index 9145a40af..a61671bcf 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
@@ -555,7 +555,13 @@ StateReturnType HackInternetState::update()
// Whether the figure shows is whether this watcher can see the hacker. Spelling the
// rule out as "mine, or not stealthed, or detected" reads the same for a player but
// hides it from an ally who shares the sight and from an observer who sees everything.
- Drawable *ownerDraw = owner->getDrawable();
+ //
+ // A hacker working from inside an Internet Center has no drawable on screen at all -
+ // a garrisoned unit is hidden by its container - so asking the hacker whether it can
+ // be seen answered no for the whole time the money was coming in. The thing on
+ // screen is the building, so it is the building that gets asked.
+ Object *internetCenter = owner->getContainedBy();
+ Drawable *ownerDraw = internetCenter ? internetCenter->getDrawable() : owner->getDrawable();
Bool displayMoney = ( ownerDraw != NULL && ownerDraw->isVisible() );
if( displayMoney )
@@ -570,7 +576,6 @@ StateReturnType HackInternetState::update()
pos.z += 20.0f; //add a little z to make it show up above the unit.
- Object *internetCenter = owner->getContainedBy();
if ( internetCenter )
{
Real width = internetCenter->getGeometryInfo().getMajorRadius() * 0.3f;