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: 0 additions & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,3 @@ This page lists all the individual contributions to the project by their author.
- **Damfoos** - extensive and thorough testing
- **Dmitry Volkov** - extensive and thorough testing
- **Rise of the East community** - extensive playtesting of in-dev features
- **Aephiex** - fixed Ares academy not working on the initial payloads of vehicles built from a war factory
53 changes: 0 additions & 53 deletions src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <Utilities/Macro.h>
#include <Utilities/Debug.h>
#include <Utilities/TemplateDef.h>
#include <Utilities/AresFunctions.h>

/*
Allow usage of TileSet of 255 and above without making NE-SW broken bridges unrepairable
Expand Down Expand Up @@ -1170,55 +1169,3 @@ size_t __fastcall HexStr2Int_replacement(const char* str)
}
DEFINE_JUMP(CALL, 0x6E8305, GET_OFFSET(HexStr2Int_replacement)); // TaskForce
DEFINE_JUMP(CALL, 0x6E5FA6, GET_OFFSET(HexStr2Int_replacement)); // TagType

// This is the inline function to get the academy type that a techno enjoys.
inline static const AbstractType GetAresAcademyType(TechnoClass* pTechno)
{
if (pTechno->WhatAmI() == AbstractType::Unit)
{
if (pTechno->GetTechnoType()->ConsideredAircraft)
return AbstractType::Aircraft;
else if (pTechno->GetTechnoType()->Organic)
return AbstractType::Infantry;
else
return AbstractType::Unit;
}
else if (pTechno->WhatAmI() == AbstractType::Infantry
|| pTechno->WhatAmI() == AbstractType::Aircraft
|| pTechno->WhatAmI() == AbstractType::Building)
{
return pTechno->WhatAmI();
}
return AbstractType::None;
}

// This is a fix to the Ares bug: Academy feature doesn't apply to the initial payload of vehicles built off a War Factory.
// Curiously, Academy applies to the initial payloads of vehicles under any other circumstances, even when built off a Naval Shipyard.
// It is "Unsorted::IKnowWhatImDoing" prevented the "HouseExt::ApplyAcademy" from taking effect.
// The fix is simple, when Ares is supposed to have initialized the initial payload, and Academy is prevented from taking any effect,
// temporarily turn off "Unsorted::IKnowWhatImDoing", invoke "HouseExt::ApplyAcademy", then turn on "Unsorted::IKnowWhatImDoing" again.
DEFINE_HOOK(0x4D71A0, FootClass_Put_InitialPayload_AfterAres, 0x6)
{
GET(FootClass* const, pThis, ESI);

if (AresFunctions::ApplyAcademy && Unsorted::IKnowWhatImDoing)
{
if (pThis && !pThis->InLimbo && pThis->IsOnMap && pThis->WhatAmI() == AbstractType::Unit
&& pThis->GetTechnoType()->Passengers > 0
&& pThis->Passengers.NumPassengers > 0)
{
for (auto pNext = pThis->Passengers.FirstPassenger; pNext; pNext = abstract_cast<FootClass*>(pNext->NextObject))
{
auto abstractType = GetAresAcademyType(pNext);
if (abstractType != AbstractType::None)
{
--Unsorted::IKnowWhatImDoing;
AresFunctions::ApplyAcademy(AresFunctions::HouseExtMap_Find(pNext->Owner), pNext, abstractType);
++Unsorted::IKnowWhatImDoing;
}
}
}
}

return 0;
}
15 changes: 0 additions & 15 deletions src/Utilities/AresAddressInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
decltype(AresFunctions::ConvertTypeTo) AresFunctions::ConvertTypeTo = nullptr;
decltype(AresFunctions::SpawnSurvivors) AresFunctions::SpawnSurvivors = nullptr;
decltype(AresFunctions::IsTargetConstraintsEligible) AresFunctions::IsTargetConstraintsEligible = nullptr;
decltype(AresFunctions::ApplyAcademy) AresFunctions::ApplyAcademy = nullptr;
std::function<AresSWTypeExtData* (SuperWeaponTypeClass*)> AresFunctions::SWTypeExtMap_Find;
std::function<AresHouseExtData* (HouseClass*)> AresFunctions::HouseExtMap_Find;

void* AresFunctions::_SWTypeExtMap = nullptr;
decltype(AresFunctions::_SWTypeExtMapFind) AresFunctions::_SWTypeExtMapFind = nullptr;
void* AresFunctions::_HouseExtMap = nullptr;
decltype(AresFunctions::_HouseExtMapFind) AresFunctions::_HouseExtMapFind = nullptr;

void Apply_Ares3_0_Patches();
void Apply_Ares3_0p1_Patches();
Expand All @@ -33,16 +30,10 @@ void AresFunctions::InitAres3_0()

NOTE_ARES_FUN(IsTargetConstraintsEligible, 0x032110);

NOTE_ARES_FUN(ApplyAcademy, 0x020750);

NOTE_ARES_FUN(_SWTypeExtMapFind, 0x57C70);
NOTE_ARES_FUN(_SWTypeExtMap, 0xC1C54);
SWTypeExtMap_Find = [](SuperWeaponTypeClass* swt) { return _SWTypeExtMapFind(_SWTypeExtMap, swt); };

NOTE_ARES_FUN(_HouseExtMapFind, 0x57C70);
NOTE_ARES_FUN(_HouseExtMap, 0xC1AA8);
HouseExtMap_Find = [](HouseClass* houseClass) { return _HouseExtMapFind(_HouseExtMap, houseClass); };

#ifndef USING_MULTIFINITE_SYRINGE
Apply_Ares3_0_Patches();
#endif
Expand All @@ -63,16 +54,10 @@ void AresFunctions::InitAres3_0p1()

NOTE_ARES_FUN(IsTargetConstraintsEligible, 0x032AF0);

NOTE_ARES_FUN(ApplyAcademy, 0x0211D0);

NOTE_ARES_FUN(_SWTypeExtMapFind, 0x58900);
NOTE_ARES_FUN(_SWTypeExtMap, 0xC2C50);
SWTypeExtMap_Find = [](SuperWeaponTypeClass* swt) { return _SWTypeExtMapFind(_SWTypeExtMap, swt); };

NOTE_ARES_FUN(_HouseExtMapFind, 0x589A0);
NOTE_ARES_FUN(_HouseExtMap, 0xC2B08);
HouseExtMap_Find = [](HouseClass* houseClass) { return _HouseExtMapFind(_HouseExtMap, houseClass); };

#ifndef USING_MULTIFINITE_SYRINGE
Apply_Ares3_0p1_Patches();
#endif
Expand Down
4 changes: 0 additions & 4 deletions src/Utilities/AresFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class AresFunctions

static bool(__thiscall* IsTargetConstraintsEligible)(void*, HouseClass*, bool);

static void(__thiscall* ApplyAcademy)(void*, TechnoClass* pTechno, AbstractType considerAs);

static std::function<AresSWTypeExtData* (SuperWeaponTypeClass*)> SWTypeExtMap_Find;

static std::function<AresHouseExtData* (HouseClass*)> HouseExtMap_Find;
Expand All @@ -41,7 +39,5 @@ class AresFunctions
static constexpr bool AresWasWrongAboutSpawnSurvivors = _maybe;

static void* _SWTypeExtMap;
static void* _HouseExtMap;
static AresSWTypeExtData* (__thiscall* _SWTypeExtMapFind)(void*, SuperWeaponTypeClass*);
static AresHouseExtData* (__thiscall* _HouseExtMapFind)(void*, HouseClass*);
};
Loading