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

OpenTTD Source 15.3

Functions
newgrf_act0_cargo.cpp File Reference

NewGRF Action 0x00 handler for cargo. More...

`#include "../stdafx.h"`
`#include "../debug.h"`
`#include "../newgrf_cargo.h"`
`#include "newgrf_bytereader.h"`
`#include "newgrf_internal.h"`
`#include "newgrf_stringmapping.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Functions
static void | MaybeInstallFallbackCargoLabel (uint id, uint last, CargoLabel label)
| Install cargo label in a fallback cargo list, if a NewGRF-defined cargo list is not present.
static ChangeInfoResult | CargoReserveInfo (uint first, uint last, int prop, ByteReader &buf)
| Define properties for cargoes.

## Detailed Description

NewGRF Action 0x00 handler for cargo.

Definition in file newgrf_act0_cargo.cpp.

## Function Documentation

## ◆ CargoReserveInfo()

static ChangeInfoResult CargoReserveInfo | ( | uint | first,
|  | uint | last,
|  | int | prop,
|  | ByteReader & | buf
| ) |  |
| static

Define properties for cargoes.

Parameters

  first | ID of the first cargo.
  last | ID of the last cargo.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 50 of file newgrf_act0_cargo.cpp.

References _cargo_mask, CargoSpec::abbrev, AddStringForMapping(), CargoSpec::bitnum, BuildCargoLabelMap(), CargoSpec::callback_mask, CIR_INVALID_ID, CIR_SUCCESS, CIR_UNKNOWN, CargoSpec::classes, ClrBit(), CargoSpec::Get(), CargoSpec::grffile, GrfProcessingState::grffile, CargoSpec::initial_payment, CargoSpec::is_freight, CargoSpec::IsValid(), CargoSpec::label, MaybeInstallFallbackCargoLabel(), CargoSpec::multiplier, CargoSpec::name, CargoSpec::name_single, NUM_CARGO, CargoSpec::quantifier, ByteReader::ReadByte(), ByteReader::ReadDWord(), ByteReader::ReadWord(), SetBit(), CargoSpec::sprite, TAE_FOOD, TAE_GOODS, TAE_MAIL, TAE_NONE, TAE_PASSENGERS, TAE_WATER, CargoSpec::town_acceptance_effect, CargoSpec::town_production_effect, CargoSpec::town_production_multiplier, TPE_MAIL, TPE_NONE, TPE_PASSENGERS, CargoSpec::units_volume, and CargoSpec::weight.

## ◆ MaybeInstallFallbackCargoLabel()

static void MaybeInstallFallbackCargoLabel | ( | uint | id,
|  | uint | last,
|  | CargoLabel | label
| ) |  |
| static

Install cargo label in a fallback cargo list, if a NewGRF-defined cargo list is not present.

This allows this NewGRF to use its self-defined cargo types without needing an explicit translation table.

Parameters

  id | ID of the cargo.
  last | ID of the last cargo being set up.
  label | Label to install.

Definition at line 26 of file newgrf_act0_cargo.cpp.

References GRFFile::cargo_list, GRFFile::cargo_list_is_fallback, CT_INVALID, GetCargoTranslationTable(), and GrfProcessingState::grffile.

Referenced by CargoReserveInfo().