OpenTTD Source 20260621-master-g720d10536d
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
9
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
17static const uint8_t LIT_NONE = 0;
18static const uint8_t LIT_COMPANY = 1;
19static const uint8_t LIT_ALL = 2;
20
60
62
63
65
78
80
81
82struct Livery {
84 enum class Flag : uint8_t {
85 Primary = 0,
86 Secondary = 1,
87 };
88
91
95
101 inline uint8_t GetRecolourOffset(bool use_secondary = true) const
102 {
103 return use_secondary ? to_underlying(this->colour1) + to_underlying(this->colour2) * 16 : to_underlying(this->colour1);
104 }
105};
106
108
109#endif /* LIVERY_H */
Enum-as-bit-set wrapper.
Types related to companies.
Type (helpers) for enums.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23).
Definition enum_type.hpp:21
#define DECLARE_ENUM_AS_ADDABLE(EnumType)
Operator that allows this enumeration to be added to any other enumeration.
Types related to the graphics and/or input devices.
Colours
One of 16 base colours used for companies and windows/widgets.
Definition gfx_type.h:284
@ Begin
Begin marker.
Definition gfx_type.h:285
static const uint8_t LIT_ALL
Show the liveries of all companies.
Definition livery.h:19
EnumBitSet< LiveryScheme, uint32_t, LiveryScheme::End > LiverySchemes
Bitset of LiveryScheme elements.
Definition livery.h:64
LiveryScheme
List of different livery schemes.
Definition livery.h:22
@ PassengerTram
Passenger trams.
Definition livery.h:55
@ Begin
Begin marker.
Definition livery.h:23
@ SmallPlane
Small aeroplanes.
Definition livery.h:51
@ PassengerWagonMaglev
Passenger wagons attached to maglev engines.
Definition livery.h:38
@ Helicopter
Helicopters.
Definition livery.h:50
@ PassengerWagonElectric
Passenger wagons attached to electric engines.
Definition livery.h:36
@ Maglev
Maglev engines.
Definition livery.h:31
@ Steam
Steam engines.
Definition livery.h:27
@ PassengerShip
Passenger ships.
Definition livery.h:46
@ EMU
EMUs and their passenger wagons.
Definition livery.h:33
@ Bus
Buses.
Definition livery.h:42
@ Truck
Trucks.
Definition livery.h:43
@ Diesel
Diesel engines.
Definition livery.h:28
@ Default
Default scheme.
Definition livery.h:24
@ End
End marker.
Definition livery.h:58
@ PassengerWagonDiesel
Passenger wagons attached to diesel engines.
Definition livery.h:35
@ FreightShip
Freight ships.
Definition livery.h:47
@ Electric
Electric engines.
Definition livery.h:29
@ PassengerWagonMonorail
Passenger wagons attached to monorail engines.
Definition livery.h:37
@ Monorail
Monorail engines.
Definition livery.h:30
@ FreightTram
Freight trams.
Definition livery.h:56
@ PassengerWagonSteam
Passenger wagons attached to steam engines.
Definition livery.h:34
@ LargePlane
Large aeroplanes.
Definition livery.h:52
@ FreightWagon
Freight wagons.
Definition livery.h:39
@ DMU
DMUs and their passenger wagons.
Definition livery.h:32
void ResetCompanyLivery(Company *c)
Reset the livery schemes to the company's primary colour.
static const uint8_t LIT_COMPANY
Show the liveries of your own company.
Definition livery.h:18
static const uint8_t LIT_NONE
Don't show the liveries at all.
Definition livery.h:17
LiveryClass
List of different livery classes, used only by the livery GUI.
Definition livery.h:67
@ GroupShip
Ship group.
Definition livery.h:75
@ Rail
Rail livery schemes.
Definition livery.h:69
@ Other
General livery schemes.
Definition livery.h:68
@ GroupRail
Rail group.
Definition livery.h:73
@ GroupAircraft
Aircraft group.
Definition livery.h:76
@ GroupRoad
Road group.
Definition livery.h:74
@ Road
Road livery schemes.
Definition livery.h:70
Aircraft, helicopters, rotors and their shadows belong to this class.
Definition aircraft.h:75
Information about a particular livery.
Definition livery.h:82
EnumBitSet< Flag, uint8_t > Flags
Bitset of Flag elements.
Definition livery.h:90
Flags in_use
Livery flags.
Definition livery.h:92
uint8_t GetRecolourOffset(bool use_secondary=true) const
Get offset for recolour palette.
Definition livery.h:101
Colours colour2
Second colour, for vehicles with 2CC support.
Definition livery.h:94
Colours colour1
First colour, for all vehicles.
Definition livery.h:93
Flag
Flags for bitmask to declare which of the colours are set.
Definition livery.h:84
All ships have this type.
Definition ship.h:32