OpenTTD Source  20241124-master-g9399a92a4f
newgrf_generic.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 #ifndef NEWGRF_GENERIC_H
11 #define NEWGRF_GENERIC_H
12 
13 #include "industry_type.h"
14 #include "newgrf.h"
15 #include "tile_type.h"
16 
17 struct SpriteGroup;
18 
30 
34 
38 
40 
42 };
43 
44 static const IndustryType IT_AI_UNKNOWN = 0xFE;
45 static const IndustryType IT_AI_TOWN = 0xFF;
46 
48 void AddGenericCallback(uint8_t feature, const GRFFile *file, const SpriteGroup *group);
49 
50 uint16_t GetAiPurchaseCallbackResult(uint8_t feature, CargoID cargo_type, uint8_t default_selection, IndustryType src_industry, IndustryType dst_industry, uint8_t distance, AIConstructionEvent event, uint8_t count, uint8_t station_size, const GRFFile **file);
52 
54 inline void AmbientSoundEffect(TileIndex tile)
55 {
56  /* Only run callback if enabled. */
57  if (!HasGrfMiscBit(GMB_AMBIENT_SOUND_CALLBACK)) return;
58 
60 }
61 
62 #endif /* NEWGRF_GENERIC_H */
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
Types related to the industry.
Base for the NewGRF implementation.
bool HasGrfMiscBit(GrfMiscBit bit)
Check for grf miscellaneous bits.
Definition: newgrf.h:189
void AddGenericCallback(uint8_t feature, const GRFFile *file, const SpriteGroup *group)
Add a generic feature callback sprite group to the appropriate feature list.
void AmbientSoundEffectCallback(TileIndex tile)
'Execute' the ambient sound effect callback.
void AmbientSoundEffect(TileIndex tile)
Play an ambient sound effect for an empty tile.
uint16_t GetAiPurchaseCallbackResult(uint8_t feature, CargoID cargo_type, uint8_t default_selection, IndustryType src_industry, IndustryType dst_industry, uint8_t distance, AIConstructionEvent event, uint8_t count, uint8_t station_size, const GRFFile **file)
'Execute' an AI purchase selection callback
static const IndustryType IT_AI_UNKNOWN
The AI has no specific industry in mind.
void ResetGenericCallbacks()
Reset all generic feature callback sprite groups.
AIConstructionEvent
AI events for asking the NewGRF for information.
@ AICE_STATION_GET_STATION_ID
Get a station ID to build.
@ AICE_TRAIN_GET_RAIL_WAGON
Check if we should build an engine.
@ AICE_ROAD_CHECK_ENGINE
Check if we should build an engine.
@ AICE_TRAIN_CHECK_ELRAIL_ENGINE
Check if we should build an engine.
@ AICE_TRAIN_GET_RAILTYPE
Check if we should build a railtype.
@ AICE_SHIP_GET_FIRST_ENGINE
Unused, we check all.
@ AICE_TRAIN_CHECK_MONORAIL_ENGINE
Check if we should build an engine.
@ AICE_SHIP_GET_NUMBER_ENGINES
Unused, we check all.
@ AICE_TRAIN_GET_MONORAIL_WAGON
Check if we should build an engine.
@ AICE_ROAD_GET_FIRST_ENGINE
Unused, we check all.
@ AICE_TRAIN_CHECK_MAGLEV_ENGINE
Check if we should build an engine.
@ AICE_ROAD_GET_NUMBER_ENGINES
Unused, we check all.
@ AICE_AIRCRAFT_CHECK_ENGINE
Check if we should build an engine.
@ AICE_TRAIN_GET_ELRAIL_WAGON
Check if we should build an engine.
@ AICE_TRAIN_CHECK_RAIL_ENGINE
Check if we should build an engine.
@ AICE_TRAIN_GET_MAGLEV_WAGON
Check if we should build an engine.
@ AICE_SHIP_CHECK_ENGINE
Check if we should build an engine.
static const IndustryType IT_AI_TOWN
The AI actually wants to transport to/from a town, not an industry.
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:108
Types related to tiles.