Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions src/Ext/HouseType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ void HouseTypeExt::LoadFromINIFile(CCINIClass* pINI)
INI_EX exINI(pINI);

this->EVATag.Read(pINI, pSection, "EVA.Tag");
this->Crew.Read(exINI, pSection, "Crew");
}

template <typename T>
void HouseTypeExt::Serialize(T& Stm)
{
Stm
.Process(this->EVATag)
.Process(this->Crew)
;
}

Expand Down
3 changes: 3 additions & 0 deletions src/Ext/HouseType/Body.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <HouseTypeClass.h>
#include <InfantryTypeClass.h>

#include <Ext/AbstractType/Body.h>
#include <Utilities/Container.h>
Expand All @@ -26,9 +27,11 @@ class HouseTypeExt final : public AbstractTypeExt
}

EVAType EVATag;
Nullable<InfantryTypeClass*> Crew;

HouseTypeExt(HouseTypeClass* OwnerObject) : AbstractTypeExt(OwnerObject)
, EVATag { -2 }
, Crew { nullptr }
{ }

virtual ~HouseTypeExt() = default;
Expand Down
22 changes: 21 additions & 1 deletion src/Ext/HouseType/Hooks.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Body.h"

#include <TechnoClass.h>
#include <Ext/Scenario/Body.h>

DEFINE_HOOK(0x535005, ScenarioClass_LoadSide_SetEVAIndex, 0x6)
Expand Down Expand Up @@ -35,3 +35,23 @@

return 0;
}

DEFINE_HOOK(0x707DCF, TechnoClass_GetCrew_NationalOverride, 0x5)
{
GET(TechnoClass*, pThis, ECX);

if (!pThis)
return 0;

HouseClass* pHouse = pThis->Owner;
if (!pHouse)
return 0;
Comment on lines +41 to +48

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant checks.


auto pHouseTypeExt = HouseTypeExt::ExtMap.Find(pHouse->Type);

Check warning on line 50 in src/Ext/HouseType/Hooks.cpp

View workflow job for this annotation

GitHub Actions / build

'Container<HouseTypeExt>::Find': use the extension class's Fetch instead [D:\a\Phobos\Phobos\Phobos.vcxproj]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find func is now deprecated.

if (pHouseTypeExt && pHouseTypeExt->Crew.isset())
{
R->EAX(pHouseTypeExt->Crew.Get());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect Nullable template usage.


return 0;
}
Loading