Base for the NewGRF implementation. More...
#include "cargotype.h"
#include "rail_type.h"
Go to the source code of this file.
Data Structures | |
struct | GRFLabel |
struct | GRFFile |
Dynamic data of a loaded NewGRF. More... | |
struct | GRFLoadedFeatures |
Enumerations | |
enum | GrfLoadingStage { GLS_FILESCAN, GLS_SAFETYSCAN, GLS_LABELSCAN, GLS_INIT, GLS_RESERVE, GLS_ACTIVATION, GLS_END } |
enum | GrfMiscBit { GMB_DESERT_TREES_FIELDS = 0, GMB_DESERT_PAVED_ROADS = 1, GMB_FIELD_BOUNDING_BOX = 2, GMB_TRAIN_WIDTH_32_PIXELS = 3, GMB_AMBIENT_SOUND_CALLBACK = 4, GMB_CATENARY_ON_3RD_TRACK = 5 } |
enum | GrfSpecFeature { GSF_TRAINS, GSF_ROADVEHICLES, GSF_SHIPS, GSF_AIRCRAFT, GSF_STATIONS, GSF_CANALS, GSF_BRIDGES, GSF_HOUSES, GSF_GLOBALVAR, GSF_INDUSTRYTILES, GSF_INDUSTRIES, GSF_CARGOS, GSF_SOUNDFX, GSF_AIRPORTS, GSF_SIGNALS, GSF_OBJECTS, GSF_RAILTYPES, GSF_AIRPORTTILES, GSF_END, GSF_FAKE_TOWNS = GSF_END, GSF_FAKE_END, GSF_INVALID = 0xFF } |
enum | ShoreReplacement { SHORE_REPLACE_NONE, SHORE_REPLACE_ACTION_5, SHORE_REPLACE_ACTION_A, SHORE_REPLACE_ONLY_NEW } |
Functions | |
void | LoadNewGRFFile (struct GRFConfig *config, uint file_index, GrfLoadingStage stage) |
void | LoadNewGRF (uint load_index, uint file_index) |
void | ReloadNewGRFData () |
Reload all NewGRF files during a running game. | |
void | ResetNewGRFData () |
Reset all NewGRF loaded data TODO. | |
void CDECL | grfmsg (int severity, const char *str,...) WARN_FORMAT(2 |
void CDECL bool | HasGrfMiscBit (GrfMiscBit bit) |
bool | GetGlobalVariable (byte param, uint32 *value) |
Reads a variable common to VarAction2 and Action7/9/D. | |
StringID | MapGRFStringID (uint32 grfid, StringID str) |
Used when setting an object's property to map to the GRF's strings while taking in consideration the "drift" between TTDPatch string system and OpenTTD's one. | |
void | ShowNewGRFError () |
Show the first NewGRF error we can find. | |
Variables | |
static const uint32 | INVALID_GRFID = 0xFFFFFFFF |
GRFLoadedFeatures | _loaded_newgrf_features |
Base for the NewGRF implementation.
Definition in file newgrf.h.
enum GrfMiscBit |
GMB_TRAIN_WIDTH_32_PIXELS |
Use 32 pixels per train vehicle in depot gui and vehicle details. Never set in the global variable;.
|
enum GrfSpecFeature |
enum ShoreReplacement |
bool GetGlobalVariable | ( | byte | param, | |
uint32 * | value | |||
) |
Reads a variable common to VarAction2 and Action7/9/D.
Returns VarAction2 variable 'param' resp. Action7/9/D variable '0x80 + param'. If a variable is not accessible from all four actions, it is handled in the action specific functions.
param | variable number (as for VarAction2, for Action7/9/D you have to subtract 0x80 first). | |
value | returns the value of the variable. |
Definition at line 4943 of file newgrf.cpp.
References _cur_year, _date, _date_fract, _display_opt, _settings_game, _tick_counter, Clamp(), ConvertDateToYMD(), ConvertYMDToDate(), YearMonthDay::day, DAYS_TILL_ORIGINAL_BASE_YEAR, DifficultySettings::diff_level, GameSettings::difficulty, VehicleSettings::disable_elrails, GameSettings::game_creation, GB(), GetRailTypeInfo(), GetSnowLine(), GMB_TRAIN_WIDTH_32_PIXELS, GRFP_USE_MASK, HasBit(), IsLeapYear(), GameCreationSettings::landscape, max(), YearMonthDay::month, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR, GRFConfig::palette, RAILTYPE_ELECTRIC, RAILTYPE_MAGLEV, RAILTYPE_MONO, RAILTYPE_RAIL, VehicleSettings::road_side, SB(), SetBit(), GRFFile::traininfo_vehicle_pitch, GRFFile::traininfo_vehicle_width, GameSettings::vehicle, and YearMonthDay::year.
Used when setting an object's property to map to the GRF's strings while taking in consideration the "drift" between TTDPatch string system and OpenTTD's one.
grfid | Id of the grf file | |
str | StringID that we want to have the equivalent in OoenTTD |
Definition at line 296 of file newgrf.cpp.
References GB(), GetGRFStringID(), and TTDPStringIDToOTTDStringIDMapping().
Referenced by ChangeIndustryProduction(), and TranslateTTDPatchCodes().
void ReloadNewGRFData | ( | ) |
Reload all NewGRF files during a running game.
This is a cut-down version of AfterLoadGame(). XXX - We need to reset the vehicle position hash because with a non-empty hash AfterLoadVehicles() will loop infinitely. We need AfterLoadVehicles() to recalculate vehicle data as some NewGRF vehicle sets could have been removed or added and changed statistics
Definition at line 2653 of file afterload.cpp.
References AfterLoadVehicles(), CheckTrainsLengths(), COMPANY_FIRST, DeleteInvalidEngineNews(), GfxLoadSprites(), InvalidateWindowData(), LoadStringWidthTable(), MarkWholeScreenDirty(), MAX_COMPANIES, RecomputePrices(), SetCachedEngineCounts(), StartupEngines(), and UpdateHousesAndTowns().
Referenced by ClickChangeClimateCheat(), NewGRFConfirmationCallback(), NewGRFWindow::OnClick(), and EngineOverrideManager::ResetToCurrentNewGRFConfig().