| 14308 | } |
| 14309 | |
| 14310 | void GenericGUIMenu::TinkerGUI_t::updateTinkerMenu() |
| 14311 | { |
| 14312 | const int playernum = parentGUI.getPlayer(); |
| 14313 | auto player = players[playernum]; |
| 14314 | |
| 14315 | if ( !player->isLocalPlayer() ) |
| 14316 | { |
| 14317 | closeTinkerMenu(); |
| 14318 | return; |
| 14319 | } |
| 14320 | |
| 14321 | Entity* workStation = nullptr; |
| 14322 | if ( bOpen ) |
| 14323 | { |
| 14324 | if ( parentGUI.workstationEntityUid != 0 ) |
| 14325 | { |
| 14326 | workStation = uidToEntity(parentGUI.workstationEntityUid); |
| 14327 | if ( !workStation ) |
| 14328 | { |
| 14329 | parentGUI.closeGUI(); |
| 14330 | return; |
| 14331 | } |
| 14332 | } |
| 14333 | |
| 14334 | if ( workStation ) |
| 14335 | { |
| 14336 | if ( player->entity && (entityDist(player->entity, workStation) > TOUCHRANGE) ) |
| 14337 | { |
| 14338 | parentGUI.closeGUI(); |
| 14339 | return; |
| 14340 | } |
| 14341 | } |
| 14342 | } |
| 14343 | |
| 14344 | if ( !tinkerFrame ) |
| 14345 | { |
| 14346 | return; |
| 14347 | } |
| 14348 | |
| 14349 | tinkerFrame->setSize(SDL_Rect{ players[playernum]->camera_virtualx1(), |
| 14350 | players[playernum]->camera_virtualy1(), |
| 14351 | tinkerBaseWidth, |
| 14352 | players[playernum]->camera_virtualHeight() }); |
| 14353 | |
| 14354 | bool bConstructDrawerOpen = isConstructMenuActive(); |
| 14355 | if ( !bConstructDrawerOpen ) |
| 14356 | { |
| 14357 | drawerJustifyInverted = false; |
| 14358 | } |
| 14359 | |
| 14360 | if ( !tinkerFrame->isDisabled() && bOpen ) |
| 14361 | { |
| 14362 | if ( !tinkerGUIHasBeenCreated() ) |
| 14363 | { |
| 14364 | createTinkerMenu(); |
| 14365 | } |
| 14366 | |
| 14367 | const real_t fpsScale = getFPSScale(50.0); // ported from 50Hz |
no test coverage detected