OpenTTD
progress.h File Reference

Functions related to modal progress. More...

#include <mutex>

Go to the source code of this file.

Functions

static bool HasModalProgress ()
 Check if we are currently in a modal progress state. More...
 
static bool UseThreadedModelProgress ()
 Check if we can use a thread for modal progress. More...
 
bool IsFirstModalProgressLoop ()
 Check whether this is the first modal progress loop. More...
 
void SetModalProgress (bool state)
 Set the modal progress state. More...
 

Variables

static const uint MODAL_PROGRESS_REDRAW_TIMEOUT = 200
 Timeout between redraws.
 
std::mutex _modal_progress_work_mutex
 Rights for the performing work. More...
 
std::mutex _modal_progress_paint_mutex
 Rights for the painting. More...
 

Detailed Description

Functions related to modal progress.

Definition in file progress.h.

Function Documentation

◆ HasModalProgress()

static bool HasModalProgress ( )
inlinestatic

Check if we are currently in a modal progress state.

Returns
Are we in the modal state?

Definition at line 21 of file progress.h.

References _in_modal_progress.

Referenced by GenerateWorld(), MayBeShown(), and StateGameLoop().

◆ IsFirstModalProgressLoop()

bool IsFirstModalProgressLoop ( )

Check whether this is the first modal progress loop.

Note
Set by SetModalProgress, unset by calling this method.
Returns
True if this is the first loop.

Definition at line 41 of file progress.cpp.

Referenced by UseThreadedModelProgress().

◆ SetModalProgress()

void SetModalProgress ( bool  state)

Set the modal progress state.

Note
Makes IsFirstModalProgressLoop return true for the next call.
Parameters
stateThe new state; are we modal or not?

Definition at line 30 of file progress.cpp.

References _in_modal_progress.

Referenced by DoScanNewGRFFiles(), GenerateWorld(), ScanNewGRFFiles(), and UseThreadedModelProgress().

◆ UseThreadedModelProgress()

static bool UseThreadedModelProgress ( )
inlinestatic

Check if we can use a thread for modal progress.

Returns
Threading usable?

Definition at line 31 of file progress.h.

References _modal_progress_paint_mutex, _modal_progress_work_mutex, _use_threaded_modal_progress, IsFirstModalProgressLoop(), and SetModalProgress().

Referenced by ScanNewGRFFiles().

Variable Documentation

◆ _modal_progress_paint_mutex

std::mutex _modal_progress_paint_mutex

Rights for the painting.

Definition at line 23 of file progress.cpp.

Referenced by GRFFileScanner::AddFile(), DoScanNewGRFFiles(), ScanNewGRFFiles(), UseThreadedModelProgress(), and WaitTillGeneratedWorld().

◆ _modal_progress_work_mutex

std::mutex _modal_progress_work_mutex

Rights for the performing work.

Definition at line 21 of file progress.cpp.

Referenced by GRFFileScanner::AddFile(), DoScanNewGRFFiles(), ScanNewGRFFiles(), UseThreadedModelProgress(), and WaitTillGeneratedWorld().