Skip to content

Commit

Permalink
Improved research/production/prisoner overview
Browse files Browse the repository at this point in the history
Global research shows also bases with no ongoing research, but scientists available.
Global production shows also bases with no ongoing production, but engineers available.
Global prison shows also bases with no prisoners, but prison space available.
  • Loading branch information
MeridianOXC committed Dec 31, 2023
1 parent c131405 commit 6496f77
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/Basescape/GlobalAlienContainmentState.cpp
Expand Up @@ -144,10 +144,15 @@ void GlobalAlienContainmentState::fillPrisonerList()

for (auto* xbase : *_game->getSavedGame()->getBases())
{
bool displayed = false;
int totalBaseCapacity = 0;

// determine prison types used in the base
std::set<int> occupiedPrisonTypes;
for(int prisonType : prisonTypes)
{
totalBaseCapacity += xbase->getAvailableContainment(prisonType);

for(auto* baseFacility : *xbase->getFacilities())
{
if(baseFacility->getRules()->getAliens() > 0 && baseFacility->getRules()->getPrisonType() == prisonType)
Expand Down Expand Up @@ -185,6 +190,7 @@ void GlobalAlienContainmentState::fillPrisonerList()
_lstPrisoners->addRow(3, baseNameAndPrisonType.c_str(), "", "");
_lstPrisoners->setRowColor(_lstPrisoners->getLastRowIndex(), _lstPrisoners->getSecondaryColor());
_topics.push_back(std::make_tuple("", nullptr, 0));
displayed = true;

for (auto& itemType : _game->getMod()->getItemsList())
{
Expand Down Expand Up @@ -222,6 +228,16 @@ void GlobalAlienContainmentState::fillPrisonerList()
totalInterrogated++;
}
}

if (!displayed && totalBaseCapacity > 0)
{
_lstPrisoners->addRow(3, xbase->getName(_game->getLanguage()).c_str(), "", "");
_lstPrisoners->setRowColor(_lstPrisoners->getLastRowIndex(), _lstPrisoners->getSecondaryColor());
_topics.push_back(std::make_tuple("", nullptr, 0));

_lstPrisoners->addRow(3, tr("STR_NONE").c_str(), "", "");
_topics.push_back(std::make_tuple("", xbase, 0));
}
}

_txtTotalUsed->setText(tr("STR_TOTAL_IN_PRISON").arg(totalUsed));
Expand Down
9 changes: 8 additions & 1 deletion src/Basescape/GlobalManufactureState.cpp
Expand Up @@ -203,7 +203,7 @@ void GlobalManufactureState::fillProductionList()
for (Base *xbase : *_game->getSavedGame()->getBases())
{
auto& baseProductions = xbase->getProductions();
if (!baseProductions.empty())
if (!baseProductions.empty() || xbase->getEngineers() > 0)
{
std::string baseName = xbase->getName(_game->getLanguage());
_lstManufacture->addRow(3, baseName.c_str(), "", "");
Expand Down Expand Up @@ -249,6 +249,13 @@ void GlobalManufactureState::fillProductionList()
_bases.push_back(xbase);
_topics.push_back(prod->getRules());
}
if (baseProductions.empty() && xbase->getEngineers() > 0)
{
_lstManufacture->addRow(5, tr("STR_NONE").c_str(), "", "", "", "");

_bases.push_back(xbase);
_topics.push_back(0);
}

availableEngineers += xbase->getAvailableEngineers();
allocatedEngineers += xbase->getAllocatedEngineers();
Expand Down
9 changes: 8 additions & 1 deletion src/Basescape/GlobalResearchState.cpp
Expand Up @@ -177,7 +177,7 @@ void GlobalResearchState::fillProjectList()
for (Base *xbase : *_game->getSavedGame()->getBases())
{
auto& baseProjects = xbase->getResearch();
if (!baseProjects.empty())
if (!baseProjects.empty() || xbase->getScientists() > 0)
{
std::string baseName = xbase->getName(_game->getLanguage());
_lstResearch->addRow(3, baseName.c_str(), "", "");
Expand All @@ -199,6 +199,13 @@ void GlobalResearchState::fillProjectList()
_bases.push_back(xbase);
_topics.push_back(r);
}
if (baseProjects.empty() && xbase->getScientists() > 0)
{
_lstResearch->addRow(3, tr("STR_NONE").c_str(), "", "");

_bases.push_back(xbase);
_topics.push_back(0);
}

availableScientists += xbase->getAvailableScientists();
allocatedScientists += xbase->getAllocatedScientists();
Expand Down

0 comments on commit 6496f77

Please sign in to comment.