OpenTTD Source 20250824-master-g98090fe948
history.cpp File Reference

Implementation of functions for storing historical data. More...

#include "../stdafx.h"
#include "../core/bitmath_func.hpp"
#include "history_type.hpp"
#include "history_func.hpp"
#include "../safeguards.h"

Go to the source code of this file.

Functions

void UpdateValidHistory (ValidHistoryMask &valid_history, const HistoryRange &hr, uint cur_month)
 Update mask of valid records for a historical data.
 
bool IsValidHistory (ValidHistoryMask valid_history, const HistoryRange &hr, uint age)
 Test if history data is valid, without extracting data.
 

Detailed Description

Implementation of functions for storing historical data.

Definition in file history.cpp.

Function Documentation

◆ IsValidHistory()

bool IsValidHistory ( ValidHistoryMask  valid_history,
const HistoryRange hr,
uint  age 
)

Test if history data is valid, without extracting data.

Parameters
valid_historyMask of valid history records.
hrHistory range to test.
ageAge of data to test.
Returns
True iff the data for history range and age is valid.

Definition at line 47 of file history.cpp.

References HistoryRange::division, HistoryRange::first, HasBit(), IsValidHistory(), TimerGameEconomy::month, and HistoryRange::periods.

Referenced by FillFromHistory(), and IsValidHistory().

◆ UpdateValidHistory()

void UpdateValidHistory ( ValidHistoryMask valid_history,
const HistoryRange hr,
uint  cur_month 
)

Update mask of valid records for a historical data.

Note
Call only for the largest history range sub-division.
Parameters
[in,out]valid_historyValid history records.
hrHistory range to update mask for.
cur_monthCurrent economy month.

Definition at line 25 of file history.cpp.

References HistoryRange::division, HistoryRange::first, GB(), HasBit(), HistoryRange::last, HistoryRange::records, SB(), HistoryRange::total_division, and UpdateValidHistory().

Referenced by DoCreateNewIndustry(), UpdateIndustryStatistics(), and UpdateValidHistory().