newgrf.h
Go to the documentation of this file.00001
00002
00005 #ifndef NEWGRF_H
00006 #define NEWGRF_H
00007
00008 #include "town_type.h"
00009 #include "newgrf_config.h"
00010 #include "cargotype.h"
00011 #include "industry_type.h"
00012 #include "station_type.h"
00013 #include "rail_type.h"
00014
00015 enum GrfLoadingStage {
00016 GLS_FILESCAN,
00017 GLS_SAFETYSCAN,
00018 GLS_LABELSCAN,
00019 GLS_INIT,
00020 GLS_RESERVE,
00021 GLS_ACTIVATION,
00022 GLS_END,
00023 };
00024
00025 DECLARE_POSTFIX_INCREMENT(GrfLoadingStage);
00026
00027 enum GrfMiscBit {
00028 GMB_DESERT_TREES_FIELDS = 0,
00029 GMB_DESERT_PAVED_ROADS = 1,
00030 GMB_FIELD_BOUNDING_BOX = 2,
00031 GMB_TRAIN_WIDTH_32_PIXELS = 3,
00032 GMB_AMBIENT_SOUND_CALLBACK = 4,
00033 GMB_CATENARY_ON_3RD_TRACK = 5,
00034 };
00035
00036 enum GrfSpecFeature {
00037 GSF_TRAIN,
00038 GSF_ROAD,
00039 GSF_SHIP,
00040 GSF_AIRCRAFT,
00041 GSF_STATION,
00042 GSF_CANAL,
00043 GSF_BRIDGE,
00044 GSF_TOWNHOUSE,
00045 GSF_GLOBALVAR,
00046 GSF_INDUSTRYTILES,
00047 GSF_INDUSTRIES,
00048 GSF_CARGOS,
00049 GSF_SOUNDFX,
00050 GSF_END,
00051 };
00052
00053 struct GRFLabel {
00054 byte label;
00055 uint32 nfo_line;
00056 size_t pos;
00057 struct GRFLabel *next;
00058 };
00059
00060 struct GRFFile {
00061 char *filename;
00062 bool is_ottdfile;
00063 uint32 grfid;
00064 uint16 sprite_offset;
00065 byte grf_version;
00066 GRFFile *next;
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 SpriteID spriteset_start;
00080 int spriteset_numsets;
00081 int spriteset_numents;
00082 int spriteset_feature;
00083
00084 int spritegroups_count;
00085 struct SpriteGroup **spritegroups;
00086
00087 uint sound_offset;
00088
00089 StationSpec **stations;
00090 HouseSpec **housespec;
00091 IndustrySpec **industryspec;
00092 IndustryTileSpec **indtspec;
00093
00094 uint32 param[0x80];
00095 uint param_end;
00096
00097 GRFLabel *label;
00098
00099 uint8 cargo_max;
00100 CargoLabel *cargo_list;
00101 uint8 cargo_map[NUM_CARGO];
00102
00103 uint8 railtype_max;
00104 RailTypeLabel *railtype_list;
00105 };
00106
00107 extern GRFFile *_first_grffile;
00108
00109 enum ShoreReplacement {
00110 SHORE_REPLACE_NONE,
00111 SHORE_REPLACE_ACTION_5,
00112 SHORE_REPLACE_ACTION_A,
00113 SHORE_REPLACE_ONLY_NEW,
00114 };
00115
00116 struct GRFLoadedFeatures {
00117 bool has_2CC;
00118 bool has_newhouses;
00119 bool has_newindustries;
00120 ShoreReplacement shore;
00121 };
00122
00123
00124 extern GRFLoadedFeatures _loaded_newgrf_features;
00125
00126 void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage);
00127 void LoadNewGRF(uint load_index, uint file_index);
00128 void ReloadNewGRFData();
00129
00130 void CDECL grfmsg(int severity, const char *str, ...);
00131
00132 bool HasGrfMiscBit(GrfMiscBit bit);
00133 bool GetGlobalVariable(byte param, uint32 *value);
00134
00135 StringID MapGRFStringID(uint32 grfid, StringID str);
00136
00137 #endif