| 237 | } |
| 238 | |
| 239 | void TransferScreen::closeScreen() |
| 240 | { |
| 241 | auto player = state->getPlayer(); |
| 242 | |
| 243 | // Step 01: Check accommodation of different sorts |
| 244 | { |
| 245 | std::array<int, MAX_BASES> vecCrewDelta; |
| 246 | std::array<int, MAX_BASES> vecCargoDelta; |
| 247 | std::array<int, MAX_BASES> vecBioDelta; |
| 248 | std::array<bool, MAX_BASES> vecChanged; |
| 249 | vecCrewDelta.fill(0); |
| 250 | vecCargoDelta.fill(0); |
| 251 | vecBioDelta.fill(0); |
| 252 | vecChanged.fill(false); |
| 253 | |
| 254 | // Find all delta and mark all that have any changes |
| 255 | std::set<sp<TransactionControl>> linkedControls; |
| 256 | for (auto &l : transactionControls) |
| 257 | { |
| 258 | for (auto &c : l.second) |
| 259 | { |
| 260 | if (linkedControls.find(c) != linkedControls.end()) |
| 261 | { |
| 262 | continue; |
| 263 | } |
| 264 | int i = 0; |
| 265 | for ([[maybe_unused]] auto &b : state->player_bases) |
| 266 | { |
| 267 | int crewDelta = c->getCrewDelta(i); |
| 268 | int cargoDelta = c->getCargoDelta(i); |
| 269 | int bioDelta = c->getBioDelta(i); |
| 270 | if (cargoDelta || bioDelta || crewDelta) |
| 271 | { |
| 272 | vecCrewDelta[i] += crewDelta; |
| 273 | vecCargoDelta[i] += cargoDelta; |
| 274 | vecBioDelta[i] += bioDelta; |
| 275 | vecChanged[i] = true; |
| 276 | } |
| 277 | i++; |
| 278 | } |
| 279 | if (c->getLinked()) |
| 280 | { |
| 281 | for (auto &l : *c->getLinked()) |
| 282 | { |
| 283 | linkedControls.insert(l.lock()); |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | // Check every base, find first bad one |
| 290 | int i = 0; |
| 291 | StateRef<Base> bad_base; |
| 292 | bool cargoOverLimit = false; |
| 293 | bool alienOverLimit = false; |
| 294 | bool crewOverLimit = false; |
| 295 | for (auto &b : state->player_bases) |
| 296 | { |
nothing calls this directly
no test coverage detected