# newgrf_debug_data.h

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 /* Helper for filling property tables */
    00013 #define NIP(prop, base, variable, type, name) { name, cpp_offsetof(base, variable), cpp_sizeof(base, variable), prop, type }
    00014 #define NIP_END() { NULL, 0, 0, 0, 0 }
    00015
    00016 /* Helper for filling callback tables */
    00017 #define NIC(cb_id, base, variable, bit) { #cb_id, cpp_offsetof(base, variable), cpp_sizeof(base, variable), bit, cb_id }
    00018 #define NIC_END() { NULL, 0, 0, 0, 0 }
    00019
    00020 /* Helper for filling variable tables */
    00021 #define NIV(var, name) { name, var }
    00022 #define NIV_END() { NULL, 0 }
    00023
    00024
    00025 /*** NewGRF Vehicles ***/
    00026
    00027 #define NICV(cb_id, bit) NIC(cb_id, Engine, info.callback_mask, bit)
    00028 static const NICallback _nic_vehicles[] = {
    00029   NICV(CBID_VEHICLE_VISUAL_EFFECT,         CBM_VEHICLE_VISUAL_EFFECT),
    00030   NICV(CBID_VEHICLE_LENGTH,                CBM_VEHICLE_LENGTH),
    00031   NICV(CBID_VEHICLE_LOAD_AMOUNT,           CBM_VEHICLE_LOAD_AMOUNT),
    00032   NICV(CBID_VEHICLE_REFIT_CAPACITY,        CBM_VEHICLE_REFIT_CAPACITY),
    00033   NICV(CBID_VEHICLE_ARTIC_ENGINE,          CBM_VEHICLE_ARTIC_ENGINE),
    00034   NICV(CBID_VEHICLE_CARGO_SUFFIX,          CBM_VEHICLE_CARGO_SUFFIX),
    00035   NICV(CBID_TRAIN_ALLOW_WAGON_ATTACH,      CBM_NO_BIT),
    00036   NICV(CBID_VEHICLE_ADDITIONAL_TEXT,       CBM_NO_BIT),
    00037   NICV(CBID_VEHICLE_COLOUR_MAPPING,        CBM_VEHICLE_COLOUR_REMAP),
    00038   NICV(CBID_VEHICLE_START_STOP_CHECK,      CBM_NO_BIT),
    00039   NICV(CBID_VEHICLE_32DAY_CALLBACK,        CBM_NO_BIT),
    00040   NICV(CBID_VEHICLE_SOUND_EFFECT,          CBM_VEHICLE_SOUND_EFFECT),
    00041   NICV(CBID_VEHICLE_AUTOREPLACE_SELECTION, CBM_NO_BIT),
    00042   NICV(CBID_VEHICLE_MODIFY_PROPERTY,       CBM_NO_BIT),
    00043   NIC_END()
    00044 };
    00045
    00046
    00047 static const NIVariable _niv_vehicles[] = {
    00048   NIV(0x40, "position in consist and length"),
    00049   NIV(0x41, "position and length of chain of same vehicles"),
    00050   NIV(0x42, "transported cargo types"),
    00051   NIV(0x43, "player info"),
    00052   NIV(0x44, "aircraft info"),
    00053   NIV(0x45, "curvature info"),
    00054   NIV(0x46, "motion counter"),
    00055   NIV(0x47, "vehicle cargo info"),
    00056   NIV(0x48, "vehicle type info"),
    00057   NIV(0x49, "year of construction"),
    00058   NIV(0x4A, "current rail type info"),
    00059   NIV(0x60, "count vehicle id occurrences"),
    00060   NIV_END()
    00061 };
    00062
    00063 class NIHVehicle : public NIHelper {
    00064   bool IsInspectable(uint index) const                 { return Engine::Get(Vehicle::Get(index)->engine_type)->grf_prop.grffile != NULL; }
    00065   uint GetParent(uint index) const                     { const Vehicle *first = Vehicle::Get(index)->First(); return GetInspectWindowNumber(GetGrfSpecFeature(first->type), first->index); }
    00066   const void *GetInstance(uint index)const             { return Vehicle::Get(index); }
    00067   const void *GetSpec(uint index) const                { return Engine::Get(Vehicle::Get(index)->engine_type); }
    00068   void SetStringParameters(uint index) const           { this->SetSimpleStringParameters(STR_VEHICLE_NAME, index); }
    00069   void Resolve(ResolverObject *ro, uint32 index) const { extern void GetVehicleResolver(ResolverObject *ro, uint index); GetVehicleResolver(ro, index); }
    00070 };
    00071
    00072 static const NIFeature _nif_vehicle = {
    00073   NULL,
    00074   _nic_vehicles,
    00075   _niv_vehicles,
    00076   new NIHVehicle(),
    00077   0,
    00078   0
    00079 };
    00080
    00081
    00082 /*** NewGRF station (tiles) ***/
    00083
    00084 #define NICS(cb_id, bit) NIC(cb_id, StationSpec, callback_mask, bit)
    00085 static const NICallback _nic_stations[] = {
    00086   NICS(CBID_STATION_AVAILABILITY,     CBM_STATION_AVAIL),
    00087   NICS(CBID_STATION_SPRITE_LAYOUT,    CBM_NO_BIT),
    00088   NICS(CBID_STATION_TILE_LAYOUT,      CBM_STATION_SPRITE_LAYOUT),
    00089   NICS(CBID_STATION_ANIM_START_STOP,  CBM_NO_BIT),
    00090   NICS(CBID_STATION_ANIM_NEXT_FRAME,  CBM_STATION_ANIMATION_NEXT_FRAME),
    00091   NICS(CBID_STATION_ANIMATION_SPEED,  CBM_STATION_ANIMATION_SPEED),
    00092   NICS(CBID_STATION_LAND_SLOPE_CHECK, CBM_STATION_SLOPE_CHECK),
    00093   NIC_END()
    00094 };
    00095
    00096 static const NIVariable _niv_stations[] = {
    00097   NIV(0x40, "platform info and relative position"),
    00098   NIV(0x41, "platform info and relative position for individually built sections"),
    00099   NIV(0x42, "terrain and track type"),
    00100   NIV(0x43, "player info"),
    00101   NIV(0x44, "path signalling info"),
    00102   NIV(0x45, "rail continuation info"),
    00103   NIV(0x46, "platform info and relative position from middle"),
    00104   NIV(0x47, "platform info and relative position from middle for individually built sections"),
    00105   NIV(0x48, "bitmask of accepted cargoes"),
    00106   NIV(0x49, "platform info and relative position of same-direction section"),
    00107   NIV(0x4A, "current animation frame"),
    00108   NIV(0x60, "amount of cargo waiting"),
    00109   NIV(0x61, "time since last cargo pickup"),
    00110   NIV(0x62, "rating of cargo"),
    00111   NIV(0x63, "time spent on route"),
    00112   NIV(0x64, "information about last vehicle picking cargo up"),
    00113   NIV(0x65, "amount of cargo acceptance"),
    00114   NIV(0x66, "animation frame of nearby tile"),
    00115   NIV(0x67, "land info of nearby tiles"),
    00116   NIV(0x68, "station info of nearby tiles"),
    00117   NIV(0x69, "information about cargo accepted in the past"),
    00118   NIV_END()
    00119 };
    00120
    00121 class NIHStation : public NIHelper {
    00122   bool IsInspectable(uint index) const                 { return GetStationSpec(index) != NULL; }
    00123   uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
    00124   const void *GetInstance(uint index)const             { return NULL; }
    00125   const void *GetSpec(uint index) const                { return GetStationSpec(index); }
    00126   void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
    00127   void Resolve(ResolverObject *ro, uint32 index) const { extern void GetStationResolver(ResolverObject *ro, uint index); GetStationResolver(ro, index); }
    00128 };
    00129
    00130 static const NIFeature _nif_station = {
    00131   NULL,
    00132   _nic_stations,
    00133   _niv_stations,
    00134   new NIHStation(),
    00135   0,
    00136   0
    00137 };
    00138
    00139
    00140 /*** NewGRF house tiles ***/
    00141
    00142 #define NICH(cb_id, bit) NIC(cb_id, HouseSpec, callback_mask, bit)
    00143 static const NICallback _nic_house[] = {
    00144   NICH(CBID_HOUSE_ALLOW_CONSTRUCTION,        CBM_HOUSE_ALLOW_CONSTRUCTION),
    00145   NICH(CBID_HOUSE_ANIMATION_NEXT_FRAME,      CBM_HOUSE_ANIMATION_NEXT_FRAME),
    00146   NICH(CBID_HOUSE_ANIMATION_START_STOP,      CBM_HOUSE_ANIMATION_START_STOP),
    00147   NICH(CBID_HOUSE_CONSTRUCTION_STATE_CHANGE, CBM_HOUSE_CONSTRUCTION_STATE_CHANGE),
    00148   NICH(CBID_HOUSE_COLOUR,                    CBM_HOUSE_COLOUR),
    00149   NICH(CBID_HOUSE_CARGO_ACCEPTANCE,          CBM_HOUSE_CARGO_ACCEPTANCE),
    00150   NICH(CBID_HOUSE_ANIMATION_SPEED,           CBM_HOUSE_ANIMATION_SPEED),
    00151   NICH(CBID_HOUSE_DESTRUCTION,               CBM_HOUSE_DESTRUCTION),
    00152   NICH(CBID_HOUSE_ACCEPT_CARGO,              CBM_HOUSE_ACCEPT_CARGO),
    00153   NICH(CBID_HOUSE_PRODUCE_CARGO,             CBM_HOUSE_PRODUCE_CARGO),
    00154   NICH(CBID_HOUSE_DENY_DESTRUCTION,          CBM_HOUSE_DENY_DESTRUCTION),
    00155   NICH(CBID_HOUSE_WATCHED_CARGO_ACCEPTED,    CBM_NO_BIT),
    00156   NICH(CBID_HOUSE_CUSTOM_NAME,               CBM_NO_BIT),
    00157   NICH(CBID_HOUSE_DRAW_FOUNDATIONS,          CBM_HOUSE_DRAW_FOUNDATIONS),
    00158   NICH(CBID_HOUSE_AUTOSLOPE,                 CBM_HOUSE_AUTOSLOPE),
    00159   NIC_END()
    00160 };
    00161
    00162 static const NIVariable _niv_house[] = {
    00163   NIV(0x40, "construction state of tile and pseudo-random value"),
    00164   NIV(0x41, "age of building in years"),
    00165   NIV(0x42, "town zone"),
    00166   NIV(0x43, "terrain type"),
    00167   NIV(0x44, "building counts"),
    00168   NIV(0x45, "town expansion bits"),
    00169   NIV(0x46, "current animation frame"),
    00170   NIV(0x47, "xy coordinate of the building"),
    00171   NIV(0x60, "other building counts (old house type)"),
    00172   NIV(0x61, "other building counts (new house type)"),
    00173   NIV(0x62, "land info of nearby tiles"),
    00174   NIV(0x63, "current animation frame of nearby house tile"),
    00175   NIV(0x64, "cargo acceptance history of nearby stations"),
    00176   NIV(0x65, "distance of nearest house matching a given criterion"),
    00177   NIV(0x66, "class and ID of nearby house tile"),
    00178   NIV(0x67, "GRFID of nearby house tile"),
    00179   NIV_END()
    00180 };
    00181
    00182 class NIHHouse : public NIHelper {
    00183   bool IsInspectable(uint index) const                 { return HouseSpec::Get(GetHouseType(index))->grf_prop.grffile != NULL; }
    00184   uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, GetTownIndex(index)); }
    00185   const void *GetInstance(uint index)const             { return NULL; }
    00186   const void *GetSpec(uint index) const                { return HouseSpec::Get(GetHouseType(index)); }
    00187   void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_TOWN_NAME, GetTownIndex(index), index); }
    00188   void Resolve(ResolverObject *ro, uint32 index) const { extern void GetHouseResolver(ResolverObject *ro, uint index); GetHouseResolver(ro, index); }
    00189 };
    00190
    00191 static const NIFeature _nif_house = {
    00192   NULL,
    00193   _nic_house,
    00194   _niv_house,
    00195   new NIHHouse(),
    00196   0,
    00197   0
    00198 };
    00199
    00200
    00201 /*** NewGRF industry tiles ***/
    00202
    00203 #define NICIT(cb_id, bit) NIC(cb_id, IndustryTileSpec, callback_mask, bit)
    00204 static const NICallback _nic_industrytiles[] = {
    00205   NICIT(CBID_INDTILE_ANIM_START_STOP,  CBM_NO_BIT),
    00206   NICIT(CBID_INDTILE_ANIM_NEXT_FRAME,  CBM_INDT_ANIM_NEXT_FRAME),
    00207   NICIT(CBID_INDTILE_ANIMATION_SPEED,  CBM_INDT_ANIM_SPEED),
    00208   NICIT(CBID_INDTILE_CARGO_ACCEPTANCE, CBM_INDT_CARGO_ACCEPTANCE),
    00209   NICIT(CBID_INDTILE_ACCEPT_CARGO,     CBM_INDT_ACCEPT_CARGO),
    00210   NICIT(CBID_INDTILE_SHAPE_CHECK,      CBM_INDT_SHAPE_CHECK),
    00211   NICIT(CBID_INDTILE_DRAW_FOUNDATIONS, CBM_INDT_DRAW_FOUNDATIONS),
    00212   NICIT(CBID_INDTILE_AUTOSLOPE,        CBM_INDT_AUTOSLOPE),
    00213   NIC_END()
    00214 };
    00215
    00216 static const NIVariable _niv_industrytiles[] = {
    00217   NIV(0x40, "construction state of tile"),
    00218   NIV(0x41, "ground type"),
    00219   NIV(0x42, "current town zone in nearest town"),
    00220   NIV(0x43, "relative position"),
    00221   NIV(0x44, "animation frame"),
    00222   NIV(0x60, "land info of nearby tiles"),
    00223   NIV(0x61, "animation stage of nearby tiles"),
    00224   NIV(0x62, "get industry or airport tile ID at offset"),
    00225   NIV_END()
    00226 };
    00227
    00228 class NIHIndustryTile : public NIHelper {
    00229   bool IsInspectable(uint index) const                 { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != NULL; }
    00230   uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); }
    00231   const void *GetInstance(uint index)const             { return NULL; }
    00232   const void *GetSpec(uint index) const                { return GetIndustryTileSpec(GetIndustryGfx(index)); }
    00233   void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_INDUSTRY_NAME, GetIndustryIndex(index), index); }
    00234   void Resolve(ResolverObject *ro, uint32 index) const { extern void GetIndustryTileResolver(ResolverObject *ro, uint index); GetIndustryTileResolver(ro, index); }
    00235 };
    00236
    00237 static const NIFeature _nif_industrytile = {
    00238   NULL,
    00239   _nic_industrytiles,
    00240   _niv_industrytiles,
    00241   new NIHIndustryTile(),
    00242   0,
    00243   0
    00244 };
    00245
    00246
    00247 /*** NewGRF industries ***/
    00248
    00249 static const NIProperty _nip_industries[] = {
    00250   NIP(0x10, Industry, produced_cargo[0], NIT_CARGO, "produced cargo 0"),
    00251   NIP(0x10, Industry, produced_cargo[1], NIT_CARGO, "produced cargo 1"),
    00252   NIP(0x11, Industry, accepts_cargo[0],  NIT_CARGO, "accepted cargo 0"),
    00253   NIP(0x11, Industry, accepts_cargo[1],  NIT_CARGO, "accepted cargo 1"),
    00254   NIP(0x11, Industry, accepts_cargo[2],  NIT_CARGO, "accepted cargo 2"),
    00255   NIP_END()
    00256 };
    00257
    00258 #define NICI(cb_id, bit) NIC(cb_id, IndustrySpec, callback_mask, bit)
    00259 static const NICallback _nic_industries[] = {
    00260   NICI(CBID_INDUSTRY_AVAILABLE,            CBM_IND_AVAILABLE),
    00261   NICI(CBID_INDUSTRY_LOCATION,             CBM_IND_LOCATION),
    00262   NICI(CBID_INDUSTRY_PRODUCTION_CHANGE,    CBM_IND_PRODUCTION_CHANGE),
    00263   NICI(CBID_INDUSTRY_MONTHLYPROD_CHANGE,   CBM_IND_MONTHLYPROD_CHANGE),
    00264   NICI(CBID_INDUSTRY_CARGO_SUFFIX,         CBM_IND_CARGO_SUFFIX),
    00265   NICI(CBID_INDUSTRY_FUND_MORE_TEXT,       CBM_IND_FUND_MORE_TEXT),
    00266   NICI(CBID_INDUSTRY_WINDOW_MORE_TEXT,     CBM_IND_WINDOW_MORE_TEXT),
    00267   NICI(CBID_INDUSTRY_SPECIAL_EFFECT,       CBM_IND_SPECIAL_EFFECT),
    00268   NICI(CBID_INDUSTRY_REFUSE_CARGO,         CBM_IND_REFUSE_CARGO),
    00269   NICI(CBID_INDUSTRY_DECIDE_COLOUR,        CBM_IND_DECIDE_COLOUR),
    00270   NICI(CBID_INDUSTRY_INPUT_CARGO_TYPES,    CBM_IND_INPUT_CARGO_TYPES),
    00271   NICI(CBID_INDUSTRY_OUTPUT_CARGO_TYPES,   CBM_IND_OUTPUT_CARGO_TYPES),
    00272   NIC_END()
    00273 };
    00274
    00275 static const NIVariable _niv_industries[] = {
    00276   NIV(0x40, "waiting cargo 0"),
    00277   NIV(0x41, "waiting cargo 1"),
    00278   NIV(0x42, "waiting cargo 2"),
    00279   NIV(0x43, "distance to closest dry/land tile"),
    00280   NIV(0x44, "layout number"),
    00281   NIV(0x45, "player info"),
    00282   NIV(0x46, "industry construction date"),
    00283   NIV(0x60, "get industry tile ID at offset"),
    00284   NIV(0x61, "get random tile bits at offset"),
    00285   NIV(0x62, "land info of nearby tiles"),
    00286   NIV(0x63, "animation stage of nearby tiles"),
    00287   NIV(0x64, "distance on nearest industry with given type"),
    00288   NIV(0x65, "get town zone and Manhattan distance of closest town"),
    00289   NIV(0x66, "get square of Euclidean distance of closes town"),
    00290   NIV(0x67, "count of industry and distance of closest instance"),
    00291   NIV(0x68, "count of industry and distance of closest instance with layout filter"),
    00292   NIV_END()
    00293 };
    00294
    00295 class NIHIndustry : public NIHelper {
    00296   bool IsInspectable(uint index) const                 { return GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile != NULL; }
    00297   uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Industry::Get(index)->town->index); }
    00298   const void *GetInstance(uint index)const             { return Industry::Get(index); }
    00299   const void *GetSpec(uint index) const                { return GetIndustrySpec(Industry::Get(index)->type); }
    00300   void SetStringParameters(uint index) const           { this->SetSimpleStringParameters(STR_INDUSTRY_NAME, index); }
    00301   void Resolve(ResolverObject *ro, uint32 index) const { extern void GetIndustryResolver(ResolverObject *ro, uint index); GetIndustryResolver(ro, index); }
    00302 };
    00303
    00304 static const NIFeature _nif_industry = {
    00305   _nip_industries,
    00306   _nic_industries,
    00307   _niv_industries,
    00308   new NIHIndustry(),
    00309   cpp_lengthof(Industry, psa.storage),
    00310   cpp_offsetof(Industry, psa.storage)
    00311 };
    00312
    00313
    00314 /*** NewGRF objects ***/
    00315
    00316 #define NICO(cb_id, bit) NIC(cb_id, ObjectSpec, callback_mask, bit)
    00317 static const NICallback _nic_objects[] = {
    00318   NICO(CBID_OBJECT_LAND_SLOPE_CHECK,     CBM_OBJ_SLOPE_CHECK),
    00319   NICO(CBID_OBJECT_ANIMATION_NEXT_FRAME, CBM_OBJ_ANIMATION_NEXT_FRAME),
    00320   NICO(CBID_OBJECT_ANIMATION_START_STOP, CBM_NO_BIT),
    00321   NICO(CBID_OBJECT_ANIMATION_SPEED,      CBM_OBJ_ANIMATION_SPEED),
    00322   NICO(CBID_OBJECT_COLOUR,               CBM_OBJ_COLOUR),
    00323   NICO(CBID_OBJECT_FUND_MORE_TEXT,       CBM_OBJ_FUND_MORE_TEXT),
    00324   NICO(CBID_OBJECT_AUTOSLOPE,            CBM_OBJ_AUTOSLOPE),
    00325   NIC_END()
    00326 };
    00327
    00328 static const NIVariable _niv_objects[] = {
    00329   NIV(0x40, "relative position"),
    00330   NIV(0x41, "tile information"),
    00331   NIV(0x42, "construction date"),
    00332   NIV(0x43, "animation counter"),
    00333   NIV(0x44, "object founder"),
    00334   NIV(0x45, "get town zone and Manhattan distance of closest town"),
    00335   NIV(0x46, "get square of Euclidean distance of closes town"),
    00336   NIV(0x47, "colour"),
    00337   NIV(0x48, "view"),
    00338   NIV(0x60, "get object ID at offset"),
    00339   NIV(0x61, "get random tile bits at offset"),
    00340   NIV(0x62, "land info of nearby tiles"),
    00341   NIV(0x63, "animation stage of nearby tiles"),
    00342   NIV(0x64, "distance on nearest object with given type"),
    00343   NIV_END()
    00344 };
    00345
    00346 class NIHObject : public NIHelper {
    00347   bool IsInspectable(uint index) const                 { return ObjectSpec::GetByTile(index)->grf_prop.grffile != NULL; }
    00348   uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Object::GetByTile(index)->town->index); }
    00349   const void *GetInstance(uint index)const             { return Object::GetByTile(index); }
    00350   const void *GetSpec(uint index) const                { return ObjectSpec::GetByTile(index); }
    00351   void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT, INVALID_STRING_ID, index); }
    00352   void Resolve(ResolverObject *ro, uint32 index) const { extern void GetObjectResolver(ResolverObject *ro, uint index); GetObjectResolver(ro, index); }
    00353 };
    00354
    00355 static const NIFeature _nif_object = {
    00356   NULL,
    00357   _nic_objects,
    00358   _niv_objects,
    00359   new NIHObject(),
    00360   0,
    00361   0
    00362 };
    00363
    00364
    00365 /*** NewGRF rail types ***/
    00366
    00367 static const NIVariable _niv_railtypes[] = {
    00368   NIV(0x40, "terrain type"),
    00369   NIV(0x41, "enhanced tunnels"),
    00370   NIV(0x42, "level crossing status"),
    00371   NIV_END()
    00372 };
    00373
    00374 class NIHRailType : public NIHelper {
    00375   bool IsInspectable(uint index) const                 { return true; }
    00376   uint GetParent(uint index) const                     { return UINT32_MAX; }
    00377   const void *GetInstance(uint index)const             { return NULL; }
    00378   const void *GetSpec(uint index) const                { return NULL; }
    00379   void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); }
    00380   void Resolve(ResolverObject *ro, uint32 index) const { extern void GetRailTypeResolver(ResolverObject *ro, uint index); GetRailTypeResolver(ro, index); }
    00381 };
    00382
    00383 static const NIFeature _nif_railtype = {
    00384   NULL,
    00385   NULL,
    00386   _niv_railtypes,
    00387   new NIHRailType(),
    00388   0,
    00389   0
    00390 };
    00391
    00392
    00393 /*** NewGRF airport tiles ***/
    00394
    00395 #define NICAT(cb_id, bit) NIC(cb_id, AirportTileSpec, callback_mask, bit)
    00396 static const NICallback _nic_airporttiles[] = {
    00397   NICAT(CBID_AIRPTILE_DRAW_FOUNDATIONS, CBM_AIRT_DRAW_FOUNDATIONS),
    00398   NICAT(CBID_AIRPTILE_ANIM_START_STOP,  CBM_NO_BIT),
    00399   NICAT(CBID_AIRPTILE_ANIM_NEXT_FRAME,  CBM_AIRT_ANIM_NEXT_FRAME),
    00400   NICAT(CBID_AIRPTILE_ANIMATION_SPEED,  CBM_AIRT_ANIM_SPEED),
    00401   NIC_END()
    00402 };
    00403
    00404 class NIHAirportTile : public NIHelper {
    00405   bool IsInspectable(uint index) const                 { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile != NULL; }
    00406   uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
    00407   const void *GetInstance(uint index)const             { return NULL; }
    00408   const void *GetSpec(uint index) const                { return AirportTileSpec::Get(GetAirportGfx(index)); }
    00409   void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
    00410   void Resolve(ResolverObject *ro, uint32 index) const { extern void GetAirportTileTypeResolver(ResolverObject *ro, uint index); GetAirportTileTypeResolver(ro, index); }
    00411 };
    00412
    00413 static const NIFeature _nif_airporttile = {
    00414   NULL,
    00415   _nic_airporttiles,
    00416   _niv_industrytiles, // Yes, they share this (at least now)
    00417   new NIHAirportTile(),
    00418   0,
    00419   0
    00420 };
    00421
    00422
    00423 /*** NewGRF towns ***/
    00424
    00425 static const NIVariable _niv_towns[] = {
    00426   NIV(0x40, "larger town effect on this town"),
    00427   NIV(0x41, "town index"),
    00428   NIV(0x82, "population"),
    00429   NIV(0x94, "zone radius 0"),
    00430   NIV(0x96, "zone radius 1"),
    00431   NIV(0x98, "zone radius 2"),
    00432   NIV(0x9A, "zone radius 3"),
    00433   NIV(0x9C, "zone radius 4"),
    00434   NIV(0xB6, "number of buildings"),
    00435   NIV_END()
    00436 };
    00437
    00438 class NIHTown : public NIHelper {
    00439   bool IsInspectable(uint index) const                 { return Town::IsValidID(index); }
    00440   uint GetParent(uint index) const                     { return UINT32_MAX; }
    00441   const void *GetInstance(uint index)const             { return Town::Get(index); }
    00442   const void *GetSpec(uint index) const                { return NULL; }
    00443   void SetStringParameters(uint index) const           { this->SetSimpleStringParameters(STR_TOWN_NAME, index); }
    00444   uint Resolve(uint index, uint var, uint param, bool *avail) const { return TownGetVariable(var, param, avail, Town::Get(index)); }
    00445 };
    00446
    00447 static const NIFeature _nif_town = {
    00448   NULL,
    00449   NULL,
    00450   _niv_towns,
    00451   new NIHTown(),
    00452   0,
    00453   0
    00454 };
    00455
    00457 static const NIFeature * const _nifeatures[] = {
    00458   &_nif_vehicle,      // GSF_TRAINS
    00459   &_nif_vehicle,      // GSF_ROADVEHICLES
    00460   &_nif_vehicle,      // GSF_SHIPS
    00461   &_nif_vehicle,      // GSF_AIRCRAFT
    00462   &_nif_station,      // GSF_STATIONS
    00463   NULL,               // GSF_CANALS (no callbacks/action2 implemented)
    00464   NULL,               // GSF_BRIDGES (no callbacks/action2)
    00465   &_nif_house,        // GSF_HOUSES
    00466   NULL,               // GSF_GLOBALVAR (has no "physical" objects)
    00467   &_nif_industrytile, // GSF_INDUSTRYTILES
    00468   &_nif_industry,     // GSF_INDUSTRIES
    00469   NULL,               // GSF_CARGOS (has no "physical" objects)
    00470   NULL,               // GSF_SOUNDFX (has no "physical" objects)
    00471   NULL,               // GSF_AIRPORTS (feature not implemented)
    00472   NULL,               // GSF_SIGNALS (feature not implemented)
    00473   &_nif_object,       // GSF_OBJECTS
    00474   &_nif_railtype,     // GSF_RAILTYPES
    00475   &_nif_airporttile,  // GSF_AIRPORTTILES
    00476   &_nif_town,         // GSF_FAKE_TOWNS
    00477 };
    00478 assert_compile(lengthof(_nifeatures) == GSF_FAKE_END);