MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / attemptCloseScreen

Method attemptCloseScreen

game/ui/general/aequipscreen.cpp:1815–1907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1813}
1814
1815void AEquipScreen::attemptCloseScreen()
1816{
1817 auto owner = state->getPlayer();
1818 if (state->current_battle)
1819 {
1820 owner = state->current_battle->currentPlayer;
1821 }
1822 bool empty = true;
1823 for (auto &entry : vehicleItems)
1824 {
1825 if (!entry.second.empty())
1826 {
1827 empty = false;
1828
1829 for (auto &a : state->agents)
1830 {
1831 if (!checkAgent(a.second, owner))
1832 {
1833 continue;
1834 }
1835
1836 if (getAgentVehicle(a.second) == entry.first)
1837 {
1838 selectAgent(a.second);
1839 break;
1840 }
1841 }
1842 break;
1843 }
1844 }
1845 for (auto &entry : buildingItems)
1846 {
1847 if (!entry.second.empty())
1848 {
1849 empty = false;
1850
1851 for (auto &a : state->agents)
1852 {
1853 if (!checkAgent(a.second, owner))
1854 {
1855 continue;
1856 }
1857
1858 if (getAgentBuilding(a.second) == entry.first)
1859 {
1860 selectAgent(a.second);
1861 break;
1862 }
1863 }
1864 break;
1865 }
1866 }
1867 for (auto &entry : agentItems)
1868 {
1869 if (!entry.second.empty())
1870 {
1871 empty = false;
1872

Callers

nothing calls this directly

Calls 5

closeScreenMethod · 0.95
trFunction · 0.85
getPlayerMethod · 0.80
emptyMethod · 0.80
stageQueueCommandMethod · 0.80

Tested by

no test coverage detected