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

OpenTTD Source 15.0-RC2

newgrf_debug_data.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 "../newgrf_house.h"
11#include "../newgrf_engine.h"
12#include "../newgrf_roadtype.h"
13#include "../newgrf_roadstop.h"
14
15/* Helper for filling property tables */
16#define NIP(prop, base_class, variable, type, name) { name, [] (const void *b) -> uint32_t { return static_cast<const base_class *>(b)->variable; }, prop, type }
17
18/* Helper for filling callback tables */
19#define NIC(cb_id, base_class, variable, bit) { #cb_id, [] (const void *b) -> uint32_t { return static_cast<const base_class *>(b)->variable.base(); }, bit, cb_id }
20
21/* Helper for filling variable tables */
22#define NIV(var, name) { name, var }
23
24
25/*** NewGRF Vehicles ***/
26
27#define NICV(cb_id, bit) NIC(cb_id, Engine, info.callback_mask, bit)
28static const NICallback _nic_vehicles[] = {
29 NICV(CBID_VEHICLE_VISUAL_EFFECT, VehicleCallbackMask::VisualEffect),
30 NICV(CBID_VEHICLE_LENGTH, VehicleCallbackMask::Length),
31 NICV(CBID_VEHICLE_LOAD_AMOUNT, VehicleCallbackMask::LoadAmount),
32 NICV(CBID_VEHICLE_REFIT_CAPACITY, VehicleCallbackMask::RefitCapacity),
33 NICV(CBID_VEHICLE_ARTIC_ENGINE, VehicleCallbackMask::ArticEngine),
34 NICV(CBID_VEHICLE_CARGO_SUFFIX, VehicleCallbackMask::CargoSuffix),
35 NICV(CBID_TRAIN_ALLOW_WAGON_ATTACH, std::monostate{}),
36 NICV(CBID_VEHICLE_ADDITIONAL_TEXT, std::monostate{}),
37 NICV(CBID_VEHICLE_COLOUR_MAPPING, VehicleCallbackMask::ColourRemap),
38 NICV(CBID_VEHICLE_START_STOP_CHECK, std::monostate{}),
39 NICV(CBID_VEHICLE_32DAY_CALLBACK, std::monostate{}),
40 NICV(CBID_VEHICLE_SOUND_EFFECT, VehicleCallbackMask::SoundEffect),
41 NICV(CBID_VEHICLE_AUTOREPLACE_SELECTION, std::monostate{}),
42 NICV(CBID_VEHICLE_MODIFY_PROPERTY, std::monostate{}),
43 NICV(CBID_VEHICLE_NAME, VehicleCallbackMask::Name),
44};
45
46
47static const NIVariable _niv_vehicles[] = {
48 NIV(0x40, "position in consist and length"),
49 NIV(0x41, "position and length of chain of same vehicles"),
50 NIV(0x42, "transported cargo types"),
51 NIV(0x43, "player info"),
52 NIV(0x44, "aircraft info"),
53 NIV(0x45, "curvature info"),
54 NIV(0x46, "motion counter"),
55 NIV(0x47, "vehicle cargo info"),
56 NIV(0x48, "vehicle type info"),
57 NIV(0x49, "year of construction"),
58 NIV(0x4A, "current rail/road type info"),
59 NIV(0x4B, "long date of last service"),
60 NIV(0x4C, "current max speed"),
61 NIV(0x4D, "position in articulated vehicle"),
62 NIV(0x60, "count vehicle id occurrences"),
63 /* 0x61 not useful, since it requires register 0x10F */
64 NIV(0x62, "curvature/position difference to other vehicle"),
65 NIV(0x63, "tile compatibility wrt. track-type"),
66};
67
68 class NIHVehicle : public NIHelper {
69 bool IsInspectable(uint index) const override { return Vehicle::Get(index)->GetGRF() != nullptr; }
70 uint GetParent(uint index) const override { const Vehicle *first = Vehicle::Get(index)->First(); return GetInspectWindowNumber(GetGrfSpecFeature(first->type), first->index); }
71 const void *GetInstance(uint index)const override { return Vehicle::Get(index); }
72 const void *GetSpec(uint index) const override { return Vehicle::Get(index)->GetEngine(); }
73 std::string GetName(uint index) const override { return GetString(STR_VEHICLE_NAME, index); }
74 uint32_t GetGRFID(uint index) const override { return Vehicle::Get(index)->GetGRFID(); }
75 std::span<const BadgeID> GetBadges(uint index) const override { return Vehicle::Get(index)->GetEngine()->badges; }
76
77 uint Resolve(uint index, uint var, uint param, bool &avail) const override
78 {
79 Vehicle *v = Vehicle::Get(index);
80 VehicleResolverObject ro(v->engine_type, v, VehicleResolverObject::WO_CACHED);
81 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
82 }
83};
84
85static const NIFeature _nif_vehicle = {
86 {},
87 _nic_vehicles,
88 _niv_vehicles,
89 std::make_unique<NIHVehicle>(),
90};
91
92
93/*** NewGRF station (tiles) ***/
94
95#define NICS(cb_id, bit) NIC(cb_id, StationSpec, callback_mask, bit)
96static const NICallback _nic_stations[] = {
97 NICS(CBID_STATION_AVAILABILITY, StationCallbackMask::Avail),
98 NICS(CBID_STATION_DRAW_TILE_LAYOUT, StationCallbackMask::DrawTileLayout),
99 NICS(CBID_STATION_BUILD_TILE_LAYOUT,std::monostate{}),
100 NICS(CBID_STATION_ANIMATION_TRIGGER, std::monostate{}),
101 NICS(CBID_STATION_ANIMATION_NEXT_FRAME, StationCallbackMask::AnimationNextFrame),
102 NICS(CBID_STATION_ANIMATION_SPEED, StationCallbackMask::AnimationSpeed),
103 NICS(CBID_STATION_LAND_SLOPE_CHECK, StationCallbackMask::SlopeCheck),
104};
105
106static const NIVariable _niv_stations[] = {
107 NIV(0x40, "platform info and relative position"),
108 NIV(0x41, "platform info and relative position for individually built sections"),
109 NIV(0x42, "terrain and track type"),
110 NIV(0x43, "player info"),
111 NIV(0x44, "path signalling info"),
112 NIV(0x45, "rail continuation info"),
113 NIV(0x46, "platform info and relative position from middle"),
114 NIV(0x47, "platform info and relative position from middle for individually built sections"),
115 NIV(0x48, "bitmask of accepted cargoes"),
116 NIV(0x49, "platform info and relative position of same-direction section"),
117 NIV(0x4A, "current animation frame"),
118 NIV(0x60, "amount of cargo waiting"),
119 NIV(0x61, "time since last cargo pickup"),
120 NIV(0x62, "rating of cargo"),
121 NIV(0x63, "time spent on route"),
122 NIV(0x64, "information about last vehicle picking cargo up"),
123 NIV(0x65, "amount of cargo acceptance"),
124 NIV(0x66, "animation frame of nearby tile"),
125 NIV(0x67, "land info of nearby tiles"),
126 NIV(0x68, "station info of nearby tiles"),
127 NIV(0x69, "information about cargo accepted in the past"),
128 NIV(0x6A, "GRFID of nearby station tiles"),
129 NIV(0x6B, "station ID of nearby tiles"),
130};
131
132 class NIHStation : public NIHelper {
133 bool IsInspectable(uint index) const override { return GetStationSpec(TileIndex{index}) != nullptr; }
134 uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(TileIndex{index})->town->index); }
135 const void *GetInstance(uint ) const override { return nullptr; }
136 const void *GetSpec(uint index) const override { return GetStationSpec(TileIndex{index}); }
137 std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_STATION_NAME, GetStationIndex(index), index); }
138 uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetStationSpec(TileIndex{index})->grf_prop.grfid : 0; }
139 std::span<const BadgeID> GetBadges(uint index) const override { return this->IsInspectable(index) ? GetStationSpec(TileIndex{index})->badges : std::span<const BadgeID>{}; }
140
141 uint Resolve(uint index, uint var, uint param, bool &avail) const override
142 {
143 TileIndex tile{index};
144 StationResolverObject ro(GetStationSpec(tile), Station::GetByTile(tile), tile);
145 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
146 }
147};
148
149static const NIFeature _nif_station = {
150 {},
151 _nic_stations,
152 _niv_stations,
153 std::make_unique<NIHStation>(),
154};
155
156
157/*** NewGRF house tiles ***/
158
159#define NICH(cb_id, bit) NIC(cb_id, HouseSpec, callback_mask, bit)
160static const NICallback _nic_house[] = {
161 NICH(CBID_HOUSE_ALLOW_CONSTRUCTION, HouseCallbackMask::AllowConstruction),
162 NICH(CBID_HOUSE_ANIMATION_NEXT_FRAME, HouseCallbackMask::AnimationNextFrame),
163 NICH(CBID_HOUSE_ANIMATION_TRIGGER_TILE_LOOP, HouseCallbackMask::AnimationTriggerTileLoop),
164 NICH(CBID_HOUSE_ANIMATION_TRIGGER_CONSTRUCTION_STAGE_CHANGED, HouseCallbackMask::AnimationTriggerConstructionStageChanged),
165 NICH(CBID_HOUSE_COLOUR, HouseCallbackMask::Colour),
166 NICH(CBID_HOUSE_CARGO_ACCEPTANCE, HouseCallbackMask::CargoAcceptance),
167 NICH(CBID_HOUSE_ANIMATION_SPEED, HouseCallbackMask::AnimationSpeed),
168 NICH(CBID_HOUSE_DESTRUCTION, HouseCallbackMask::Destruction),
169 NICH(CBID_HOUSE_ACCEPT_CARGO, HouseCallbackMask::AcceptCargo),
170 NICH(CBID_HOUSE_PRODUCE_CARGO, HouseCallbackMask::ProduceCargo),
171 NICH(CBID_HOUSE_DENY_DESTRUCTION, HouseCallbackMask::DenyDestruction),
172 NICH(CBID_HOUSE_ANIMATION_TRIGGER_WATCHED_CARGO_ACCEPTED, std::monostate{}),
173 NICH(CBID_HOUSE_CUSTOM_NAME, std::monostate{}),
174 NICH(CBID_HOUSE_DRAW_FOUNDATIONS, HouseCallbackMask::DrawFoundations),
175 NICH(CBID_HOUSE_AUTOSLOPE, HouseCallbackMask::Autoslope),
176};
177
178static const NIVariable _niv_house[] = {
179 NIV(0x40, "construction stage of tile and pseudo-random value"),
180 NIV(0x41, "age of building in years"),
181 NIV(0x42, "town zone"),
182 NIV(0x43, "terrain type"),
183 NIV(0x44, "building counts"),
184 NIV(0x45, "town expansion bits"),
185 NIV(0x46, "current animation frame"),
186 NIV(0x47, "xy coordinate of the building"),
187 NIV(0x60, "other building counts (old house type)"),
188 NIV(0x61, "other building counts (new house type)"),
189 NIV(0x62, "land info of nearby tiles"),
190 NIV(0x63, "current animation frame of nearby house tile"),
191 NIV(0x64, "cargo acceptance history of nearby stations"),
192 NIV(0x65, "distance of nearest house matching a given criterion"),
193 NIV(0x66, "class and ID of nearby house tile"),
194 NIV(0x67, "GRFID of nearby house tile"),
195};
196
197 class NIHHouse : public NIHelper {
198 bool IsInspectable(uint index) const override { return HouseSpec::Get(GetHouseType(index))->grf_prop.HasGrfFile(); }
199 uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, GetTownIndex(index)); }
200 const void *GetInstance(uint)const override { return nullptr; }
201 const void *GetSpec(uint index) const override { return HouseSpec::Get(GetHouseType(index)); }
202 std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_TOWN_NAME, GetTownIndex(index), index); }
203 uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? HouseSpec::Get(GetHouseType(index))->grf_prop.grfid : 0; }
204 std::span<const BadgeID> GetBadges(uint index) const override { return HouseSpec::Get(GetHouseType(index))->badges; }
205
206 uint Resolve(uint index, uint var, uint param, bool &avail) const override
207 {
208 TileIndex tile{index};
209 HouseResolverObject ro(GetHouseType(tile), tile, Town::GetByTile(tile));
210 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
211 }
212};
213
214static const NIFeature _nif_house = {
215 {},
216 _nic_house,
217 _niv_house,
218 std::make_unique<NIHHouse>(),
219};
220
221
222/*** NewGRF industry tiles ***/
223
224#define NICIT(cb_id, bit) NIC(cb_id, IndustryTileSpec, callback_mask, bit)
225static const NICallback _nic_industrytiles[] = {
226 NICIT(CBID_INDTILE_ANIMATION_TRIGGER, std::monostate{}),
227 NICIT(CBID_INDTILE_ANIMATION_NEXT_FRAME, IndustryTileCallbackMask::AnimationNextFrame),
228 NICIT(CBID_INDTILE_ANIMATION_SPEED, IndustryTileCallbackMask::AnimationSpeed),
229 NICIT(CBID_INDTILE_CARGO_ACCEPTANCE, IndustryTileCallbackMask::CargoAcceptance),
230 NICIT(CBID_INDTILE_ACCEPT_CARGO, IndustryTileCallbackMask::AcceptCargo),
231 NICIT(CBID_INDTILE_SHAPE_CHECK, IndustryTileCallbackMask::ShapeCheck),
232 NICIT(CBID_INDTILE_DRAW_FOUNDATIONS, IndustryTileCallbackMask::DrawFoundations),
233 NICIT(CBID_INDTILE_AUTOSLOPE, IndustryTileCallbackMask::Autoslope),
234};
235
236static const NIVariable _niv_industrytiles[] = {
237 NIV(0x40, "construction stage of tile"),
238 NIV(0x41, "ground type"),
239 NIV(0x42, "current town zone in nearest town"),
240 NIV(0x43, "relative position"),
241 NIV(0x44, "animation frame"),
242 NIV(0x60, "land info of nearby tiles"),
243 NIV(0x61, "animation stage of nearby tiles"),
244 NIV(0x62, "get industry or airport tile ID at offset"),
245};
246
247 class NIHIndustryTile : public NIHelper {
248 bool IsInspectable(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.HasGrfFile(); }
249 uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); }
250 const void *GetInstance(uint)const override { return nullptr; }
251 const void *GetSpec(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index)); }
252 std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_INDUSTRY_NAME, GetIndustryIndex(index), index); }
253 uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grfid : 0; }
254 std::span<const BadgeID> GetBadges(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index))->badges; }
255
256 uint Resolve(uint index, uint var, uint param, bool &avail) const override
257 {
258 TileIndex tile{index};
259 IndustryTileResolverObject ro(GetIndustryGfx(tile), tile, Industry::GetByTile(tile));
260 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
261 }
262};
263
264static const NIFeature _nif_industrytile = {
265 {},
266 _nic_industrytiles,
267 _niv_industrytiles,
268 std::make_unique<NIHIndustryTile>(),
269};
270
271
272/*** NewGRF industries ***/
273#define NIP_PRODUCED_CARGO(prop, base_class, slot, type, name) { name, [] (const void *b) -> uint32_t { return static_cast<const base_class *>(b)->GetProduced(slot).cargo; }, prop, type }
274#define NIP_ACCEPTED_CARGO(prop, base_class, slot, type, name) { name, [] (const void *b) -> uint32_t { return static_cast<const base_class *>(b)->GetAccepted(slot).cargo; }, prop, type }
275
276static const NIProperty _nip_industries[] = {
277 NIP_PRODUCED_CARGO(0x25, Industry, 0, NIT_CARGO, "produced cargo 0"),
278 NIP_PRODUCED_CARGO(0x25, Industry, 1, NIT_CARGO, "produced cargo 1"),
279 NIP_PRODUCED_CARGO(0x25, Industry, 2, NIT_CARGO, "produced cargo 2"),
280 NIP_PRODUCED_CARGO(0x25, Industry, 3, NIT_CARGO, "produced cargo 3"),
281 NIP_PRODUCED_CARGO(0x25, Industry, 4, NIT_CARGO, "produced cargo 4"),
282 NIP_PRODUCED_CARGO(0x25, Industry, 5, NIT_CARGO, "produced cargo 5"),
283 NIP_PRODUCED_CARGO(0x25, Industry, 6, NIT_CARGO, "produced cargo 6"),
284 NIP_PRODUCED_CARGO(0x25, Industry, 7, NIT_CARGO, "produced cargo 7"),
285 NIP_PRODUCED_CARGO(0x25, Industry, 8, NIT_CARGO, "produced cargo 8"),
286 NIP_PRODUCED_CARGO(0x25, Industry, 9, NIT_CARGO, "produced cargo 9"),
287 NIP_PRODUCED_CARGO(0x25, Industry, 10, NIT_CARGO, "produced cargo 10"),
288 NIP_PRODUCED_CARGO(0x25, Industry, 11, NIT_CARGO, "produced cargo 11"),
289 NIP_PRODUCED_CARGO(0x25, Industry, 12, NIT_CARGO, "produced cargo 12"),
290 NIP_PRODUCED_CARGO(0x25, Industry, 13, NIT_CARGO, "produced cargo 13"),
291 NIP_PRODUCED_CARGO(0x25, Industry, 14, NIT_CARGO, "produced cargo 14"),
292 NIP_PRODUCED_CARGO(0x25, Industry, 15, NIT_CARGO, "produced cargo 15"),
293 NIP_ACCEPTED_CARGO(0x26, Industry, 0, NIT_CARGO, "accepted cargo 0"),
294 NIP_ACCEPTED_CARGO(0x26, Industry, 1, NIT_CARGO, "accepted cargo 1"),
295 NIP_ACCEPTED_CARGO(0x26, Industry, 2, NIT_CARGO, "accepted cargo 2"),
296 NIP_ACCEPTED_CARGO(0x26, Industry, 3, NIT_CARGO, "accepted cargo 3"),
297 NIP_ACCEPTED_CARGO(0x26, Industry, 4, NIT_CARGO, "accepted cargo 4"),
298 NIP_ACCEPTED_CARGO(0x26, Industry, 5, NIT_CARGO, "accepted cargo 5"),
299 NIP_ACCEPTED_CARGO(0x26, Industry, 6, NIT_CARGO, "accepted cargo 6"),
300 NIP_ACCEPTED_CARGO(0x26, Industry, 7, NIT_CARGO, "accepted cargo 7"),
301 NIP_ACCEPTED_CARGO(0x26, Industry, 8, NIT_CARGO, "accepted cargo 8"),
302 NIP_ACCEPTED_CARGO(0x26, Industry, 9, NIT_CARGO, "accepted cargo 9"),
303 NIP_ACCEPTED_CARGO(0x26, Industry, 10, NIT_CARGO, "accepted cargo 10"),
304 NIP_ACCEPTED_CARGO(0x26, Industry, 11, NIT_CARGO, "accepted cargo 11"),
305 NIP_ACCEPTED_CARGO(0x26, Industry, 12, NIT_CARGO, "accepted cargo 12"),
306 NIP_ACCEPTED_CARGO(0x26, Industry, 13, NIT_CARGO, "accepted cargo 13"),
307 NIP_ACCEPTED_CARGO(0x26, Industry, 14, NIT_CARGO, "accepted cargo 14"),
308 NIP_ACCEPTED_CARGO(0x26, Industry, 15, NIT_CARGO, "accepted cargo 15"),
309};
310
311#undef NIP_PRODUCED_CARGO
312#undef NIP_ACCEPTED_CARGO
313
314#define NICI(cb_id, bit) NIC(cb_id, IndustrySpec, callback_mask, bit)
315static const NICallback _nic_industries[] = {
316 NICI(CBID_INDUSTRY_PROBABILITY, IndustryCallbackMask::Probability),
317 NICI(CBID_INDUSTRY_LOCATION, IndustryCallbackMask::Location),
318 NICI(CBID_INDUSTRY_PRODUCTION_CHANGE, IndustryCallbackMask::ProductionChange),
319 NICI(CBID_INDUSTRY_MONTHLYPROD_CHANGE, IndustryCallbackMask::MonthlyProdChange),
320 NICI(CBID_INDUSTRY_CARGO_SUFFIX, IndustryCallbackMask::CargoSuffix),
321 NICI(CBID_INDUSTRY_FUND_MORE_TEXT, IndustryCallbackMask::FundMoreText),
322 NICI(CBID_INDUSTRY_WINDOW_MORE_TEXT, IndustryCallbackMask::WindowMoreText),
323 NICI(CBID_INDUSTRY_SPECIAL_EFFECT, IndustryCallbackMask::SpecialEffect),
324 NICI(CBID_INDUSTRY_REFUSE_CARGO, IndustryCallbackMask::RefuseCargo),
325 NICI(CBID_INDUSTRY_DECIDE_COLOUR, IndustryCallbackMask::DecideColour),
326 NICI(CBID_INDUSTRY_INPUT_CARGO_TYPES, IndustryCallbackMask::InputCargoTypes),
327 NICI(CBID_INDUSTRY_OUTPUT_CARGO_TYPES, IndustryCallbackMask::OutputCargoTypes),
328 NICI(CBID_INDUSTRY_PROD_CHANGE_BUILD, IndustryCallbackMask::ProdChangeBuild),
329};
330
331static const NIVariable _niv_industries[] = {
332 NIV(0x40, "waiting cargo 0"),
333 NIV(0x41, "waiting cargo 1"),
334 NIV(0x42, "waiting cargo 2"),
335 NIV(0x43, "distance to closest dry/land tile"),
336 NIV(0x44, "layout number"),
337 NIV(0x45, "player info"),
338 NIV(0x46, "industry construction date"),
339 NIV(0x60, "get industry tile ID at offset"),
340 NIV(0x61, "get random tile bits at offset"),
341 NIV(0x62, "land info of nearby tiles"),
342 NIV(0x63, "animation stage of nearby tiles"),
343 NIV(0x64, "distance on nearest industry with given type"),
344 NIV(0x65, "get town zone and Manhattan distance of closest town"),
345 NIV(0x66, "get square of Euclidean distance of closes town"),
346 NIV(0x67, "count of industry and distance of closest instance"),
347 NIV(0x68, "count of industry and distance of closest instance with layout filter"),
348 NIV(0x69, "produced cargo waiting"),
349 NIV(0x6A, "cargo produced this month"),
350 NIV(0x6B, "cargo transported this month"),
351 NIV(0x6C, "cargo produced last month"),
352 NIV(0x6D, "cargo transported last month"),
353 NIV(0x6E, "date since cargo was delivered"),
354 NIV(0x6F, "waiting input cargo"),
355 NIV(0x70, "production rate"),
356 NIV(0x71, "percentage of cargo transported last month"),
357};
358
359 class NIHIndustry : public NIHelper {
360 bool IsInspectable(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type)->grf_prop.HasGrfFile(); }
361 uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Industry::Get(index)->town->index); }
362 const void *GetInstance(uint index)const override { return Industry::Get(index); }
363 const void *GetSpec(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type); }
364 std::string GetName(uint index) const override { return GetString(STR_INDUSTRY_NAME, index); }
365 uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grfid : 0; }
366 std::span<const BadgeID> GetBadges(uint index) const override { return GetIndustrySpec(Industry::Get(index)->type)->badges; }
367
368 uint Resolve(uint index, uint var, uint param, bool &avail) const override
369 {
370 Industry *i = Industry::Get(index);
371 IndustriesResolverObject ro(i->location.tile, i, i->type);
372 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
373 }
374
375 const std::span<int32_t> GetPSA(uint index, uint32_t) const override
376 {
377 const Industry *i = (const Industry *)this->GetInstance(index);
378 if (i->psa == nullptr) return {};
379 return i->psa->storage;
380 }
381};
382
383static const NIFeature _nif_industry = {
384 _nip_industries,
385 _nic_industries,
386 _niv_industries,
387 std::make_unique<NIHIndustry>(),
388};
389
390
391/*** NewGRF objects ***/
392
393#define NICO(cb_id, bit) NIC(cb_id, ObjectSpec, callback_mask, bit)
394static const NICallback _nic_objects[] = {
395 NICO(CBID_OBJECT_LAND_SLOPE_CHECK, ObjectCallbackMask::SlopeCheck),
396 NICO(CBID_OBJECT_ANIMATION_NEXT_FRAME, ObjectCallbackMask::AnimationNextFrame),
397 NICO(CBID_OBJECT_ANIMATION_TRIGGER, std::monostate{}),
398 NICO(CBID_OBJECT_ANIMATION_SPEED, ObjectCallbackMask::AnimationSpeed),
399 NICO(CBID_OBJECT_COLOUR, ObjectCallbackMask::Colour),
400 NICO(CBID_OBJECT_FUND_MORE_TEXT, ObjectCallbackMask::FundMoreText),
401 NICO(CBID_OBJECT_AUTOSLOPE, ObjectCallbackMask::Autoslope),
402};
403
404static const NIVariable _niv_objects[] = {
405 NIV(0x40, "relative position"),
406 NIV(0x41, "tile information"),
407 NIV(0x42, "construction date"),
408 NIV(0x43, "animation counter"),
409 NIV(0x44, "object founder"),
410 NIV(0x45, "get town zone and Manhattan distance of closest town"),
411 NIV(0x46, "get square of Euclidean distance of closes town"),
412 NIV(0x47, "colour"),
413 NIV(0x48, "view"),
414 NIV(0x60, "get object ID at offset"),
415 NIV(0x61, "get random tile bits at offset"),
416 NIV(0x62, "land info of nearby tiles"),
417 NIV(0x63, "animation stage of nearby tiles"),
418 NIV(0x64, "distance on nearest object with given type"),
419};
420
421 class NIHObject : public NIHelper {
422 bool IsInspectable(uint index) const override { return ObjectSpec::GetByTile(TileIndex{index})->grf_prop.HasGrfFile(); }
423 uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Object::GetByTile(TileIndex{index})->town->index); }
424 const void *GetInstance(uint index)const override { return Object::GetByTile(TileIndex{index}); }
425 const void *GetSpec(uint index) const override { return ObjectSpec::GetByTile(TileIndex{index}); }
426 std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT, INVALID_STRING_ID, index); }
427 uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? ObjectSpec::GetByTile(TileIndex{index})->grf_prop.grfid : 0; }
428 std::span<const BadgeID> GetBadges(uint index) const override { return ObjectSpec::GetByTile(TileIndex{index})->badges; }
429
430 uint Resolve(uint index, uint var, uint param, bool &avail) const override
431 {
432 TileIndex tile{index};
433 ObjectResolverObject ro(ObjectSpec::GetByTile(tile), Object::GetByTile(tile), tile);
434 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
435 }
436};
437
438static const NIFeature _nif_object = {
439 {},
440 _nic_objects,
441 _niv_objects,
442 std::make_unique<NIHObject>(),
443};
444
445
446/*** NewGRF rail types ***/
447
448static const NIVariable _niv_railtypes[] = {
449 NIV(0x40, "terrain type"),
450 NIV(0x41, "enhanced tunnels"),
451 NIV(0x42, "level crossing status"),
452 NIV(0x43, "construction date"),
453 NIV(0x44, "town zone"),
454 NIV(0x45, "track types"),
455};
456
457 class NIHRailType : public NIHelper {
458 bool IsInspectable(uint) const override { return true; }
459 uint GetParent(uint) const override { return UINT32_MAX; }
460 const void *GetInstance(uint) const override { return nullptr; }
461 const void *GetSpec(uint) const override { return nullptr; }
462 std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); }
463 uint32_t GetGRFID(uint) const override { return 0; }
464 std::span<const BadgeID> GetBadges(uint index) const override { return GetRailTypeInfo(GetRailType(TileIndex{index}))->badges; }
465
466 uint Resolve(uint index, uint var, uint param, bool &avail) const override
467 {
468 /* There is no unique GRFFile for the tile. Multiple GRFs can define different parts of the railtype.
469 * However, currently the NewGRF Debug GUI does not display variables depending on the GRF (like 0x7F) anyway. */
470 RailTypeResolverObject ro(nullptr, TileIndex{index}, TCX_NORMAL, RTSG_END);
471 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
472 }
473};
474
475static const NIFeature _nif_railtype = {
476 {},
477 {},
478 _niv_railtypes,
479 std::make_unique<NIHRailType>(),
480};
481
482
483/*** NewGRF airport tiles ***/
484
485#define NICAT(cb_id, bit) NIC(cb_id, AirportTileSpec, callback_mask, bit)
486static const NICallback _nic_airporttiles[] = {
487 NICAT(CBID_AIRPTILE_DRAW_FOUNDATIONS, AirportTileCallbackMask::DrawFoundations),
488 NICAT(CBID_AIRPTILE_ANIMATION_TRIGGER, std::monostate{}),
489 NICAT(CBID_AIRPTILE_ANIMATION_NEXT_FRAME, AirportTileCallbackMask::AnimationNextFrame),
490 NICAT(CBID_AIRPTILE_ANIMATION_SPEED, AirportTileCallbackMask::AnimationSpeed),
491};
492
493 class NIHAirportTile : public NIHelper {
494 bool IsInspectable(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.HasGrfFile(); }
495 uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_AIRPORTS, GetStationIndex(index)); }
496 const void *GetInstance(uint)const override { return nullptr; }
497 const void *GetSpec(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index)); }
498 std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_STATION_NAME, GetStationIndex(index), index); }
499 uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grfid : 0; }
500 std::span<const BadgeID> GetBadges(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index))->badges; }
501
502 uint Resolve(uint index, uint var, uint param, bool &avail) const override
503 {
504 TileIndex tile{index};
505 AirportTileResolverObject ro(AirportTileSpec::GetByTile(tile), tile, Station::GetByTile(tile));
506 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
507 }
508};
509
510static const NIFeature _nif_airporttile = {
511 {},
512 _nic_airporttiles,
513 _niv_industrytiles, // Yes, they share this (at least now)
514 std::make_unique<NIHAirportTile>(),
515};
516
517
518/*** NewGRF airports ***/
519
520static const NIVariable _niv_airports[] = {
521 NIV(0x40, "Layout number"),
522 NIV(0x48, "bitmask of accepted cargoes"),
523 NIV(0x60, "amount of cargo waiting"),
524 NIV(0x61, "time since last cargo pickup"),
525 NIV(0x62, "rating of cargo"),
526 NIV(0x63, "time spent on route"),
527 NIV(0x64, "information about last vehicle picking cargo up"),
528 NIV(0x65, "amount of cargo acceptance"),
529 NIV(0x69, "information about cargo accepted in the past"),
530 NIV(0xF1, "type of the airport"),
531 NIV(0xF6, "airport block status"),
532 NIV(0xFA, "built date"),
533};
534
535 class NIHAirport : public NIHelper {
536 bool IsInspectable(uint index) const override { return AirportSpec::Get(Station::Get(index)->airport.type)->grf_prop.HasGrfFile(); }
537 uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::Get(index)->town->index); }
538 const void *GetInstance(uint index)const override { return Station::Get(index); }
539 const void *GetSpec(uint index) const override { return AirportSpec::Get(Station::Get(index)->airport.type); }
540 std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_STATION_NAME, index, Station::Get(index)->airport.tile); }
541 uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? AirportSpec::Get(Station::Get(index)->airport.type)->grf_prop.grfid : 0; }
542 std::span<const BadgeID> GetBadges(uint index) const override { return AirportSpec::Get(Station::Get(index)->airport.type)->badges; }
543
544 uint Resolve(uint index, uint var, uint param, bool &avail) const override
545 {
546 Station *st = Station::Get(index);
547 AirportResolverObject ro(st->airport.tile, st, AirportSpec::Get(st->airport.type), st->airport.layout);
548 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
549 }
550
551 const std::span<int32_t> GetPSA(uint index, uint32_t) const override
552 {
553 const Station *st = (const Station *)this->GetInstance(index);
554 if (st->airport.psa == nullptr) return {};
555 return st->airport.psa->storage;
556 }
557};
558
559static const NIFeature _nif_airport = {
560 {},
561 {},
562 _niv_airports,
563 std::make_unique<NIHAirport>(),
564};
565
566
567/*** NewGRF towns ***/
568
569static const NIVariable _niv_towns[] = {
570 NIV(0x40, "larger town effect on this town"),
571 NIV(0x41, "town index"),
572 NIV(0x82, "population"),
573 NIV(0x94, "zone radius 0"),
574 NIV(0x96, "zone radius 1"),
575 NIV(0x98, "zone radius 2"),
576 NIV(0x9A, "zone radius 3"),
577 NIV(0x9C, "zone radius 4"),
578 NIV(0xB6, "number of buildings"),
579};
580
581 class NIHTown : public NIHelper {
582 bool IsInspectable(uint index) const override { return Town::IsValidID(index); }
583 uint GetParent(uint) const override { return UINT32_MAX; }
584 const void *GetInstance(uint index)const override { return Town::Get(index); }
585 const void *GetSpec(uint) const override { return nullptr; }
586 std::string GetName(uint index) const override { return GetString(STR_TOWN_NAME, index); }
587 uint32_t GetGRFID(uint) const override { return 0; }
588 bool PSAWithParameter() const override { return true; }
589 std::span<const BadgeID> GetBadges(uint) const override { return {}; }
590
591 uint Resolve(uint index, uint var, uint param, bool &avail) const override
592 {
593 TownResolverObject ro(nullptr, Town::Get(index), true);
594 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
595 }
596
597 const std::span<int32_t> GetPSA(uint index, uint32_t grfid) const override
598 {
599 Town *t = Town::Get(index);
600
601 for (const auto &it : t->psa_list) {
602 if (it->grfid == grfid) return it->storage;
603 }
604
605 return {};
606 }
607};
608
609static const NIFeature _nif_town = {
610 {},
611 {},
612 _niv_towns,
613 std::make_unique<NIHTown>(),
614};
615
616/*** NewGRF road types ***/
617
618static const NIVariable _niv_roadtypes[] = {
619 NIV(0x40, "terrain type"),
620 NIV(0x41, "enhanced tunnels"),
621 NIV(0x42, "level crossing status"),
622 NIV(0x43, "construction date"),
623 NIV(0x44, "town zone"),
624 NIV(0x45, "track types"),
625};
626
627template <RoadTramType TRoadTramType>
628 class NIHRoadType : public NIHelper {
629 bool IsInspectable(uint) const override { return true; }
630 uint GetParent(uint) const override { return UINT32_MAX; }
631 const void *GetInstance(uint) const override { return nullptr; }
632 const void *GetSpec(uint) const override { return nullptr; }
633 std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE, INVALID_STRING_ID, index); }
634 uint32_t GetGRFID(uint) const override { return 0; }
635 std::span<const BadgeID> GetBadges(uint index) const override
636 {
637 RoadType rt = GetRoadType(TileIndex{index}, TRoadTramType);
638 if (rt == INVALID_ROADTYPE) return {};
639 return GetRoadTypeInfo(rt)->badges;
640 }
641
642 uint Resolve(uint index, uint var, uint param, bool &avail) const override
643 {
644 /* There is no unique GRFFile for the tile. Multiple GRFs can define different parts of the railtype.
645 * However, currently the NewGRF Debug GUI does not display variables depending on the GRF (like 0x7F) anyway. */
646 RoadTypeResolverObject ro(nullptr, TileIndex{index}, TCX_NORMAL, ROTSG_END);
647 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
648 }
649};
650
651static const NIFeature _nif_roadtype = {
652 {},
653 {},
654 _niv_roadtypes,
655 std::make_unique<NIHRoadType<RoadTramType::RTT_ROAD>>(),
656};
657
658static const NIFeature _nif_tramtype = {
659 {},
660 {},
661 _niv_roadtypes,
662 std::make_unique<NIHRoadType<RoadTramType::RTT_TRAM>>(),
663};
664
665#define NICRS(cb_id, bit) NIC(cb_id, RoadStopSpec, callback_mask, bit)
666static const NICallback _nic_roadstops[] = {
667 NICRS(CBID_STATION_AVAILABILITY, RoadStopCallbackMask::Avail),
668 NICRS(CBID_STATION_ANIMATION_TRIGGER, std::monostate{}),
669 NICRS(CBID_STATION_ANIMATION_NEXT_FRAME, RoadStopCallbackMask::AnimationNextFrame),
670 NICRS(CBID_STATION_ANIMATION_SPEED, RoadStopCallbackMask::AnimationSpeed),
671};
672
673static const NIVariable _nif_roadstops[] = {
674 NIV(0x40, "view/rotation"),
675 NIV(0x41, "stop type"),
676 NIV(0x42, "terrain type"),
677 NIV(0x43, "road type"),
678 NIV(0x44, "tram type"),
679 NIV(0x45, "town zone and Manhattan distance of town"),
680 NIV(0x46, "square of Euclidean distance of town"),
681 NIV(0x47, "player info"),
682 NIV(0x48, "bitmask of accepted cargoes"),
683 NIV(0x49, "current animation frame"),
684 NIV(0x60, "amount of cargo waiting"),
685 NIV(0x61, "time since last cargo pickup"),
686 NIV(0x62, "rating of cargo"),
687 NIV(0x63, "time spent on route"),
688 NIV(0x64, "information about last vehicle picking cargo up"),
689 NIV(0x65, "amount of cargo acceptance"),
690 NIV(0x66, "animation frame of nearby tile"),
691 NIV(0x67, "land info of nearby tiles"),
692 NIV(0x68, "road stop info of nearby tiles"),
693 NIV(0x69, "information about cargo accepted in the past"),
694 NIV(0x6A, "GRFID of nearby road stop tiles"),
695 NIV(0x6B, "road stop ID of nearby tiles"),
696};
697
698 class NIHRoadStop : public NIHelper {
699 bool IsInspectable(uint index) const override { return GetRoadStopSpec(TileIndex{index}) != nullptr; }
700 uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, BaseStation::GetByTile(TileIndex{index})->town->index); }
701 const void *GetInstance(uint)const override { return nullptr; }
702 const void *GetSpec(uint index) const override { return GetRoadStopSpec(TileIndex{index}); }
703 std::string GetName(uint index) const override { return GetString(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT, STR_STATION_NAME, GetStationIndex(index), index); }
704 uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetRoadStopSpec(TileIndex{index})->grf_prop.grfid : 0; }
705 std::span<const BadgeID> GetBadges(uint index) const override { return this->IsInspectable(index) ? GetRoadStopSpec(TileIndex{index})->badges : std::span<const BadgeID>{}; }
706
707 uint Resolve(uint index, uint var, uint32_t param, bool &avail) const override
708 {
709 TileIndex tile{index};
710 StationGfx view = GetStationGfx(tile);
711 RoadStopResolverObject ro(GetRoadStopSpec(tile), BaseStation::GetByTile(tile), tile, INVALID_ROADTYPE, GetStationType(tile), view);
712 return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
713 }
714};
715
716static const NIFeature _nif_roadstop = {
717 {},
718 _nic_roadstops,
719 _nif_roadstops,
720 std::make_unique<NIHRoadStop>(),
721};
722
724 static const NIFeature * const _nifeatures[] = {
725 &_nif_vehicle, // GSF_TRAINS
726 &_nif_vehicle, // GSF_ROADVEHICLES
727 &_nif_vehicle, // GSF_SHIPS
728 &_nif_vehicle, // GSF_AIRCRAFT
729 &_nif_station, // GSF_STATIONS
730 nullptr, // GSF_CANALS (no callbacks/action2 implemented)
731 nullptr, // GSF_BRIDGES (no callbacks/action2)
732 &_nif_house, // GSF_HOUSES
733 nullptr, // GSF_GLOBALVAR (has no "physical" objects)
734 &_nif_industrytile, // GSF_INDUSTRYTILES
735 &_nif_industry, // GSF_INDUSTRIES
736 nullptr, // GSF_CARGOES (has no "physical" objects)
737 nullptr, // GSF_SOUNDFX (has no "physical" objects)
738 &_nif_airport, // GSF_AIRPORTS
739 nullptr, // GSF_SIGNALS (feature not implemented)
740 &_nif_object, // GSF_OBJECTS
741 &_nif_railtype, // GSF_RAILTYPES
742 &_nif_airporttile, // GSF_AIRPORTTILES
743 &_nif_roadtype, // GSF_ROADTYPES
744 &_nif_tramtype, // GSF_TRAMTYPES
745 &_nif_roadstop, // GSF_ROADSTOPS
746 &_nif_town, // GSF_FAKE_TOWNS
747 nullptr,
748};
749static_assert(lengthof(_nifeatures) == GSF_FAKE_END);
NIHAirportTile
Definition newgrf_debug_data.h:493
NIHAirportTile::GetParent
uint GetParent(uint index) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:495
NIHAirportTile::GetInstance
const void * GetInstance(uint) const override
Get the instance given an index.
Definition newgrf_debug_data.h:496
NIHAirportTile::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:500
NIHAirportTile::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:502
NIHAirportTile::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:498
NIHAirportTile::GetGRFID
uint32_t GetGRFID(uint index) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:499
NIHAirportTile::GetSpec
const void * GetSpec(uint index) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:497
NIHAirportTile::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:494
NIHAirport
Definition newgrf_debug_data.h:535
NIHAirport::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:544
NIHAirport::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:540
NIHAirport::GetInstance
const void * GetInstance(uint index) const override
Get the instance given an index.
Definition newgrf_debug_data.h:538
NIHAirport::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:536
NIHAirport::GetParent
uint GetParent(uint index) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:537
NIHAirport::GetSpec
const void * GetSpec(uint index) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:539
NIHAirport::GetGRFID
uint32_t GetGRFID(uint index) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:541
NIHAirport::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:542
NIHAirport::GetPSA
const std::span< int32_t > GetPSA(uint index, uint32_t) const override
Gets the span containing the persistent storage.
Definition newgrf_debug_data.h:551
NIHHouse
Definition newgrf_debug_data.h:197
NIHHouse::GetGRFID
uint32_t GetGRFID(uint index) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:203
NIHHouse::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:206
NIHHouse::GetSpec
const void * GetSpec(uint index) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:201
NIHHouse::GetParent
uint GetParent(uint index) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:199
NIHHouse::GetInstance
const void * GetInstance(uint) const override
Get the instance given an index.
Definition newgrf_debug_data.h:200
NIHHouse::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:202
NIHHouse::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:198
NIHHouse::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:204
NIHIndustryTile
Definition newgrf_debug_data.h:247
NIHIndustryTile::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:252
NIHIndustryTile::GetSpec
const void * GetSpec(uint index) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:251
NIHIndustryTile::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:248
NIHIndustryTile::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:254
NIHIndustryTile::GetGRFID
uint32_t GetGRFID(uint index) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:253
NIHIndustryTile::GetParent
uint GetParent(uint index) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:249
NIHIndustryTile::GetInstance
const void * GetInstance(uint) const override
Get the instance given an index.
Definition newgrf_debug_data.h:250
NIHIndustryTile::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:256
NIHIndustry
Definition newgrf_debug_data.h:359
NIHIndustry::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:368
NIHIndustry::GetSpec
const void * GetSpec(uint index) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:363
NIHIndustry::GetParent
uint GetParent(uint index) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:361
NIHIndustry::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:360
NIHIndustry::GetPSA
const std::span< int32_t > GetPSA(uint index, uint32_t) const override
Gets the span containing the persistent storage.
Definition newgrf_debug_data.h:375
NIHIndustry::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:364
NIHIndustry::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:366
NIHIndustry::GetGRFID
uint32_t GetGRFID(uint index) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:365
NIHIndustry::GetInstance
const void * GetInstance(uint index) const override
Get the instance given an index.
Definition newgrf_debug_data.h:362
NIHObject
Definition newgrf_debug_data.h:421
NIHObject::GetSpec
const void * GetSpec(uint index) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:425
NIHObject::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:428
NIHObject::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:422
NIHObject::GetInstance
const void * GetInstance(uint index) const override
Get the instance given an index.
Definition newgrf_debug_data.h:424
NIHObject::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:426
NIHObject::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:430
NIHObject::GetGRFID
uint32_t GetGRFID(uint index) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:427
NIHObject::GetParent
uint GetParent(uint index) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:423
NIHRailType
Definition newgrf_debug_data.h:457
NIHRailType::IsInspectable
bool IsInspectable(uint) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:458
NIHRailType::GetGRFID
uint32_t GetGRFID(uint) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:463
NIHRailType::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:466
NIHRailType::GetInstance
const void * GetInstance(uint) const override
Get the instance given an index.
Definition newgrf_debug_data.h:460
NIHRailType::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:462
NIHRailType::GetParent
uint GetParent(uint) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:459
NIHRailType::GetSpec
const void * GetSpec(uint) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:461
NIHRailType::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:464
NIHRoadStop
Definition newgrf_debug_data.h:698
NIHRoadStop::GetParent
uint GetParent(uint index) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:700
NIHRoadStop::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:705
NIHRoadStop::GetGRFID
uint32_t GetGRFID(uint index) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:704
NIHRoadStop::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:703
NIHRoadStop::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:699
NIHRoadStop::GetSpec
const void * GetSpec(uint index) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:702
NIHRoadStop::GetInstance
const void * GetInstance(uint) const override
Get the instance given an index.
Definition newgrf_debug_data.h:701
NIHRoadType
Definition newgrf_debug_data.h:628
NIHRoadType::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:642
NIHRoadType::IsInspectable
bool IsInspectable(uint) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:629
NIHRoadType::GetInstance
const void * GetInstance(uint) const override
Get the instance given an index.
Definition newgrf_debug_data.h:631
NIHRoadType::GetGRFID
uint32_t GetGRFID(uint) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:634
NIHRoadType::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:633
NIHRoadType::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:635
NIHRoadType::GetSpec
const void * GetSpec(uint) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:632
NIHRoadType::GetParent
uint GetParent(uint) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:630
NIHStation
Definition newgrf_debug_data.h:132
NIHStation::GetSpec
const void * GetSpec(uint index) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:136
NIHStation::GetInstance
const void * GetInstance(uint) const override
Get the instance given an index.
Definition newgrf_debug_data.h:135
NIHStation::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:137
NIHStation::GetParent
uint GetParent(uint index) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:134
NIHStation::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:133
NIHStation::GetGRFID
uint32_t GetGRFID(uint index) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:138
NIHStation::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:139
NIHStation::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:141
NIHTown
Definition newgrf_debug_data.h:581
NIHTown::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:586
NIHTown::GetGRFID
uint32_t GetGRFID(uint) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:587
NIHTown::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:591
NIHTown::PSAWithParameter
bool PSAWithParameter() const override
Used to decide if the PSA needs a parameter or not.
Definition newgrf_debug_data.h:588
NIHTown::GetSpec
const void * GetSpec(uint) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:585
NIHTown::GetInstance
const void * GetInstance(uint index) const override
Get the instance given an index.
Definition newgrf_debug_data.h:584
NIHTown::GetBadges
std::span< const BadgeID > GetBadges(uint) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:589
NIHTown::GetParent
uint GetParent(uint) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:583
NIHTown::GetPSA
const std::span< int32_t > GetPSA(uint index, uint32_t grfid) const override
Gets the span containing the persistent storage.
Definition newgrf_debug_data.h:597
NIHTown::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:582
NIHVehicle
Definition newgrf_debug_data.h:68
NIHVehicle::GetParent
uint GetParent(uint index) const override
Get the parent "window_number" of a given instance.
Definition newgrf_debug_data.h:70
NIHVehicle::GetBadges
std::span< const BadgeID > GetBadges(uint index) const override
Get the list of badges of this item.
Definition newgrf_debug_data.h:75
NIHVehicle::GetSpec
const void * GetSpec(uint index) const override
Get (NewGRF) specs given an index.
Definition newgrf_debug_data.h:72
NIHVehicle::GetGRFID
uint32_t GetGRFID(uint index) const override
Get the GRFID of the file that includes this item.
Definition newgrf_debug_data.h:74
NIHVehicle::GetName
std::string GetName(uint index) const override
Get the name of this item.
Definition newgrf_debug_data.h:73
NIHVehicle::IsInspectable
bool IsInspectable(uint index) const override
Is the item with the given index inspectable?
Definition newgrf_debug_data.h:69
NIHVehicle::GetInstance
const void * GetInstance(uint index) const override
Get the instance given an index.
Definition newgrf_debug_data.h:71
NIHVehicle::Resolve
uint Resolve(uint index, uint var, uint param, bool &avail) const override
Resolve (action2) variable for a given index.
Definition newgrf_debug_data.h:77
NIHelper
Helper class to wrap some functionality/queries in.
Definition newgrf_debug_gui.cpp:129
GetIndustrySpec
const IndustrySpec * GetIndustrySpec(IndustryType thistype)
Accessor for array _industry_specs.
Definition industry_cmd.cpp:126
GetIndustryTileSpec
const IndustryTileSpec * GetIndustryTileSpec(IndustryGfx gfx)
Accessor for array _industry_tile_specs.
Definition industry_cmd.cpp:140
GetIndustryGfx
IndustryGfx GetIndustryGfx(Tile t)
Get the industry graphics ID for the given industry tile.
Definition industry_map.h:137
GetIndustryIndex
IndustryID GetIndustryIndex(Tile t)
Get the industry ID of the given tile.
Definition industry_map.h:63
GSF_FAKE_TOWNS
@ GSF_FAKE_TOWNS
Fake town GrfSpecFeature for NewGRF debugging (parent scope)
Definition newgrf.h:94
GSF_FAKE_END
@ GSF_FAKE_END
End of the fake features.
Definition newgrf.h:95
StationGfx
uint8_t StationGfx
Copy from station_map.h.
Definition newgrf_airport.h:23
AirportTileCallbackMask::DrawFoundations
@ DrawFoundations
decides if default foundations need to be drawn
AirportTileCallbackMask::AnimationNextFrame
@ AnimationNextFrame
decides next animation frame
AirportTileCallbackMask::AnimationSpeed
@ AnimationSpeed
decides animation speed
StationCallbackMask::DrawTileLayout
@ DrawTileLayout
Use callback to select a tile layout to use when drawing.
StationCallbackMask::Avail
@ Avail
Availability of station in construction window.
StationCallbackMask::AnimationNextFrame
@ AnimationNextFrame
Use a custom next frame callback.
StationCallbackMask::AnimationSpeed
@ AnimationSpeed
Customize the animation speed of the station.
StationCallbackMask::SlopeCheck
@ SlopeCheck
Check slope of new station tiles.
VehicleCallbackMask::VisualEffect
@ VisualEffect
Visual effects and wagon power (trains, road vehicles and ships)
VehicleCallbackMask::SoundEffect
@ SoundEffect
Vehicle uses custom sound effects.
VehicleCallbackMask::Name
@ Name
Engine name.
VehicleCallbackMask::RefitCapacity
@ RefitCapacity
Cargo capacity after refit.
VehicleCallbackMask::ArticEngine
@ ArticEngine
Add articulated engines (trains and road vehicles)
VehicleCallbackMask::Length
@ Length
Vehicle length (trains and road vehicles)
VehicleCallbackMask::ColourRemap
@ ColourRemap
Change colour mapping of vehicle.
VehicleCallbackMask::LoadAmount
@ LoadAmount
Load amount.
VehicleCallbackMask::CargoSuffix
@ CargoSuffix
Show suffix after cargo name.
IndustryCallbackMask::Probability
@ Probability
industry availability/probability callback
IndustryCallbackMask::WindowMoreText
@ WindowMoreText
additional text in industry window
IndustryCallbackMask::FundMoreText
@ FundMoreText
additional text in fund window
IndustryCallbackMask::InputCargoTypes
@ InputCargoTypes
customize the cargoes the industry requires
IndustryCallbackMask::ProductionChange
@ ProductionChange
controls random production change
IndustryCallbackMask::DecideColour
@ DecideColour
give a custom colour to newly build industries
IndustryCallbackMask::SpecialEffect
@ SpecialEffect
control special effects
IndustryCallbackMask::ProdChangeBuild
@ ProdChangeBuild
initialise production level on construction
IndustryCallbackMask::Location
@ Location
check industry construction on given area
IndustryCallbackMask::MonthlyProdChange
@ MonthlyProdChange
controls monthly random production change
IndustryCallbackMask::CargoSuffix
@ CargoSuffix
cargo sub-type display
IndustryCallbackMask::RefuseCargo
@ RefuseCargo
option out of accepting cargo
IndustryCallbackMask::OutputCargoTypes
@ OutputCargoTypes
customize the cargoes the industry produces
CBID_HOUSE_ANIMATION_TRIGGER_WATCHED_CARGO_ACCEPTED
@ CBID_HOUSE_ANIMATION_TRIGGER_WATCHED_CARGO_ACCEPTED
Called when a cargo type specified in property 20 is accepted.
Definition newgrf_callbacks.h:211
CBID_INDUSTRY_OUTPUT_CARGO_TYPES
@ CBID_INDUSTRY_OUTPUT_CARGO_TYPES
Customize the output cargo types of a newly build industry.
Definition newgrf_callbacks.h:223
CBID_HOUSE_ANIMATION_TRIGGER_TILE_LOOP
@ CBID_HOUSE_ANIMATION_TRIGGER_TILE_LOOP
Called for periodically starting or stopping the animation.
Definition newgrf_callbacks.h:68
CBID_VEHICLE_SOUND_EFFECT
@ CBID_VEHICLE_SOUND_EFFECT
Called to play a special sound effect.
Definition newgrf_callbacks.h:149
CBID_INDTILE_ANIMATION_SPEED
@ CBID_INDTILE_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
Definition newgrf_callbacks.h:107
CBID_OBJECT_FUND_MORE_TEXT
@ CBID_OBJECT_FUND_MORE_TEXT
Called to determine more text in the fund object window.
Definition newgrf_callbacks.h:271
CBID_INDUSTRY_SPECIAL_EFFECT
@ CBID_INDUSTRY_SPECIAL_EFFECT
Called to determine industry special effects.
Definition newgrf_callbacks.h:176
CBID_INDUSTRY_PROBABILITY
@ CBID_INDUSTRY_PROBABILITY
Called to determine if the given industry type is available.
Definition newgrf_callbacks.h:89
CBID_INDTILE_SHAPE_CHECK
@ CBID_INDTILE_SHAPE_CHECK
Called to determine if the given industry tile can be built on specific tile.
Definition newgrf_callbacks.h:134
CBID_AIRPTILE_DRAW_FOUNDATIONS
@ CBID_AIRPTILE_DRAW_FOUNDATIONS
Called to determine the type (if any) of foundation to draw for an airport tile.
Definition newgrf_callbacks.h:235
CBID_STATION_ANIMATION_TRIGGER
@ CBID_STATION_ANIMATION_TRIGGER
Called for periodically starting or stopping the animation.
Definition newgrf_callbacks.h:187
CBID_INDTILE_AUTOSLOPE
@ CBID_INDTILE_AUTOSLOPE
Called to determine if industry can alter the ground below industry tile.
Definition newgrf_callbacks.h:179
CBID_VEHICLE_AUTOREPLACE_SELECTION
@ CBID_VEHICLE_AUTOREPLACE_SELECTION
Return the vehicles this given vehicle can be "upgraded" to.
Definition newgrf_callbacks.h:152
CBID_STATION_BUILD_TILE_LAYOUT
@ CBID_STATION_BUILD_TILE_LAYOUT
Called when building a station to customize the tile layout.
Definition newgrf_callbacks.h:98
CBID_VEHICLE_COLOUR_MAPPING
@ CBID_VEHICLE_COLOUR_MAPPING
Called to determine if a specific colour map should be used for a vehicle instead of the default live...
Definition newgrf_callbacks.h:128
CBID_INDUSTRY_DECIDE_COLOUR
@ CBID_INDUSTRY_DECIDE_COLOUR
Called to determine the colour of an industry.
Definition newgrf_callbacks.h:217
CBID_INDUSTRY_WINDOW_MORE_TEXT
@ CBID_INDUSTRY_WINDOW_MORE_TEXT
Called to determine more text in the industry window.
Definition newgrf_callbacks.h:173
CBID_VEHICLE_32DAY_CALLBACK
@ CBID_VEHICLE_32DAY_CALLBACK
Called for every vehicle every 32 days (not all on same date though).
Definition newgrf_callbacks.h:146
CBID_OBJECT_LAND_SLOPE_CHECK
@ CBID_OBJECT_LAND_SLOPE_CHECK
Callback done for each tile of an object to check the slope.
Definition newgrf_callbacks.h:256
CBID_VEHICLE_NAME
@ CBID_VEHICLE_NAME
Called to determine the engine name to show.
Definition newgrf_callbacks.h:286
CBID_STATION_DRAW_TILE_LAYOUT
@ CBID_STATION_DRAW_TILE_LAYOUT
Choose a tile layout to draw, instead of the standard range.
Definition newgrf_callbacks.h:44
CBID_VEHICLE_CARGO_SUFFIX
@ CBID_VEHICLE_CARGO_SUFFIX
Determine the cargo "suffixes" for each refit possibility of a cargo.
Definition newgrf_callbacks.h:62
CBID_HOUSE_COLOUR
@ CBID_HOUSE_COLOUR
Called to determine the colour of a town building.
Definition newgrf_callbacks.h:77
CBID_HOUSE_DRAW_FOUNDATIONS
@ CBID_HOUSE_DRAW_FOUNDATIONS
Called to determine the type (if any) of foundation to draw for house tile.
Definition newgrf_callbacks.h:229
CBID_AIRPTILE_ANIMATION_TRIGGER
@ CBID_AIRPTILE_ANIMATION_TRIGGER
Called for periodically starting or stopping the animation.
Definition newgrf_callbacks.h:238
CBID_INDTILE_DRAW_FOUNDATIONS
@ CBID_INDTILE_DRAW_FOUNDATIONS
Called to determine the type (if any) of foundation to draw for industry tile.
Definition newgrf_callbacks.h:137
CBID_INDUSTRY_PRODUCTION_CHANGE
@ CBID_INDUSTRY_PRODUCTION_CHANGE
Called on production changes, so it can be adjusted.
Definition newgrf_callbacks.h:113
CBID_INDUSTRY_CARGO_SUFFIX
@ CBID_INDUSTRY_CARGO_SUFFIX
Called to determine text to display after cargo name.
Definition newgrf_callbacks.h:164
CBID_OBJECT_AUTOSLOPE
@ CBID_OBJECT_AUTOSLOPE
Called to determine if one can alter the ground below an object tile.
Definition newgrf_callbacks.h:274
CBID_HOUSE_CARGO_ACCEPTANCE
@ CBID_HOUSE_CARGO_ACCEPTANCE
Called to decide how much cargo a town building can accept.
Definition newgrf_callbacks.h:80
CBID_VEHICLE_LENGTH
@ CBID_VEHICLE_LENGTH
Vehicle length, returns the amount of 1/8's the vehicle is shorter for trains and RVs.
Definition newgrf_callbacks.h:35
CBID_HOUSE_ANIMATION_SPEED
@ CBID_HOUSE_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
Definition newgrf_callbacks.h:83
CBID_HOUSE_AUTOSLOPE
@ CBID_HOUSE_AUTOSLOPE
Called to determine if one can alter the ground below a house tile.
Definition newgrf_callbacks.h:232
CBID_AIRPTILE_ANIMATION_SPEED
@ CBID_AIRPTILE_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
Definition newgrf_callbacks.h:244
CBID_INDUSTRY_REFUSE_CARGO
@ CBID_INDUSTRY_REFUSE_CARGO
Called to determine if the industry can still accept or refuse more cargo arrival.
Definition newgrf_callbacks.h:182
CBID_STATION_AVAILABILITY
@ CBID_STATION_AVAILABILITY
Determine whether a newstation should be made available to build.
Definition newgrf_callbacks.h:41
CBID_HOUSE_ANIMATION_NEXT_FRAME
@ CBID_HOUSE_ANIMATION_NEXT_FRAME
Determine the next animation frame for a house.
Definition newgrf_callbacks.h:65
CBID_HOUSE_CUSTOM_NAME
@ CBID_HOUSE_CUSTOM_NAME
Called on the Get Tile Description for an house tile.
Definition newgrf_callbacks.h:226
CBID_INDUSTRY_MONTHLYPROD_CHANGE
@ CBID_INDUSTRY_MONTHLYPROD_CHANGE
Called monthly on production changes, so it can be adjusted more frequently.
Definition newgrf_callbacks.h:155
CBID_HOUSE_DENY_DESTRUCTION
@ CBID_HOUSE_DENY_DESTRUCTION
Called to determine whether a town building can be destroyed.
Definition newgrf_callbacks.h:196
CBID_OBJECT_ANIMATION_TRIGGER
@ CBID_OBJECT_ANIMATION_TRIGGER
Called for periodically starting or stopping the animation.
Definition newgrf_callbacks.h:262
CBID_VEHICLE_START_STOP_CHECK
@ CBID_VEHICLE_START_STOP_CHECK
Called when the company (or AI) tries to start or stop a vehicle.
Definition newgrf_callbacks.h:143
CBID_STATION_ANIMATION_NEXT_FRAME
@ CBID_STATION_ANIMATION_NEXT_FRAME
Called to determine station tile next animation frame.
Definition newgrf_callbacks.h:190
CBID_STATION_ANIMATION_SPEED
@ CBID_STATION_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
Definition newgrf_callbacks.h:193
CBID_HOUSE_ALLOW_CONSTRUCTION
@ CBID_HOUSE_ALLOW_CONSTRUCTION
Determine whether the house can be built on the specified tile.
Definition newgrf_callbacks.h:56
CBID_INDUSTRY_FUND_MORE_TEXT
@ CBID_INDUSTRY_FUND_MORE_TEXT
Called to determine more text in the fund industry window.
Definition newgrf_callbacks.h:167
CBID_HOUSE_ACCEPT_CARGO
@ CBID_HOUSE_ACCEPT_CARGO
Called to determine which cargoes a town building should accept.
Definition newgrf_callbacks.h:116
CBID_OBJECT_ANIMATION_NEXT_FRAME
@ CBID_OBJECT_ANIMATION_NEXT_FRAME
Determine the next animation frame for a house.
Definition newgrf_callbacks.h:259
CBID_TRAIN_ALLOW_WAGON_ATTACH
@ CBID_TRAIN_ALLOW_WAGON_ATTACH
Determine whether a wagon can be attached to an already existing train.
Definition newgrf_callbacks.h:74
CBID_HOUSE_PRODUCE_CARGO
@ CBID_HOUSE_PRODUCE_CARGO
Called to determine how much cargo a town building produces.
Definition newgrf_callbacks.h:131
CBID_INDTILE_ANIMATION_TRIGGER
@ CBID_INDTILE_ANIMATION_TRIGGER
Called for periodically starting or stopping the animation.
Definition newgrf_callbacks.h:101
CBID_VEHICLE_MODIFY_PROPERTY
@ CBID_VEHICLE_MODIFY_PROPERTY
Called to modify various vehicle properties.
Definition newgrf_callbacks.h:161
CBID_OBJECT_COLOUR
@ CBID_OBJECT_COLOUR
Called to determine the colour of a town building.
Definition newgrf_callbacks.h:268
CBID_VEHICLE_ADDITIONAL_TEXT
@ CBID_VEHICLE_ADDITIONAL_TEXT
This callback is called from vehicle purchase lists.
Definition newgrf_callbacks.h:95
CBID_HOUSE_ANIMATION_TRIGGER_CONSTRUCTION_STAGE_CHANGED
@ CBID_HOUSE_ANIMATION_TRIGGER_CONSTRUCTION_STAGE_CHANGED
Called whenever the construction stage of a house changes.
Definition newgrf_callbacks.h:71
CBID_VEHICLE_REFIT_CAPACITY
@ CBID_VEHICLE_REFIT_CAPACITY
Refit capacity, the passed vehicle needs to have its ->cargo_type set to the cargo we are refitting t...
Definition newgrf_callbacks.h:50
CBID_OBJECT_ANIMATION_SPEED
@ CBID_OBJECT_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
Definition newgrf_callbacks.h:265
CBID_STATION_LAND_SLOPE_CHECK
@ CBID_STATION_LAND_SLOPE_CHECK
Callback done for each tile of a station to check the slope.
Definition newgrf_callbacks.h:214
CBID_VEHICLE_LOAD_AMOUNT
@ CBID_VEHICLE_LOAD_AMOUNT
Determine the amount of cargo to load per unit of time when using gradual loading.
Definition newgrf_callbacks.h:38
CBID_HOUSE_DESTRUCTION
@ CBID_HOUSE_DESTRUCTION
Called periodically to determine if a house should be destroyed.
Definition newgrf_callbacks.h:86
CBID_VEHICLE_VISUAL_EFFECT
@ CBID_VEHICLE_VISUAL_EFFECT
Visual effects and wagon power.
Definition newgrf_callbacks.h:32
CBID_INDUSTRY_PROD_CHANGE_BUILD
@ CBID_INDUSTRY_PROD_CHANGE_BUILD
Called when industry is built to set initial production level.
Definition newgrf_callbacks.h:280
CBID_INDTILE_CARGO_ACCEPTANCE
@ CBID_INDTILE_CARGO_ACCEPTANCE
Called to query the cargo acceptance of the industry tile.
Definition newgrf_callbacks.h:119
CBID_INDUSTRY_LOCATION
@ CBID_INDUSTRY_LOCATION
Called to determine if the given industry can be built on specific area.
Definition newgrf_callbacks.h:110
CBID_INDTILE_ACCEPT_CARGO
@ CBID_INDTILE_ACCEPT_CARGO
Called to determine which cargoes an industry should accept.
Definition newgrf_callbacks.h:122
CBID_VEHICLE_ARTIC_ENGINE
@ CBID_VEHICLE_ARTIC_ENGINE
Builds articulated engines for trains and RVs.
Definition newgrf_callbacks.h:53
CBID_AIRPTILE_ANIMATION_NEXT_FRAME
@ CBID_AIRPTILE_ANIMATION_NEXT_FRAME
Called to determine airport tile next animation frame.
Definition newgrf_callbacks.h:241
CBID_INDTILE_ANIMATION_NEXT_FRAME
@ CBID_INDTILE_ANIMATION_NEXT_FRAME
Called to determine industry tile next animation frame.
Definition newgrf_callbacks.h:104
CBID_INDUSTRY_INPUT_CARGO_TYPES
@ CBID_INDUSTRY_INPUT_CARGO_TYPES
Customize the input cargo types of a newly build industry.
Definition newgrf_callbacks.h:220
ObjectCallbackMask::FundMoreText
@ FundMoreText
additional text in fund window
ObjectCallbackMask::Autoslope
@ Autoslope
decides allowance of autosloping
ObjectCallbackMask::AnimationNextFrame
@ AnimationNextFrame
decides next animation frame
ObjectCallbackMask::AnimationSpeed
@ AnimationSpeed
decides animation speed
ObjectCallbackMask::Colour
@ Colour
decide the colour of the building
ObjectCallbackMask::SlopeCheck
@ SlopeCheck
decides slope suitability
RoadStopCallbackMask::Avail
@ Avail
Availability of road stop in construction window.
RoadStopCallbackMask::AnimationNextFrame
@ AnimationNextFrame
Use a custom next frame callback.
RoadStopCallbackMask::AnimationSpeed
@ AnimationSpeed
Customize the animation speed of the road stop.
IndustryTileCallbackMask::ShapeCheck
@ ShapeCheck
decides slope suitability
IndustryTileCallbackMask::AcceptCargo
@ AcceptCargo
decides accepted types
IndustryTileCallbackMask::CargoAcceptance
@ CargoAcceptance
decides amount of cargo acceptance
IndustryTileCallbackMask::DrawFoundations
@ DrawFoundations
decides if default foundations need to be drawn
IndustryTileCallbackMask::Autoslope
@ Autoslope
decides allowance of autosloping
IndustryTileCallbackMask::AnimationNextFrame
@ AnimationNextFrame
decides next animation frame
IndustryTileCallbackMask::AnimationSpeed
@ AnimationSpeed
decides animation speed
HouseCallbackMask::AllowConstruction
@ AllowConstruction
decide whether the house can be built on a given tile
HouseCallbackMask::AcceptCargo
@ AcceptCargo
decides accepted types
HouseCallbackMask::Destruction
@ Destruction
trigger destruction of building
HouseCallbackMask::CargoAcceptance
@ CargoAcceptance
decides amount of cargo acceptance
HouseCallbackMask::DrawFoundations
@ DrawFoundations
decides if default foundations need to be drawn
HouseCallbackMask::ProduceCargo
@ ProduceCargo
custom cargo production
HouseCallbackMask::Autoslope
@ Autoslope
decides allowance of autosloping
HouseCallbackMask::AnimationNextFrame
@ AnimationNextFrame
decides next animation frame
HouseCallbackMask::DenyDestruction
@ DenyDestruction
conditional protection
HouseCallbackMask::AnimationSpeed
@ AnimationSpeed
decides animation speed
HouseCallbackMask::Colour
@ Colour
decide the colour of the building
HouseCallbackMask::AnimationTriggerConstructionStageChanged
@ AnimationTriggerConstructionStageChanged
change animation when construction stage changes
HouseCallbackMask::AnimationTriggerTileLoop
@ AnimationTriggerTileLoop
periodically start/stop the animation
TCX_NORMAL
@ TCX_NORMAL
Nothing special.
Definition newgrf_commons.h:25
GetGrfSpecFeature
GrfSpecFeature GetGrfSpecFeature(TileIndex tile)
Get the GrfSpecFeature associated with the tile.
Definition newgrf_debug_gui.cpp:760
_nifeatures
static const NIFeature *const _nifeatures[]
Table with all NIFeatures.
Definition newgrf_debug_data.h:724
GetInspectWindowNumber
static uint GetInspectWindowNumber(GrfSpecFeature feature, uint index)
Get the window number for the inspect window given a feature and index.
Definition newgrf_debug_gui.cpp:72
NIT_CARGO
@ NIT_CARGO
The property is a cargo.
Definition newgrf_debug_gui.cpp:86
VSG_SCOPE_SELF
@ VSG_SCOPE_SELF
Resolved object itself.
Definition newgrf_spritegroup.h:85
GetRailTypeInfo
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
Definition rail.h:300
GetRailType
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
Definition rail_map.h:115
GetRoadTypeInfo
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
Definition road.h:215
RoadType
RoadType
The different roadtypes we support.
Definition road_type.h:23
INVALID_ROADTYPE
@ INVALID_ROADTYPE
flag for invalid roadtype
Definition road_type.h:28
GetStationType
StationType GetStationType(Tile t)
Get the station type of this tile.
Definition station_map.h:44
GetStationGfx
StationGfx GetStationGfx(Tile t)
Get the station graphics of this tile.
Definition station_map.h:68
GetStationIndex
StationID GetStationIndex(Tile t)
Get StationID from a tile.
Definition station_map.h:28
GetAirportGfx
StationGfx GetAirportGfx(Tile t)
Get the station graphics of this airport tile.
Definition station_map.h:332
lengthof
#define lengthof(array)
Return the length of an fixed size array.
Definition stdafx.h:271
GetString
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
Definition strings.cpp:424
INVALID_STRING_ID
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Definition strings_type.h:20
AirportResolverObject
Resolver object for airports.
Definition newgrf_airport.h:183
AirportResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_airport.h:192
AirportSpec::grf_prop
SubstituteGRFFileProps grf_prop
Properties related to the grf file.
Definition newgrf_airport.h:125
AirportSpec::Get
static const AirportSpec * Get(uint8_t type)
Retrieve airport spec for the given airport.
Definition newgrf_airport.cpp:59
AirportTileResolverObject
Resolver for tiles of an airport.
Definition newgrf_airporttiles.h:47
AirportTileResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_airporttiles.h:54
AirportTileSpec::Get
static const AirportTileSpec * Get(StationGfx gfx)
Retrieve airport tile spec for the given airport tile.
Definition newgrf_airporttiles.cpp:39
AirportTileSpec::grf_prop
SubstituteGRFFileProps grf_prop
properties related the the grf file
Definition newgrf_airporttiles.h:76
AirportTileSpec::GetByTile
static const AirportTileSpec * GetByTile(TileIndex tile)
Retrieve airport tile spec for the given airport tile.
Definition newgrf_airporttiles.cpp:52
Airport::type
uint8_t type
Type of this airport,.
Definition station_base.h:355
Airport::psa
PersistentStorage * psa
Persistent storage for NewGRF airports.
Definition station_base.h:359
Airport::layout
uint8_t layout
Airport layout number.
Definition station_base.h:356
BaseStation::GetByTile
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
Definition base_station_base.h:160
BaseVehicle::type
VehicleType type
Type of vehicle.
Definition vehicle_type.h:51
GRFFilePropsBase::grfid
uint32_t grfid
grfid that introduced this entity.
Definition newgrf_commons.h:317
GRFFilePropsBase::HasGrfFile
bool HasGrfFile() const
Test if this entity was introduced by NewGRF.
Definition newgrf_commons.h:326
HouseResolverObject
Resolver object to be used for houses (feature 07 spritegroups).
Definition newgrf_house.h:52
HouseResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_house.h:60
HouseSpec::grf_prop
SubstituteGRFFileProps grf_prop
Properties related the the grf file.
Definition house.h:114
HouseSpec::Get
static HouseSpec * Get(size_t house_id)
Get the spec for a house ID.
Definition newgrf_house.cpp:70
IndustriesResolverObject
Resolver for industries.
Definition newgrf_industries.h:42
IndustriesResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_industries.h:51
IndustrySpec::grf_prop
SubstituteGRFFileProps grf_prop
properties related to the grf file
Definition industrytype.h:134
IndustryTileResolverObject
Resolver for industry tiles.
Definition newgrf_industrytiles.h:38
IndustryTileResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_industrytiles.h:46
IndustryTileSpec::grf_prop
SubstituteGRFFileProps grf_prop
properties related to the grf file
Definition industrytype.h:168
Industry
Defines the internal data of a functional industry.
Definition industry.h:62
Industry::type
IndustryType type
type of industry.
Definition industry.h:115
Industry::psa
PersistentStorage * psa
Persistent storage for NewGRF industries.
Definition industry.h:136
Industry::GetByTile
static Industry * GetByTile(TileIndex tile)
Get the industry of the given tile.
Definition industry.h:251
Industry::location
TileArea location
Location of the industry.
Definition industry.h:106
NICallback
Representation of the available callbacks with information on when they actually apply.
Definition newgrf_debug_gui.cpp:104
NIFeature
Container for all information for a given feature.
Definition newgrf_debug_gui.cpp:215
NIProperty
Representation of the data from a NewGRF property.
Definition newgrf_debug_gui.cpp:92
NIVariable
Representation on the NewGRF variables.
Definition newgrf_debug_gui.cpp:123
ObjectResolverObject
A resolver object to be used with feature 0F spritegroups.
Definition newgrf_object.h:134
ObjectResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_object.h:141
ObjectSpec::GetByTile
static const ObjectSpec * GetByTile(TileIndex tile)
Get the specification associated with a tile.
Definition newgrf_object.cpp:69
Object::GetByTile
static Object * GetByTile(TileIndex tile)
Get the object associated with a tile.
Definition object_cmd.cpp:55
OrthogonalTileArea::tile
TileIndex tile
The base tile of the area.
Definition tilearea_type.h:19
PersistentStorageArray::storage
StorageType storage
Memory for the storage array.
Definition newgrf_storage.h:70
Pool::PoolItem<&_vehicle_pool >::Get
static Titem * Get(auto index)
Returns Titem with given index.
Definition pool_type.hpp:387
Pool::PoolItem::index
Tindex index
Index of this pool item.
Definition pool_type.hpp:286
Pool::PoolItem<&_town_pool >::IsValidID
static bool IsValidID(auto index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition pool_type.hpp:376
RailTypeResolverObject
Resolver object for rail types.
Definition newgrf_railtype.h:39
RailTypeResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_railtype.h:44
RoadStopResolverObject
Road stop resolver.
Definition newgrf_roadstop.h:106
RoadTypeResolverObject
Resolver object for road types.
Definition newgrf_roadtype.h:40
RoadTypeResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_roadtype.h:45
ScopeResolver::GetVariable
virtual uint32_t GetVariable(uint8_t variable, uint32_t parameter, bool &available) const
Get a variable value.
Definition newgrf_spritegroup.cpp:104
SpecializedStation< Station, false >::Get
static Station * Get(auto index)
Gets station with given index.
Definition base_station_base.h:248
StationResolverObject
Station resolver.
Definition newgrf_station.h:68
StationResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_station.h:77
Station
Station data structure.
Definition station_base.h:500
Station::airport
Airport airport
Tile area the airport covers.
Definition station_base.h:514
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
TownResolverObject
Resolver of town properties.
Definition newgrf_town.h:42
TownResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_town.h:47
Town
Town data structure.
Definition town.h:63
VehicleResolverObject
Resolver for a vehicle (chain)
Definition newgrf_engine.h:47
VehicleResolverObject::GetScope
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
Definition newgrf_engine.cpp:318
VehicleResolverObject::WO_CACHED
@ WO_CACHED
Resolve wagon overrides using TrainCache::cached_override.
Definition newgrf_engine.h:52
Vehicle
Vehicle data structure.
Definition vehicle_base.h:205
Vehicle::engine_type
EngineID engine_type
The type of engine used for this vehicle.
Definition vehicle_base.h:278
Vehicle::First
Vehicle * First() const
Get the first vehicle of this vehicle chain.
Definition vehicle_base.h:600
GetHouseType
HouseID GetHouseType(Tile t)
Get the type of this house, which is an index into the house spec array.
Definition town_map.h:60
GetTownIndex
TownID GetTownIndex(Tile t)
Get the index of which town this house/street is attached to.
Definition town_map.h:23