OpenTTD Source 20250331-master-g3c15e0c889
newgrf_actc.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 <http://www.gnu.org/licenses/>.
6 */
7
10#include "../stdafx.h"
11#include "../debug.h"
12#include "../string_func.h"
13#include "newgrf_bytereader.h"
14#include "newgrf_internal.h"
15
16#include "../safeguards.h"
17
18/* Action 0x0C */
19static void GRFComment(ByteReader &buf)
20{
21 /* <0C> [<ignored...>]
22 *
23 * V ignored Anything following the 0C is ignored */
24
25 if (!buf.HasData()) return;
26
27 std::string_view text = buf.ReadString();
28 GrfMsg(2, "GRFComment: {}", StrMakeValid(text));
29}
30
31template <> void GrfActionHandler<0x0C>::FileScan(ByteReader &) { }
34template <> void GrfActionHandler<0x0C>::Init(ByteReader &buf) { GRFComment(buf); }
35template <> void GrfActionHandler<0x0C>::Reserve(ByteReader &) { }
36template <> void GrfActionHandler<0x0C>::Activation(ByteReader &buf) { GRFComment(buf); }
Class to read from a NewGRF file.
std::string_view ReadString()
Read a string.
NewGRF buffer reader definition.
NewGRF internal processing state.
static void StrMakeValid(T &dst, const char *str, const char *last, StringValidationSettings settings)
Copies the valid (UTF-8) characters from str up to last to the dst.
Definition string.cpp:125
GRF action handler.