forked from mirror/OpenTTD
Add: [Network] Keep the refresh button in lowered state while refreshing (#9600)
This gives user visual feedback that the refresh is still pending, and prevents people from clicking again and again thinking nothing is happening. This is especially true for connections that fall back to TURN, as that takes a few seconds to kick in. Additionally, prevent clicking on the button again while a refresh is pending. This is only delaying a successful result.
This commit is contained in:
@@ -613,6 +613,8 @@ public:
|
||||
sel->info.clients_on >= sel->info.clients_max || // Server full
|
||||
!sel->info.compatible); // Revision mismatch
|
||||
|
||||
this->SetWidgetLoweredState(WID_NG_REFRESH, sel != nullptr && sel->refreshing);
|
||||
|
||||
/* 'NewGRF Settings' button invisible if no NewGRF is used */
|
||||
this->GetWidget<NWidgetStacked>(WID_NG_NEWGRF_SEL)->SetDisplayedPlane(sel == nullptr || sel->status != NGLS_ONLINE || sel->info.grfconfig == nullptr);
|
||||
this->GetWidget<NWidgetStacked>(WID_NG_NEWGRF_MISSING_SEL)->SetDisplayedPlane(sel == nullptr || sel->status != NGLS_ONLINE || sel->info.grfconfig == nullptr || !sel->info.version_compatible || sel->info.compatible);
|
||||
@@ -790,7 +792,7 @@ public:
|
||||
break;
|
||||
|
||||
case WID_NG_REFRESH: // Refresh
|
||||
if (this->server != nullptr) NetworkQueryServer(this->server->connection_string);
|
||||
if (this->server != nullptr && !this->server->refreshing) NetworkQueryServer(this->server->connection_string);
|
||||
break;
|
||||
|
||||
case WID_NG_NEWGRF: // NewGRF Settings
|
||||
|
Reference in New Issue
Block a user