OpenTTD Source: src/livery.h Source File

OpenTTD Source 15.3

livery.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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef LIVERY_H
11#define LIVERY_H
12
13#include "core/enum_type.hpp"
14#include "company_type.h"
15#include "gfx_type.h"
16
17 static const uint8_t LIT_NONE = 0;
18 static const uint8_t LIT_COMPANY = 1;
19 static const uint8_t LIT_ALL = 2;
20
22 enum LiveryScheme : uint8_t {
23 LS_BEGIN = 0,
24 LS_DEFAULT = 0,
25
26 /* Rail vehicles */
27 LS_STEAM,
28 LS_DIESEL,
29 LS_ELECTRIC,
30 LS_MONORAIL,
31 LS_MAGLEV,
32 LS_DMU,
33 LS_EMU,
34 LS_PASSENGER_WAGON_STEAM,
35 LS_PASSENGER_WAGON_DIESEL,
36 LS_PASSENGER_WAGON_ELECTRIC,
37 LS_PASSENGER_WAGON_MONORAIL,
38 LS_PASSENGER_WAGON_MAGLEV,
39 LS_FREIGHT_WAGON,
40
41 /* Road vehicles */
42 LS_BUS,
43 LS_TRUCK,
44
45 /* Ships */
46 LS_PASSENGER_SHIP,
47 LS_FREIGHT_SHIP,
48
49 /* Aircraft */
50 LS_HELICOPTER,
51 LS_SMALL_PLANE,
52 LS_LARGE_PLANE,
53
54 /* Trams (appear on Road Vehicles tab) */
55 LS_PASSENGER_TRAM,
56 LS_FREIGHT_TRAM,
57
58 LS_END
59};
60
61 DECLARE_INCREMENT_DECREMENT_OPERATORS(LiveryScheme)
62
63
64enum LiveryClass : uint8_t {
65 LC_OTHER,
66 LC_RAIL,
67 LC_ROAD,
68 LC_SHIP,
69 LC_AIRCRAFT,
70 LC_GROUP_RAIL,
71 LC_GROUP_ROAD,
72 LC_GROUP_SHIP,
73 LC_GROUP_AIRCRAFT,
74 LC_END
75};
76 DECLARE_ENUM_AS_ADDABLE(LiveryClass)
77
78
79struct Livery {
80 enum class Flag : uint8_t {
81 Primary = 0,
82 Secondary = 1,
83 };
84 using Flags = EnumBitSet<Flag, uint8_t>;
85
86 Flags in_use{};
87 Colours colour1 = COLOUR_BEGIN;
88 Colours colour2 = COLOUR_BEGIN;
89};
90
91void ResetCompanyLivery(Company *c);
92
93#endif /* LIVERY_H */
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
company_type.h
Types related to companies.
enum_type.hpp
Type (helpers) for enums.
DECLARE_ENUM_AS_ADDABLE
#define DECLARE_ENUM_AS_ADDABLE(EnumType)
Operator that allows this enumeration to be added to any other enumeration.
Definition enum_type.hpp:129
DECLARE_INCREMENT_DECREMENT_OPERATORS
#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type)
For some enums it is useful to have pre/post increment/decrement operators.
Definition enum_type.hpp:63
gfx_type.h
Types related to the graphics and/or input devices.
LIT_ALL
static const uint8_t LIT_ALL
Show the liveries of all companies.
Definition livery.h:19
LiveryScheme
LiveryScheme
List of different livery schemes.
Definition livery.h:22
ResetCompanyLivery
void ResetCompanyLivery(Company *c)
Reset the livery schemes to the company's primary colour.
Definition company_cmd.cpp:574
LIT_COMPANY
static const uint8_t LIT_COMPANY
Show the liveries of your own company.
Definition livery.h:18
LIT_NONE
static const uint8_t LIT_NONE
Don't show the liveries at all.
Definition livery.h:17
LiveryClass
LiveryClass
List of different livery classes, used only by the livery GUI.
Definition livery.h:64
Company
Definition company_base.h:127
Livery
Information about a particular livery.
Definition livery.h:79
Livery::Flag
Flag
Definition livery.h:80