Skip to content

Commit

Permalink
Update Hooks.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryone committed May 18, 2024
1 parent 64bbaa8 commit 99c82c2
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/Ext/Building/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,17 @@ DEFINE_HOOK(0x6F5347, TechnoClass_DrawExtras_OfflinePlants, 0x7)
GET_STACK(RectangleStruct*, pRect, 0xA0);

const auto pBld = abstract_cast<BuildingClass*>(pThis);
if (!pBld)
auto exit = [R, pRect]()
{
R->ESI(pRect);
return 0x6F534E;
}
};

if (!pBld)
return exit();

if (!RulesExt::Global()->DrawPowerOffline)
{
R->ESI(pRect);
return 0x6F534E;
}
return exit();

const auto pTypeExt = BuildingTypeExt::ExtMap.Find(pBld->Type);
bool showLowPower = (pTypeExt->DisablePowerOfflineIcon == false)
Expand All @@ -449,15 +449,11 @@ DEFINE_HOOK(0x6F5347, TechnoClass_DrawExtras_OfflinePlants, 0x7)
&& (pBld->CloakState == CloakState::Uncloaked);

if (!showLowPower || MapClass::Instance->GetCellAt(pBld->GetMapCoords())->IsShrouded())
{
R->ESI(pRect);
return 0x6F534E;
}
return exit();

Point2D nPoint = TacticalClass::Instance->CoordsToClient(pBld->GetCenterCoords()).first;
const int speed = Math::max(GameOptionsClass::Instance->GetAnimSpeed(14) / 4, 2);
BuildingExt::DrawOfflinePlantIndicator(&nPoint, pRect, speed);

R->ESI(pRect);
return 0x6F534E;
return exit();
}

0 comments on commit 99c82c2

Please sign in to comment.