OpenTTD Source
20240919-master-gdf0233f4c2
|
Go to the documentation of this file.
10 #ifndef LINKGRAPHSCHEDULE_H
11 #define LINKGRAPHSCHEDULE_H
40 typedef std::list<LinkGraph *> GraphList;
41 typedef std::list<LinkGraphJob *> JobList;
61 void ShiftDates(TimerGameEconomy::Date interval);
70 this->schedule.push_back(lg);
static void Clear()
Clear all link graphs and jobs from the schedule.
static Titem * Get(size_t index)
Returns Titem with given index.
void JoinNext()
Join the next finished job, if available.
A connected component of a link graph.
std::span< const struct SaveLoad > SaveLoadTable
A table of SaveLoad entries.
static const uint SPAWN_JOIN_TICK
Tick when jobs are spawned or joined every day.
friend SaveLoadTable GetLinkGraphScheduleDesc()
Get a SaveLoad array for the link graph schedule.
Class for calculation jobs to be run on link graphs.
JobList running
Currently running jobs.
static LinkGraphSchedule instance
Static instance of LinkGraphSchedule.
Tindex index
Index of this pool item.
void SpawnAll()
Start all threads in the running list.
A handler doing "something" on a link graph component.
void Queue(LinkGraph *lg)
Queue a link graph for execution.
void ShiftDates(TimerGameEconomy::Date interval)
Shift all dates (join dates and edge annotations) of link graphs and link graph jobs by the number of...
virtual void Run(LinkGraphJob &job) const =0
Run the handler.
virtual ~ComponentHandler()=default
Destroy the handler.
void SpawnNext()
Start the next job in the schedule.
void AfterLoad_LinkGraphPauseControl()
Pause the game on load if we would do a join with the next link graph job, but it is still running,...
LinkGraphSchedule()
Create a link graph schedule and initialize its handlers.
void StateGameLoop_LinkGraphPauseControl()
Pause the game if in 2 TimerGameEconomy::date_fract ticks, we would do a join with the next link grap...
GraphList schedule
Queue for new jobs.
bool IsJoinWithUnfinishedJobDue() const
Check if the next job is supposed to be finished, but has not yet completed.
static void Run(LinkGraphJob *job)
Run all handlers for the given Job.
ComponentHandler * handlers[6]
Handlers to be run for each job.
void Unqueue(LinkGraph *lg)
Remove a link graph from the execution queue.
~LinkGraphSchedule()
Delete a link graph schedule and its handlers.