MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / btnVisibleUnitClick

Method btnVisibleUnitClick

src/Battlescape/BattlescapeState.cpp:1130–1149  ·  view source on GitHub ↗

* Centers on the unit corresponding to this button. * @param action Pointer to an action. */

Source from the content-addressed store, hash-verified

1128 * @param action Pointer to an action.
1129 */
1130void BattlescapeState::btnVisibleUnitClick(Action *action)
1131{
1132 int btnID = -1;
1133
1134 // got to find out which button was pressed
1135 for (int i = 0; i < VISIBLE_MAX && btnID == -1; ++i)
1136 {
1137 if (action->getSender() == _btnVisibleUnit[i])
1138 {
1139 btnID = i;
1140 }
1141 }
1142
1143 if (btnID != -1)
1144 {
1145 _map->getCamera()->centerOnPosition(_visibleUnit[btnID]->getPosition());
1146 }
1147
1148 action->getDetails()->type = SDL_NOEVENT; // consume the event
1149}
1150
1151/**
1152 * Launches the blaster bomb.

Callers

nothing calls this directly

Calls 5

getSenderMethod · 0.80
centerOnPositionMethod · 0.80
getCameraMethod · 0.80
getDetailsMethod · 0.80
getPositionMethod · 0.45

Tested by

no test coverage detected