OpenTTD Source 20260311-master-g511d3794ce
newgrf_act10.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#include "../stdafx.h"
11#include "../debug.h"
12#include "newgrf_bytereader.h"
13#include "newgrf_internal.h"
14
15#include "../safeguards.h"
16
21static void DefineGotoLabel(ByteReader &buf)
22{
23 /* <10> <label> [<comment>]
24 *
25 * B label The label to define
26 * V comment Optional comment - ignored */
27
28 uint8_t nfo_label = buf.ReadByte();
29
30 _cur_gps.grffile->labels.emplace_back(nfo_label, _cur_gps.nfo_line, _cur_gps.file->GetPos());
31
32 GrfMsg(2, "DefineGotoLabel: GOTO target with label 0x{:02X}", nfo_label);
33}
34
Class to read from a NewGRF file.
uint8_t ReadByte()
Read a single byte (8 bits).
Functions related to debugging.
static void DefineGotoLabel(ByteReader &buf)
Action 0x10 - Define goto label.
NewGRF buffer reader definition.
NewGRF internal processing state.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
static void FileScan(ByteReader &buf)
Implementation of the GrfLoadingStage::FileScan stage of this action.
static void SafetyScan(ByteReader &buf)
Implementation of the GrfLoadingStage::SafetyScan stage of this action.
static void Reserve(ByteReader &buf)
Implementation of the GrfLoadingStage::Reserve stage of this action.
static void Activation(ByteReader &buf)
Implementation of the GrfLoadingStage::Activation stage of this action.
static void Init(ByteReader &buf)
Implementation of the GrfLoadingStage::Init stage of this action.
static void LabelScan(ByteReader &buf)
Implementation of the GrfLoadingStage::LabelScan stage of this action.