Skip to content

Commit 3f56ed1

Browse files
authored
Revert vanilla behavior changed by e359a87 and b0cd1e0 (#1938)
e359a87 b0cd1e0
1 parent 972e94e commit 3f56ed1

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/Ext/Building/Hooks.Selling.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ bool __forceinline BuildingExt::CanUndeployOnSell(BuildingClass* pThis)
4444
}
4545

4646
// Move ArchiveTarget check outside Conyard check to allow generic Unsellable=no buildings to be sold
47-
return pThis->ArchiveTarget;
47+
const auto pTypeExt = BuildingTypeExt::ExtMap.Find(pType);
48+
return pTypeExt->UndeploysInto_Sellable ? pThis->ArchiveTarget != nullptr : true;
4849
}
4950

5051
// Skip SessionClass::IsCampaign() checks, where inlined not exactly the function above but sth similar

src/Ext/BuildingType/Body.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ void BuildingTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
245245
}
246246

247247
this->Refinery_UseStorage.Read(exINI, pSection, "Refinery.UseStorage");
248+
this->UndeploysInto_Sellable.Read(exINI, pSection, "UndeploysInto.Sellable");
248249

249250
// PlacementPreview
250251
{
@@ -338,6 +339,7 @@ void BuildingTypeExt::ExtData::Serialize(T& Stm)
338339
.Process(this->BuildingRepairedSound)
339340
.Process(this->Refinery_UseNormalActiveAnim)
340341
.Process(this->HasPowerUpAnim)
342+
.Process(this->UndeploysInto_Sellable)
341343

342344
// Ares 0.A
343345
.Process(this->RubbleIntact)

src/Ext/BuildingType/Body.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ class BuildingTypeExt
9999

100100
ValueableVector<bool> HasPowerUpAnim;
101101

102+
Valueable<bool> UndeploysInto_Sellable;
103+
102104
// Ares 0.A
103105
Valueable<BuildingTypeClass*> RubbleIntact;
104106
Valueable<bool> RubbleIntactRemove;
@@ -165,6 +167,7 @@ class BuildingTypeExt
165167
, BuildingRepairedSound {}
166168
, Refinery_UseNormalActiveAnim { false }
167169
, HasPowerUpAnim {}
170+
, UndeploysInto_Sellable { false }
168171

169172
// Ares 0.A
170173
, RubbleIntact { nullptr }

src/Ext/Unit/Hooks.DeploysInto.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ DEFINE_HOOK(0x44A03C, BuildingClass_Mi_Selling_Transfer, 0x6)
9696
TechnoExt::SyncInvulnerability(pStructure, pUnit);
9797
AttachEffectClass::TransferAttachedEffects(pStructure, pUnit);
9898

99-
pUnit->QueueMission(Mission::Hunt, true);
100-
//Why?
99+
// This line will break the bahavior of UnDeploysInto buildings. However, it might serve a purpose that no one knows yet
100+
// Comment out the line instead of removing it for now, so we can turn to it if something related goes wrong in the future
101+
// pUnit->QueueMission(Mission::Hunt, true);
101102
return 0;
102103
}
103104

0 commit comments

Comments
 (0)