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

OpenTTD Source 15.3

Functions | Variables
newgrf_actd.cpp File Reference

NewGRF Action 0x0D handler. More...

`#include "../stdafx.h"`
`#include "../debug.h"`
`#include "../newgrf.h"`
`#include "../newgrf_engine.h"`
`#include "../newgrf_cargo.h"`
`#include "../timer/timer_game_calendar.h"`
`#include "../error.h"`
`#include "../engine_func.h"`
`#include "../vehicle_base.h"`
`#include "../rail.h"`
`#include "../road.h"`
`#include "newgrf_bytereader.h"`
`#include "newgrf_internal.h"`
`#include "table/strings.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Functions
void | ResetGRM ()
static void | SafeParamSet (ByteReader &buf)
static uint32_t | GetPatchVariable (uint8_t param)
static uint32_t | PerformGRM (std::span< uint32_t > grm, uint16_t count, uint8_t op, uint8_t target, std::string_view type)
static void | ParamSet (ByteReader &buf)
| Action 0x0D: Set parameter.

## Variables
static std::array< uint32_t, 256 > | _grm_engines {}
| Contains the GRF ID of the owner of a vehicle if it has been reserved.
static std::array< uint32_t, NUM_CARGO *2 > | _grm_cargoes {}
| Contains the GRF ID of the owner of a cargo if it has been reserved.

## Detailed Description

NewGRF Action 0x0D handler.

Definition in file newgrf_actd.cpp.

## Function Documentation

## ◆ GetPatchVariable()

static uint32_t GetPatchVariable | ( | uint8_t | param | ) |
| static

Definition at line 58 of file newgrf_actd.cpp.

## ◆ ParamSet()

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

Action 0x0D: Set parameter.

Definition at line 182 of file newgrf_actd.cpp.

References _engine_counts, _engine_offsets, _grm_cargoes, _grm_engines, _misc_grf_features, _networking, _settings_game, RailTypeInfo::cost_multiplier, VehicleSettings::disable_elrails, DisableGrf(), DisableStaticNewGRFInfluencingNonStaticNewGRFs(), VehicleSettings::dynamic_engines, GRFConfig::flags, GB(), GCS_DISABLED, GetFileByGRFID(), GetGRFConfig(), GRFFile::GetParam(), GrfProcessingState::grfconfig, GrfProcessingState::grffile, HasBit(), GrfProcessingState::nfo_line, RAILTYPE_ELECTRIC, RAILTYPE_END, RAILTYPE_MAGLEV, RAILTYPE_MONO, RAILTYPE_RAIL, ByteReader::ReadByte(), ByteReader::ReadDWord(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), GrfProcessingState::skip_sprites, GrfProcessingState::spriteid, GrfProcessingState::stage, Static, GRFConfig::status, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), GRFFile::traininfo_vehicle_pitch, GRFFile::traininfo_vehicle_width, TrainWidth32Pixels, GameSettings::vehicle, and GRFConfig::version.

## ◆ PerformGRM()

static uint32_t PerformGRM | ( | std::span< uint32_t > | grm,
|  | uint16_t | count,
|  | uint8_t | op,
|  | uint8_t | target,
|  | std::string_view | type
| ) |  |
| static

Definition at line 135 of file newgrf_actd.cpp.

## ◆ ResetGRM()

void ResetGRM | ( |  | ) |

Definition at line 37 of file newgrf_actd.cpp.

## ◆ SafeParamSet()

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

Definition at line 44 of file newgrf_actd.cpp.

## Variable Documentation

## ◆ _grm_cargoes

std::array<uint32_t, NUM_CARGO * 2> _grm_cargoes {}
| static

Contains the GRF ID of the owner of a cargo if it has been reserved.

Definition at line 35 of file newgrf_actd.cpp.

Referenced by ParamSet().

## ◆ _grm_engines

std::array<uint32_t, 256> _grm_engines {}
| static

Contains the GRF ID of the owner of a vehicle if it has been reserved.

GRM for vehicles is only used if dynamic engine allocation is disabled, so 256 is the number of original engines.

Definition at line 32 of file newgrf_actd.cpp.

Referenced by ParamSet().