MCPcopy Create free account
hub / github.com/TurningWheel/Barony / updateMailMenu

Method updateMailMenu

src/interface/interface.cpp:39030–40412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39028}
39029
39030void GenericGUIMenu::MailboxGui_t::updateMailMenu()
39031{
39032 const int playernum = parentGUI.getPlayer();
39033 auto player = players[playernum];
39034
39035 if ( !player->isLocalPlayer() )
39036 {
39037 closeMailMenu();
39038 return;
39039 }
39040
39041 Entity* mailboxStation = nullptr;
39042 if ( bOpen )
39043 {
39044 if ( parentGUI.mailboxEntityUid != 0 )
39045 {
39046 mailboxStation = uidToEntity(parentGUI.mailboxEntityUid);
39047 if ( !mailboxStation )
39048 {
39049 parentGUI.closeGUI();
39050 return;
39051 }
39052 }
39053
39054 if ( mailboxStation )
39055 {
39056 if ( player->entity && (entityDist(player->entity, mailboxStation) > TOUCHRANGE) )
39057 {
39058 parentGUI.closeGUI();
39059 return;
39060 }
39061 }
39062 }
39063
39064 if ( !mailFrame )
39065 {
39066 return;
39067 }
39068
39069 mailFrame->setSize(SDL_Rect{ players[playernum]->camera_virtualx1(),
39070 players[playernum]->camera_virtualy1(),
39071 mailBaseWidth,
39072 players[playernum]->camera_virtualHeight() });
39073
39074 if ( !mailFrame->isDisabled() && bOpen )
39075 {
39076 if ( !mailGUIHasBeenCreated() )
39077 {
39078 createMailMenu();
39079 }
39080
39081 const real_t fpsScale = getFPSScale(50.0); // ported from 50Hz
39082 real_t setpointDiffX = fpsScale * std::max(.01, (1.0 - animx)) / 2.0;
39083 animx += setpointDiffX;
39084 animx = std::min(1.0, animx);
39085 if ( animx >= .9999 )
39086 {
39087 if ( !bFirstTimeSnapCursor )

Callers 1

ingameHudFunction · 0.80

Calls 15

entityDistFunction · 0.85
getFPSScaleFunction · 0.85
uidToItemFunction · 0.85
itemIsEquippedFunction · 0.85
makeColorFunction · 0.85
charIsWordSeparatorFunction · 0.85
getColorFunction · 0.85
playSoundFunction · 0.85
isLocalPlayerMethod · 0.80

Tested by

no test coverage detected