Skip to content

Commit

Permalink
Merge pull request #1372 from ayrtondenner/remove-brainsucker-pod-fro…
Browse files Browse the repository at this point in the history
…m-alien-containment

Remove brainsucker pod from alien containment
  • Loading branch information
FilmBoy84 committed Mar 15, 2024
2 parents 16608c0 + 09bdbca commit 3273d58
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 11 additions & 3 deletions game/state/city/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,18 @@ int Base::getCapacityUsed(GameState &state, FacilityType::Capacity type) const
}
break;
case FacilityType::Capacity::Aliens:
{
for (auto &e : inventoryBioEquipment)
{
// Brainsucker pod SHOULD NOT be in alien containment math!
if (e.first == "AEQUIPMENTTYPE_BRAINSUCKER_POD" || e.second == 0)
continue;

StateRef<AEquipmentType> ae = {&state, e.first};
total += ae->store_space * e.second;
}
break;
}
break;
case FacilityType::Capacity::Nothing:
// Nothing needs to be handled
break;
Expand Down Expand Up @@ -595,7 +601,9 @@ int Base::getUsage(GameState &state, FacilityType::Capacity type, int delta) con
return used > 0 ? 999 : 0;
}

// + total / 2 due to rounding
return std::min(999, (100 * used + total / 2) / total);
double usageValue = (double)used / total * 100;
int usage = std::min(999, (int)std::round(usageValue));

return usage;
}
}; // namespace OpenApoc
4 changes: 3 additions & 1 deletion game/ui/base/transactionscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ void TransactionScreen::populateControlsAlien()
// Add alien
for (auto &b : state->player_bases)
{
if (b.second->inventoryBioEquipment[ae.first] > 0)
// Removing brainsucker pod from alien containment list
if (b.second->inventoryBioEquipment[ae.first] > 0 &&
ae.first != "AEQUIPMENTTYPE_BRAINSUCKER_POD")
{
auto control = TransactionControl::createControl(
*state, StateRef<AEquipmentType>{state.get(), ae.first}, leftIndex, rightIndex);
Expand Down

0 comments on commit 3273d58

Please sign in to comment.