MCPcopy Create free account
hub / github.com/Phobos-developers/Phobos / IsAvailable

Method IsAvailable

src/Ext/SWType/SWHelpers.cpp:165–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165bool SWTypeExt::ExtData::IsAvailable(HouseClass* pHouse) const
166{
167 const auto pThis = this->OwnerObject();
168
169 // check whether the optional aux building exists
170 if (pThis->AuxBuilding && pHouse->CountOwnedAndPresent(pThis->AuxBuilding) <= 0)
171 return false;
172
173 // allow only certain houses, disallow forbidden houses
174 const auto OwnerBits = 1u << pHouse->Type->ArrayIndex;
175
176 if (!(this->SW_RequiredHouses & OwnerBits) || (this->SW_ForbiddenHouses & OwnerBits))
177 return false;
178
179 // check that any aux building exist and no neg building
180 auto IsBuildingPresent = [pHouse](BuildingTypeClass* pType)
181 {
182 return pType && pHouse->CountOwnedAndPresent(pType) > 0;
183 };
184
185 const auto& Aux = this->SW_AuxBuildings;
186
187 if (!Aux.empty() && std::none_of(Aux.begin(), Aux.end(), IsBuildingPresent))
188 return false;
189
190 const auto& Neg = this->SW_NegBuildings;
191
192 if (std::any_of(Neg.begin(), Neg.end(), IsBuildingPresent))
193 return false;
194
195 return true;
196}
197
198std::vector<BuildingClass*> SWTypeExt::ExtData::GetEMPulseCannons(HouseClass* pOwner, const CellStruct& cell) const
199{

Callers 3

GetSuperWeaponIndexMethod · 0.45
Hooks.Pips.cppFile · 0.45
UpdateTemporalMethod · 0.45

Calls 3

emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected