Change various _network_dedicated tests to use IsHeadless
This commit is contained in:
@@ -243,7 +243,7 @@ void ShowHighscoreTable(int difficulty, int8_t ranking)
|
||||
void ShowEndGameChart()
|
||||
{
|
||||
/* Dedicated server doesn't need the highscore window and neither does -v null. */
|
||||
if (_network_dedicated || (!_networking && !Company::IsValidID(_local_company))) return;
|
||||
if (IsHeadless() || (!_networking && !Company::IsValidID(_local_company))) return;
|
||||
|
||||
HideVitalWindows();
|
||||
CloseWindowByClass(WC_ENDSCREEN);
|
||||
|
@@ -23,7 +23,7 @@ bool _last_plan_visibility_check_result = false;
|
||||
|
||||
void PlanLine::UpdateVisualExtents()
|
||||
{
|
||||
if (_network_dedicated) return;
|
||||
if (IsHeadless()) return;
|
||||
|
||||
if (this->tiles.size() < 2) {
|
||||
this->viewport_extents = { INT_MAX, INT_MAX, INT_MAX, INT_MAX };
|
||||
|
@@ -47,7 +47,7 @@
|
||||
|
||||
/* static */ void ScriptController::Break(const std::string &message)
|
||||
{
|
||||
if (_network_dedicated || !_settings_client.gui.ai_developer_tools) return;
|
||||
if (IsHeadless() || !_settings_client.gui.ai_developer_tools) return;
|
||||
|
||||
ScriptObject::GetActiveInstance()->Pause();
|
||||
|
||||
|
@@ -1747,7 +1747,7 @@ void TraceRestrictCheckRefreshSignals(const TraceRestrictProgram *prog, size_t o
|
||||
}
|
||||
}
|
||||
|
||||
if (_network_dedicated) return;
|
||||
if (IsHeadless()) return;
|
||||
|
||||
if (!((old_actions_used_flags ^ prog->actions_used_flags) & (TRPAUF_RESERVE_THROUGH_ALWAYS | TRPAUF_REVERSE))) return;
|
||||
|
||||
|
@@ -7511,7 +7511,7 @@ void TrainBrakesOverheatedBreakdown(Vehicle *v)
|
||||
Train *t = Train::From(v)->First();
|
||||
if (t->breakdown_ctr != 0 || (t->vehstatus & VS_CRASHED)) return;
|
||||
|
||||
if (unlikely(HasBit(_misc_debug_flags, MDF_OVERHEAT_BREAKDOWN_OPEN_WIN)) && !_network_dedicated) {
|
||||
if (unlikely(HasBit(_misc_debug_flags, MDF_OVERHEAT_BREAKDOWN_OPEN_WIN)) && !IsHeadless()) {
|
||||
ShowVehicleViewWindow(t);
|
||||
}
|
||||
|
||||
|
@@ -2721,7 +2721,7 @@ void VehicleEnterDepot(Vehicle *v)
|
||||
void Vehicle::UpdateViewport(bool dirty)
|
||||
{
|
||||
/* Skip updating sprites on dedicated servers without screen */
|
||||
if (_network_dedicated) return;
|
||||
if (IsHeadless()) return;
|
||||
|
||||
Rect new_coord = ConvertRect<Rect16, Rect>(this->sprite_seq_bounds);
|
||||
|
||||
|
@@ -1483,7 +1483,7 @@ public:
|
||||
inline void UpdateViewport(bool force_update, bool update_delta)
|
||||
{
|
||||
/* Skip updating sprites on dedicated servers without screen */
|
||||
if (_network_dedicated) return;
|
||||
if (IsHeadless()) return;
|
||||
|
||||
/* Explicitly choose method to call to prevent vtable dereference -
|
||||
* it gives ~3% runtime improvements in games with many vehicles */
|
||||
|
@@ -1971,7 +1971,7 @@ static void DecreaseWindowCounters()
|
||||
if (hundredth_tick_timeout != 0) hundredth_tick_timeout--;
|
||||
|
||||
for (Window *w : Window::IterateFromFront()) {
|
||||
if (!_network_dedicated && hundredth_tick_timeout == 0) w->OnHundredthTick();
|
||||
if (!IsHeadless() && hundredth_tick_timeout == 0) w->OnHundredthTick();
|
||||
|
||||
if (_scroller_click_timeout == 0) {
|
||||
/* Unclick scrollbar buttons if they are pressed. */
|
||||
@@ -3277,7 +3277,7 @@ void UpdateWindows()
|
||||
|
||||
static GUITimer window_timer = GUITimer(1);
|
||||
if (window_timer.Elapsed(delta_ms)) {
|
||||
if (_network_dedicated) window_timer.SetInterval(MILLISECONDS_PER_TICK);
|
||||
if (IsHeadless()) window_timer.SetInterval(MILLISECONDS_PER_TICK);
|
||||
|
||||
extern int _caret_timer;
|
||||
_caret_timer += 3;
|
||||
@@ -3298,7 +3298,7 @@ void UpdateWindows()
|
||||
|
||||
/* Skip the actual drawing on dedicated servers without screen.
|
||||
* But still empty the invalidation queues above. */
|
||||
if (_network_dedicated) return;
|
||||
if (IsHeadless()) return;
|
||||
|
||||
if (window_timer.HasElapsed()) {
|
||||
window_timer.SetInterval(MILLISECONDS_PER_TICK);
|
||||
|
Reference in New Issue
Block a user