OpenTTD Source: src/misc/history.cpp File Reference

OpenTTD Source 15.3

Functions
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_history | Mask of valid history records.
  hr | History range to test.
  age | Age 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_history | Valid history records.
  | hr | History range to update mask for.
  | cur_month | Current 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().