Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed the bug that temporaryed unit cannot be erased correctly and no longer raise an error.
- Fixed building and defense tab hotkeys not enabling the placement mode after *Cannot build here.* triggered and the placement mode cancelled.
- Fixed buildings with `UndeployInto` playing `EVA_NewRallypointEstablished` on undeploying.
- Vehicles overlapping wall overlaytypes are no longer sellable through exploits.
- Fixed buildings with `Naval=yes` ignoring `WaterBound=no` to be forced to place onto water.
- Fixed AI Aircraft docks bug when Ares tag `[GlobalControls] -> AllowParallelAIQueues=no` is set.
- Fixed laser drawing code to allow for thicker lasers in house color draw mode.
Expand Down
29 changes: 28 additions & 1 deletion src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <AircraftTrackerClass.h>
#include <EventClass.h>
#include <JumpjetLocomotionClass.h>
#include <TunnelLocomotionClass.h>

Expand Down Expand Up @@ -2724,7 +2725,7 @@ DEFINE_HOOK(0x5218C2, InfantryClass_UnmarkAllOccupationBits_ResetOwnerIdx, 0x6)
const auto pExt = CellExt::ExtMap.Find(pCell);
pExt->InfantryCount--;

// Vanilla check only the flag to decide if the InfantryOwnerIndex should be reset.
// Vanilla check only the flag to decide if the InfantryOwnerIndex should be reset.
// But the tree take one of the flag bit. So if a infantry walk through a cell with a tree, the InfantryOwnerIndex won't be reset.
return (newFlag & 0x1C) == 0 || pExt->InfantryCount == 0 ? Reset : NoReset;
}
Expand Down Expand Up @@ -2949,6 +2950,32 @@ DEFINE_HOOK(0x65DE82, TeamTypeClass_CreateTeamMembers_Veterancy, 0x6)
return pTechnoType->Trainable ? 0 : SkipVeterancy;
}

// Disallow sell action on wall overlays if mouse cursor is hovering on another object.
DEFINE_HOOK(0x692AD6, ScrollClass_ChooseAction_SellWall, 0x6)
{
enum { NoSell = 0x692AFE };

GET(ObjectClass*, pObject, ESI);

if (pObject)
return NoSell;

return 0;
}

// Disallow sell action on wall overlays at event/network level if there's an object on the cell.
DEFINE_HOOK(0x4C6FCE, HouseClass_SellOverlay_ObjectCheck, 0x5)
{
enum { SkipSellOverlay = 0x4C6FD3 };

GET(EventClass*, pEvent, ESI);

if (MapClass::Instance.GetCellAt(pEvent->SellCell.Location)->GetContent())
return SkipSellOverlay;

return 0;
}

// Fixed the issue where non-repairer units needed sensors to attack cloaked friendly units.
DEFINE_JUMP(LJMP, 0x6FC278, 0x6FC289);

Expand Down
Loading