OpenTTD: src/newgrf_generic.h Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

newgrf_generic.h
Go to the documentation of this file.
1 /* $Id: newgrf_generic.h 23735 2012-01-03 20:26:05Z rubidium $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
9
12 #ifndef NEWGRF_GENERIC_H
13 #define NEWGRF_GENERIC_H
14
15 #include "industry_type.h"
16 #include "newgrf.h"
17 #include "tile_type.h"
18
19 struct SpriteGroup;
20
22 enum AIConstructionEvent {
23 AICE_TRAIN_CHECK_RAIL_ENGINE = 0x00,
24 AICE_TRAIN_CHECK_ELRAIL_ENGINE = 0x01,
25 AICE_TRAIN_CHECK_MONORAIL_ENGINE = 0x02,
26 AICE_TRAIN_CHECK_MAGLEV_ENGINE = 0x03,
27 AICE_TRAIN_GET_RAIL_WAGON = 0x08,
28 AICE_TRAIN_GET_ELRAIL_WAGON = 0x09,
29 AICE_TRAIN_GET_MONORAIL_WAGON = 0x0A,
30 AICE_TRAIN_GET_MAGLEV_WAGON = 0x0B,
31 AICE_TRAIN_GET_RAILTYPE = 0x0F,
32
33 AICE_ROAD_CHECK_ENGINE = 0x00,
34 AICE_ROAD_GET_FIRST_ENGINE = 0x01,
35 AICE_ROAD_GET_NUMBER_ENGINES = 0x02,
36
37 AICE_SHIP_CHECK_ENGINE = 0x00,
38 AICE_SHIP_GET_FIRST_ENGINE = 0x01,
39 AICE_SHIP_GET_NUMBER_ENGINES = 0x02,
40
41 AICE_AIRCRAFT_CHECK_ENGINE = 0x00,
42
43 AICE_STATION_GET_STATION_ID = 0x00,
44 };
45
46 static const IndustryType IT_AI_UNKNOWN = 0xFE;
47 static const IndustryType IT_AI_TOWN = 0xFF;
48
49 void ResetGenericCallbacks();
50 void AddGenericCallback(uint8 feature, const GRFFile *file, const SpriteGroup *group);
51
52 uint16 GetAiPurchaseCallbackResult(uint8 feature, CargoID cargo_type, uint8 default_selection, IndustryType src_industry, IndustryType dst_industry, uint8 distance, AIConstructionEvent event, uint8 count, uint8 station_size, const GRFFile **file);
53
55 static inline void AmbientSoundEffect(TileIndex tile)
56 {
57 /* Only run callback if enabled. */
58 if (!HasGrfMiscBit(GMB_AMBIENT_SOUND_CALLBACK)) return;
59
60 extern void AmbientSoundEffectCallback(TileIndex tile);
61 AmbientSoundEffectCallback(tile);
62 }
63
64 #endif /* NEWGRF_GENERIC_H */