OpenTTD Source 20250331-master-g3c15e0c889
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, const char *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()

◆ PerformGRM()

static uint32_t PerformGRM ( std::span< uint32_t >  grm,
uint16_t  count,
uint8_t  op,
uint8_t  target,
const char *  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().