Skip to content

Commit

Permalink
fix tank bunker filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Aephiex authored Dec 23, 2024
1 parent df6ce6e commit 0f6c255
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Commands/AutoLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ inline static const bool IsMindControlling(TechnoClass* pTechno)
// If return value <= 0 then the building can't be a "transport".
inline static const int GetBuildingPassengerBudget(BuildingClass* pBuilding)
{
auto pBuildingType = abstract_cast<BuildingTypeClass*>(pBuilding->GetTechnoType());
auto pBuildingType = abstract_cast<BuildingTypeClass*>(pBuilding->Type);
// Bio Reactor
if (pBuildingType->Passengers > 0 && pBuildingType->InfantryAbsorb)
{
Expand Down Expand Up @@ -86,6 +86,8 @@ inline static const bool CanBeBuildingPassenger(TechnoClass* pPassenger)
// Tank Bunker
return pPassenger->GetTechnoType()->Turret
&& pPassenger->GetTechnoType()->Bunkerable
&& pPassenger->GetTechnoType()->SpeedType != SpeedType::Hover
&& !abstract_cast<FootClass*>(pPassenger)->ParasiteEatingMe
&& !pPassenger->BunkerLinkedItem;
}
return false;
Expand Down Expand Up @@ -136,7 +138,7 @@ inline static const bool CanHoldPassenger(TechnoClass* pTransport, TechnoClass*
else if (pTransport->WhatAmI() == AbstractType::Building)
{
auto pBuilding = abstract_cast<BuildingClass*>(pTransport);
auto pBuildingType = abstract_cast<BuildingTypeClass*>(pBuilding->GetTechnoType());
auto pBuildingType = abstract_cast<BuildingTypeClass*>(pBuilding->Type);
auto pTypeExt = TechnoTypeExt::ExtMap.Find(pBuildingType);
if (pBuildingType->Passengers > 0 && pBuildingType->InfantryAbsorb)
{
Expand Down Expand Up @@ -187,7 +189,7 @@ inline static bool DeselectMe(TechnoClass* pTransport)
if (pTransport->WhatAmI() == AbstractType::Building)
{
auto pBuilding = abstract_cast<BuildingClass*>(pTransport);
auto pBuildingType = abstract_cast<BuildingTypeClass*>(pBuilding->GetTechnoType());
auto pBuildingType = abstract_cast<BuildingTypeClass*>(pBuilding->Type);
if (pBuildingType->Bunker)
{
pTransport->Deselect();
Expand Down Expand Up @@ -387,14 +389,14 @@ void AutoLoadCommandClass::Execute(WWKey eInput) const
{
if (pTypeExt->CanLoadAny(pTechno, passengerMap, passengerSizes))
{
int const sizeLimit = int(pTechnoType->SizeLimit);
int const sizeLimit = static_cast<int>(pTechnoType->SizeLimit);
transportSizeLimits.insert(sizeLimit);
transportMap[sizeLimit].push_back(std::make_pair(pTechno, budget));
}
else
{
// If it can't actually load any clear passenger, then put it into ambiguousity.
int const size = int(pTechnoType->Size);
int const size = static_cast<int>(pTechnoType->Size);
ambiguousSizes.insert(size);
ambiguousMap[size].push_back(pTechno);
}
Expand Down Expand Up @@ -436,7 +438,7 @@ void AutoLoadCommandClass::Execute(WWKey eInput) const
{
// This unit in ambiguousity is added to transports.
int const budget = GetVehiclePassengerBudget(pAmbiguousTechno);
int const sizeLimit = int(pTechnoType->SizeLimit);
int const sizeLimit = static_cast<int>(pTechnoType->SizeLimit);
transportSizeLimits.insert(sizeLimit);
transportMap[sizeLimit].push_back(std::make_pair(pAmbiguousTechno, budget));
}
Expand Down

0 comments on commit 0f6c255

Please sign in to comment.