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

OpenTTD Source 12.2

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