OpenTTD Source: src/newgrf/newgrf_act0.cpp File Reference

OpenTTD Source 15.0-RC2

Data Structures | Functions
newgrf_act0.cpp File Reference

NewGRF Action 0x00 handler. More...

`#include "../stdafx.h"`
`#include "../debug.h"`
`#include "../newgrf_engine.h"`
`#include "../newgrf_badge.h"`
`#include "../newgrf_badge_type.h"`
`#include "../newgrf_cargo.h"`
`#include "../timer/timer_game_calendar.h"`
`#include "../error.h"`
`#include "../vehicle_base.h"`
`#include "newgrf_bytereader.h"`
`#include "newgrf_internal.h"`
`#include "table/strings.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | InvokeGrfChangeInfoHandler
| Helper class to invoke a GrfChangeInfoHandler. More...

## Functions
ChangeInfoResult | CommonVehicleChangeInfo (EngineInfo *ei, int prop, ByteReader &buf)
| Define properties common to all vehicles.
void | SkipBadgeList (ByteReader &buf)
| Skip a list of badges.
std::vector< BadgeID > | ReadBadgeList (ByteReader &buf, GrfSpecFeature feature)
| Read a list of badges.
bool | HandleChangeInfoResult (std::string_view caller, ChangeInfoResult cir, GrfSpecFeature feature, uint8_t property)
static void | FeatureChangeInfo (ByteReader &buf)
static void | SafeChangeInfo (ByteReader &buf)
static void | ReserveChangeInfo (ByteReader &buf)

## Detailed Description

NewGRF Action 0x00 handler.

Definition in file newgrf_act0.cpp.

## Function Documentation

## ◆ CommonVehicleChangeInfo()

ChangeInfoResult CommonVehicleChangeInfo | ( | EngineInfo * | ei,
|  | int | prop,
|  | ByteReader & | buf
| ) |  |

Define properties common to all vehicles.

Parameters

  ei | Engine info.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 33 of file newgrf_act0.cpp.

References EngineInfo::base_intro, EngineInfo::base_life, CIR_SUCCESS, CIR_UNKNOWN, EngineInfo::climates, TimerGameConst< struct Calendar >::DAYS_TILL_ORIGINAL_BASE_YEAR, EngineInfo::lifelength, PROP_VEHICLE_LOAD_AMOUNT, ByteReader::ReadByte(), and ByteReader::ReadWord().

Referenced by AircraftVehicleChangeInfo(), RailVehicleChangeInfo(), RoadVehicleChangeInfo(), and ShipVehicleChangeInfo().

## ◆ FeatureChangeInfo()

static void FeatureChangeInfo | ( | ByteReader & | buf | ) |
| static

Definition at line 172 of file newgrf_act0.cpp.

## ◆ HandleChangeInfoResult()

bool HandleChangeInfoResult | ( | std::string_view | caller,
|  | ChangeInfoResult | cir,
|  | GrfSpecFeature | feature,
|  | uint8_t | property
| ) |  |

Definition at line 112 of file newgrf_act0.cpp.

## ◆ ReadBadgeList()

std::vector< BadgeID > ReadBadgeList | ( | ByteReader & | buf,
|  | GrfSpecFeature | feature
| ) |  |

Read a list of badges.

Parameters

  buf | Buffer reader containing list of badges to read.
  feature | The feature of the badge list.

Returns
  list of badges.

Definition at line 86 of file newgrf_act0.cpp.

References GRFFile::badge_list, GrfProcessingState::grffile, MarkBadgeSeen(), and ByteReader::ReadWord().

Referenced by AircraftVehicleChangeInfo(), AirportChangeInfo(), IndustriesChangeInfo(), IndustrytilesChangeInfo(), ObjectChangeInfo(), RailTypeChangeInfo(), RailVehicleChangeInfo(), RoadTypeChangeInfo(), RoadVehicleChangeInfo(), ShipVehicleChangeInfo(), StationChangeInfo(), and TownHouseChangeInfo().

## ◆ ReserveChangeInfo()

static void ReserveChangeInfo | ( | ByteReader & | buf | ) |
| static

Definition at line 252 of file newgrf_act0.cpp.

## ◆ SafeChangeInfo()

static void SafeChangeInfo | ( | ByteReader & | buf | ) |
| static

Definition at line 218 of file newgrf_act0.cpp.

## ◆ SkipBadgeList()

void SkipBadgeList | ( | ByteReader & | buf | ) |

Skip a list of badges.

Parameters

  buf | Buffer reader containing list of badges to skip.

Definition at line 72 of file newgrf_act0.cpp.

References ByteReader::ReadWord().

Referenced by IgnoreIndustryProperty(), IgnoreObjectProperty(), and IgnoreRoadStopProperty().