MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / handleRightReleased

Function handleRightReleased

src/OpenLoco/src/Ui/ViewportInteraction.cpp:1286–1468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1284 }
1285
1286 void handleRightReleased(Window* window, int16_t xPos, int16_t yPos)
1287 {
1288 auto interaction = ViewportInteraction::rightOver(xPos, yPos);
1289
1290 auto* tileElement = reinterpret_cast<World::TileElement*>(interaction.object);
1291
1292 switch (interaction.type)
1293 {
1294 case InteractionItem::noInteraction:
1295 default:
1296 {
1297 auto item2 = ViewportInteraction::getItemLeft(xPos, yPos);
1298 switch (item2.type)
1299 {
1300 case InteractionItem::entity:
1301 {
1302 auto* entity = reinterpret_cast<EntityBase*>(item2.object);
1303 auto* veh = entity->asBase<Vehicles::VehicleBase>();
1304 if (veh != nullptr)
1305 {
1306 auto* head = EntityManager::get<Vehicles::VehicleHead>(veh->getHead());
1307 if (head != nullptr)
1308 {
1309 Ui::Windows::VehicleList::open(head->owner, head->vehicleType);
1310 }
1311 }
1312 break;
1313 }
1314 case InteractionItem::townLabel:
1315 Ui::Windows::TownList::open();
1316 break;
1317 case InteractionItem::stationLabel:
1318 {
1319 auto station = StationManager::get(StationId(item2.value));
1320 Ui::Windows::StationList::open(station->owner);
1321 break;
1322 }
1323 case InteractionItem::industry:
1324 Ui::Windows::IndustryList::open();
1325 break;
1326 default:
1327 break;
1328 }
1329
1330 break;
1331 }
1332
1333 case InteractionItem::track:
1334 {
1335 auto* track = tileElement->as<TrackElement>();
1336 if (track != nullptr)
1337 {
1338 if (track->owner() == CompanyManager::getControllingId())
1339 {
1340 Ui::Windows::Construction::openAtTrack(*window, track, interaction.pos);
1341 }
1342 else
1343 {

Callers 1

stateViewportRightFunction · 0.85

Calls 15

rightOverFunction · 0.85
getItemLeftFunction · 0.85
StationIdEnum · 0.85
getControllingIdFunction · 0.85
openAtTrackFunction · 0.85
openAtRoadFunction · 0.85
rightReleasedTrackExtraFunction · 0.85
rightReleaseRoadExtraFunction · 0.85
rightReleasedSignalFunction · 0.85
rightReleasedRoadStationFunction · 0.85
rightReleasedAirportFunction · 0.85

Tested by

no test coverage detected