OpenTTD Source: src/table/object_land.h Source File

OpenTTD Source 15.0-RC2

object_land.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#include "table/strings.h"
11
12#define TILE_SEQ_LINE(sz, img) { 0, 0, 0, 16, 16, sz, {img, PAL_NONE} },
13
14static const DrawTileSeqStruct _object_transmitter_seq[] = {
15 { 7, 7, 0, 2, 2, 70, {SPR_TRANSMITTER, PAL_NONE}},
16};
17
18static const DrawTileSeqStruct _object_lighthouse_seq[] = {
19 { 4, 4, 0, 7, 7, 61, {SPR_LIGHTHOUSE, PAL_NONE}},
20};
21
22static const DrawTileSeqStruct _object_statue_seq[] = {
23 { 0, 0, 0, 16, 16, 25, {SPR_STATUE_COMPANY | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE}},
24};
25
26static const DrawTileSeqStruct _object_owned_land_seq[] = {
27 { 8, 8, 0, 1, 1, 6, {SPR_BOUGHT_LAND | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE}},
28};
29
30extern const DrawTileSpriteSpan _objects[] = {
31 { { SPR_FLAT_2_THIRD_GRASS_TILE, PAL_NONE }, _object_transmitter_seq },
32 { { SPR_FLAT_2_THIRD_GRASS_TILE, PAL_NONE }, _object_lighthouse_seq },
33 { { SPR_CONCRETE_GROUND, PAL_NONE }, _object_statue_seq },
34 { { SPR_FLAT_BARE_LAND, PAL_NONE }, _object_owned_land_seq },
35};
36
37
38static const DrawTileSeqStruct _object_hq_medium_north[] = {
39 TILE_SEQ_LINE(20, SPR_MEDIUMHQ_NORTH_WALL | (1 << PALETTE_MODIFIER_COLOUR))
40};
41
42static const DrawTileSeqStruct _object_hq_medium_east[] = {
43 TILE_SEQ_LINE(20, SPR_MEDIUMHQ_EAST_WALL | (1 << PALETTE_MODIFIER_COLOUR))
44};
45
46static const DrawTileSeqStruct _object_hq_medium_west[] = {
47 TILE_SEQ_LINE(20, SPR_MEDIUMHQ_WEST_WALL | (1 << PALETTE_MODIFIER_COLOUR))
48};
49
50static const DrawTileSeqStruct _object_hq_large_north[] = {
51 TILE_SEQ_LINE(50, SPR_LARGEHQ_NORTH_BUILD | (1 << PALETTE_MODIFIER_COLOUR))
52};
53
54static const DrawTileSeqStruct _object_hq_large_east[] = {
55 TILE_SEQ_LINE(50, SPR_LARGEHQ_EAST_BUILD | (1 << PALETTE_MODIFIER_COLOUR))
56};
57
58static const DrawTileSeqStruct _object_hq_large_west[] = {
59 TILE_SEQ_LINE(50, SPR_LARGEHQ_WEST_BUILD | (1 << PALETTE_MODIFIER_COLOUR))
60};
61
62static const DrawTileSeqStruct _object_hq_huge_north[] = {
63 TILE_SEQ_LINE(60, SPR_HUGEHQ_NORTH_BUILD | (1 << PALETTE_MODIFIER_COLOUR))
64};
65
66static const DrawTileSeqStruct _object_hq_huge_east[] = {
67 TILE_SEQ_LINE(60, SPR_HUGEHQ_EAST_BUILD | (1 << PALETTE_MODIFIER_COLOUR))
68};
69
70static const DrawTileSeqStruct _object_hq_huge_west[] = {
71 TILE_SEQ_LINE(60, SPR_HUGEHQ_WEST_BUILD | (1 << PALETTE_MODIFIER_COLOUR))
72};
73
74#undef TILE_SEQ_LINE
75
76#define TILE_SPRITE_LINE(img, dtss) { {img | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE}, dtss },
77#define TILE_SPRITE_LINE_NOTHING(img) { {img | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE} },
78
79static const DrawTileSpriteSpan _object_hq[] = {
80 TILE_SPRITE_LINE_NOTHING(SPR_TINYHQ_NORTH)
81 TILE_SPRITE_LINE_NOTHING(SPR_TINYHQ_WEST)
82 TILE_SPRITE_LINE_NOTHING(SPR_TINYHQ_EAST)
83 TILE_SPRITE_LINE_NOTHING(SPR_TINYHQ_SOUTH)
84
85 TILE_SPRITE_LINE_NOTHING(SPR_SMALLHQ_NORTH)
86 TILE_SPRITE_LINE_NOTHING(SPR_SMALLHQ_WEST)
87 TILE_SPRITE_LINE_NOTHING(SPR_SMALLHQ_EAST)
88 TILE_SPRITE_LINE_NOTHING(SPR_SMALLHQ_SOUTH)
89
90 TILE_SPRITE_LINE(SPR_MEDIUMHQ_NORTH, _object_hq_medium_north)
91 TILE_SPRITE_LINE(SPR_MEDIUMHQ_WEST, _object_hq_medium_west)
92 TILE_SPRITE_LINE(SPR_MEDIUMHQ_EAST, _object_hq_medium_east)
93 TILE_SPRITE_LINE_NOTHING(SPR_MEDIUMHQ_SOUTH)
94
95 TILE_SPRITE_LINE(SPR_LARGEHQ_NORTH_GROUND, _object_hq_large_north)
96 TILE_SPRITE_LINE(SPR_LARGEHQ_WEST_GROUND, _object_hq_large_west)
97 TILE_SPRITE_LINE(SPR_LARGEHQ_EAST_GROUND, _object_hq_large_east)
98 TILE_SPRITE_LINE_NOTHING(SPR_LARGEHQ_SOUTH)
99
100 TILE_SPRITE_LINE(SPR_HUGEHQ_NORTH_GROUND, _object_hq_huge_north)
101 TILE_SPRITE_LINE(SPR_HUGEHQ_WEST_GROUND, _object_hq_huge_west)
102 TILE_SPRITE_LINE(SPR_HUGEHQ_EAST_GROUND, _object_hq_huge_east)
103 TILE_SPRITE_LINE_NOTHING(SPR_HUGEHQ_SOUTH)
104};
105
106#undef TILE_SPRITE_LINE
107#undef TILE_SPRITE_LINE_NOTHING
108
109#define M(name, size, build_cost_multiplier, clear_cost_multiplier, height, climate, gen_amount, flags) {{INVALID_OBJECT_CLASS, 0}, StandardGRFFileProps{}, AnimationInfo<ObjectAnimationTriggers>{}, name, climate, size, build_cost_multiplier, clear_cost_multiplier, TimerGameCalendar::Date{}, CalendarTime::MAX_DATE + 1, flags, ObjectCallbackMasks{}, height, 1, gen_amount, {}}
110
111/* Climates
112 * T = Temperate
113 * A = Sub-Arctic
114 * S = Sub-Tropic
115 * Y = Toyland */
116#define T LandscapeType::Temperate
117#define A LandscapeType::Arctic
118#define S LandscapeType::Tropic
119#define Y LandscapeType::Toyland
121extern const ObjectSpec _original_objects[] = {
122 M(STR_LAI_OBJECT_DESCRIPTION_TRANSMITTER, 0x11, 0, 0, 10, LandscapeTypes({T,A,S }), 15, ObjectFlags({ObjectFlag::CannotRemove, ObjectFlag::OnlyInScenedit})),
123 M(STR_LAI_OBJECT_DESCRIPTION_LIGHTHOUSE, 0x11, 0, 0, 8, LandscapeTypes({T,A }), 8, ObjectFlags({ObjectFlag::CannotRemove, ObjectFlag::OnlyInScenedit, ObjectFlag::ScaleByWater})),
124 M(STR_TOWN_BUILDING_NAME_STATUE_1, 0x11, 0, 0, 5, LandscapeTypes({T,S,A,Y}), 0, ObjectFlags({ObjectFlag::CannotRemove, ObjectFlag::OnlyInGame, ObjectFlag::OnlyInScenedit})), // Yes, we disallow building this everywhere. Happens in "special" case!
125 M(STR_LAI_OBJECT_DESCRIPTION_COMPANY_OWNED_LAND, 0x11, 10, 10, 0, LandscapeTypes({T,S,A,Y}), 0, ObjectFlags({ObjectFlag::Autoremove, ObjectFlag::OnlyInGame, ObjectFlag::ClearIncome, ObjectFlag::HasNoFoundation})), // Only non-silly use case is to use it when you cannot build a station, so disallow bridges
126 M(STR_LAI_OBJECT_DESCRIPTION_COMPANY_HEADQUARTERS, 0x22, 0, 0, 7, LandscapeTypes({T,S,A,Y}), 0, ObjectFlags({ObjectFlag::CannotRemove, ObjectFlag::OnlyInGame})),
127};
128
129#undef M
130#undef Y
131#undef S
132#undef A
133#undef T
EnumBitSet< LandscapeType, uint8_t >
ObjectFlag::Autoremove
@ Autoremove
Object get automatically removed (like "owned land").
ObjectFlag::CannotRemove
@ CannotRemove
Object can not be removed.
ObjectFlag::OnlyInScenedit
@ OnlyInScenedit
Object can only be constructed in the scenario editor.
ObjectFlag::OnlyInGame
@ OnlyInGame
Object can only be built in game.
ObjectFlag::HasNoFoundation
@ HasNoFoundation
Do not display foundations when on a slope.
ObjectFlag::ScaleByWater
@ ScaleByWater
Object count is roughly scaled by water amount at edges.
ObjectFlag::ClearIncome
@ ClearIncome
When object is cleared a positive income is generated instead of a cost.
_original_objects
const ObjectSpec _original_objects[]
Specification of the original object structures.
M
#define M(x)
Helper for creating a bitset of slopes.
Definition slope_type.h:84
PALETTE_MODIFIER_COLOUR
static constexpr uint8_t PALETTE_MODIFIER_COLOUR
this bit is set when a recolouring process is in action
Definition sprites.h:1562
DrawTileSeqStruct
A tile child sprite and palette to draw for stations etc, with 3D bounding box.
Definition sprite.h:33
DrawTileSpriteSpan
Ground palette sprite of a tile, together with its sprite layout.
Definition sprite.h:67
ObjectSpec
Allow incrementing of ObjectClassID variables.
Definition newgrf_object.h:60