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

Method update

game/ui/tileview/battleview.cpp:1419–1785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1417}
1418
1419void BattleView::update()
1420{
1421 bool realTime = battle.mode == Battle::Mode::RealTime;
1422
1423 // Parent update
1424 BattleTileView::update();
1425
1426 // Update turn based stuff
1427 if (!realTime)
1428 {
1429 if (state->current_battle->hotseat)
1430 {
1431 if (state->current_battle->currentActiveOrganisation !=
1432 state->current_battle->currentPlayer &&
1433 state->current_battle->currentActiveOrganisation != state->getCivilian())
1434 {
1435 fw().stageQueueCommand(
1436 {StageCmd::Command::PUSH,
1437 mksp<MessageBox>(
1438 "Next Turn",
1439 format("%s, it is your turn!",
1440 state->current_battle->currentActiveOrganisation->name),
1441 MessageBox::ButtonOptions::Ok,
1442 [this] {
1443 state->current_battle->currentPlayer =
1444 state->current_battle->currentActiveOrganisation;
1445 })});
1446 updateHiddenForm();
1447 return;
1448 }
1449 }
1450
1451 // Figure out whether our/not our turn state has changed
1452 bool notMyTurn = endTurnRequested || battle.turnEndAllowed ||
1453 !battle.interruptUnits.empty() || !battle.interruptQueue.empty() ||
1454 battle.currentActiveOrganisation != battle.currentPlayer;
1455 if (notMyTurn && activeTab != notMyTurnTab)
1456 {
1457 setSelectedTab(notMyTurnTab);
1458 lastSelectedUnits = battle.battleViewSelectedUnits;
1459 battle.battleViewSelectedUnits.clear();
1460 updateTBButtons();
1461 }
1462 else if (!notMyTurn && activeTab == notMyTurnTab)
1463 {
1464 setSelectedTab(mainTab);
1465 battle.battleViewSelectedUnits = lastSelectedUnits;
1466 updateTBButtons();
1467 }
1468
1469 // Confirmation for units that have unfinished movement
1470 if (endTurnRequested && !unitPendingConfirmation &&
1471 battle.ticksWithoutAction >= TICKS_TRY_END_TURN)
1472 {
1473 for (auto &u : battle.units)
1474 {
1475 if (u.second->owner != battle.currentActiveOrganisation ||
1476 u.second->missions.empty() ||

Callers

nothing calls this directly

Calls 15

zoomAtMethod · 0.95
formatFunction · 0.85
trFunction · 0.85
getCivilianMethod · 0.80
stageQueueCommandMethod · 0.80
emptyMethod · 0.80
endMethod · 0.80
notifyActionMethod · 0.80
insertMethod · 0.80
pushEventMethod · 0.80
getFirstItemInSlotMethod · 0.80
getLongTimeStringMethod · 0.80

Tested by

no test coverage detected