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