OpenTTD Source 20250312-master-gcdcc6b491d
subsidy_cmd.h
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#ifndef SUBSIDY_CMD_H
11#define SUBSIDY_CMD_H
12
13#include "command_type.h"
14#include "cargo_type.h"
15#include "source_type.h"
17
19
21
22
23template <typename Tcont, typename Titer>
24inline EndianBufferWriter<Tcont, Titer> &operator <<(EndianBufferWriter<Tcont, Titer> &buffer, const Source &source)
25{
26 return buffer << source.id << source.type;
27}
28
29inline EndianBufferReader &operator >>(EndianBufferReader &buffer, Source &source)
30{
31 return buffer >> source.id >> source.type;
32}
33
34#endif /* SUBSIDY_CMD_H */
Types related to cargoes...
uint8_t CargoType
Cargo slots to indicate a cargo type within a game.
Definition cargo_type.h:23
Common return value for all commands.
Endian-aware buffer adapter that always reads values in little endian order.
Endian-aware buffer adapter that always writes values in little endian order.
Enum-as-bit-set wrapper.
Types related to commands.
@ CMDT_OTHER_MANAGEMENT
Renaming stuff, changing company colours, placing signs, etc.
@ Deity
the command may be executed by COMPANY_DEITY
@ CMD_CREATE_SUBSIDY
create a new subsidy
Endian-aware buffer.
Type for the source of cargo.
A location from where cargo can come from (or go to).
Definition source_type.h:32
SourceID id
Index of industry/town/HQ, Source::Invalid if unknown/invalid.
Definition source_type.h:36
SourceType type
Type of source_id.
Definition source_type.h:37
CommandCost CmdCreateSubsidy(DoCommandFlags flags, CargoType cargo_type, Source src, Source dst)
Create a new subsidy.
Definition subsidy.cpp:196