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

Method globeClick

src/Geoscape/GeoscapeState.cpp:1787–1811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1785 */
1786
1787void GeoscapeState::globeClick(Action *action)
1788{
1789 int mouseX = (int)floor(action->getAbsoluteXMouse()), mouseY = (int)floor(action->getAbsoluteYMouse());
1790
1791 // Clicking markers on the globe
1792 if (action->getDetails()->button.button == SDL_BUTTON_LEFT)
1793 {
1794 std::vector<Target*> v = _globe->getTargets(mouseX, mouseY, false);
1795 if (!v.empty())
1796 {
1797 _game->pushState(new MultipleTargetsState(_game, v, 0, this));
1798 }
1799 }
1800
1801 if (_game->getSavedGame()->getDebugMode())
1802 {
1803 double lon, lat;
1804 _globe->cartToPolar(mouseX, mouseY, &lon, &lat);
1805 double lonDeg = lon / M_PI * 180, latDeg = lat / M_PI * 180;
1806 std::wostringstream ss;
1807 ss << "rad: " << lon << " , " << lat << std::endl;
1808 ss << "deg: " << lonDeg << " , " << latDeg << std::endl;
1809 _txtDebug->setText(ss.str());
1810 }
1811}
1812
1813/**
1814 * Opens the Intercept window.

Callers

nothing calls this directly

Calls 10

getAbsoluteXMouseMethod · 0.80
getAbsoluteYMouseMethod · 0.80
getDetailsMethod · 0.80
getTargetsMethod · 0.80
pushStateMethod · 0.80
getSavedGameMethod · 0.80
cartToPolarMethod · 0.80
emptyMethod · 0.45
getDebugModeMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected