Functions to find and configure NewGRFs. More...
#include "strings_type.h"
#include "core/alloc_type.hpp"
Go to the source code of this file.
Data Structures | |
struct | GRFIdentifier |
Basic data to distinguish a GRF. More... | |
struct | GRFError |
Information about why GRF had problems during initialisation. More... | |
struct | GRFConfig |
Information about GRF, used in the game and (part of it) in savegames. More... | |
Defines | |
#define | UNKNOWN_GRF_NAME_PLACEHOLDER "<Unknown>" |
Enumerations | |
enum | GCF_Flags { GCF_SYSTEM, GCF_UNSAFE, GCF_STATIC, GCF_COMPATIBLE, GCF_COPY, GCF_INIT_ONLY, GCF_RESERVED } |
GRF config bit flags. More... | |
enum | GRFStatus { GCS_UNKNOWN, GCS_DISABLED, GCS_NOT_FOUND, GCS_INITIALISED, GCS_ACTIVATED } |
Status of GRF. More... | |
enum | GRFBugs { GBUG_VEH_LENGTH, GBUG_VEH_REFIT, GBUG_VEH_POWERED_WAGON } |
Encountered GRF bugs. More... | |
enum | GRFListCompatibility { GLC_ALL_GOOD, GLC_COMPATIBLE, GLC_NOT_FOUND } |
Status of post-gameload GRF compatibility check. More... | |
Functions | |
void | ScanNewGRFFiles () |
void | CheckForMissingSprites () |
Check whether we are (obviously) missing some of the extra (Action 0x05) sprites that we like to use. | |
const GRFConfig * | FindGRFConfig (uint32 grfid, const uint8 *md5sum=NULL) |
GRFConfig * | GetGRFConfig (uint32 grfid, uint32 mask=0xFFFFFFFF) |
GRFConfig ** | CopyGRFConfigList (GRFConfig **dst, const GRFConfig *src, bool init_only) |
Copy a GRF Config list. | |
void | AppendStaticGRFConfigs (GRFConfig **dst) |
Appends the static GRFs to a list of GRFs. | |
void | AppendToGRFConfigList (GRFConfig **dst, GRFConfig *el) |
Appends an element to a list of GRFs. | |
void | ClearGRFConfig (GRFConfig **config) |
void | ClearGRFConfigList (GRFConfig **config) |
void | ResetGRFConfig (bool defaults) |
GRFListCompatibility | IsGoodGRFConfigList () |
Check if all GRFs in the GRF config from a savegame can be loaded. | |
bool | FillGRFDetails (GRFConfig *config, bool is_static) |
char * | GRFBuildParamList (char *dst, const GRFConfig *c, const char *last) |
GRFConfig * | DuplicateGRFConfig (const GRFConfig *c) |
Make a deep copy of a GRFConfig. | |
void | ShowNewGRFSettings (bool editable, bool show_params, bool exec_changes, GRFConfig **config) |
Setup the NewGRF gui. | |
char * | FindUnknownGRFName (uint32 grfid, uint8 *md5sum, bool create) |
Finds the name of a NewGRF in the list of names for unknown GRFs. | |
Variables | |
GRFConfig * | _all_grfs |
First item in list of all scanned NewGRFs. | |
GRFConfig * | _grfconfig |
First item in list of current GRF set up. | |
GRFConfig * | _grfconfig_newgame |
First item in list of default GRF set up. | |
GRFConfig * | _grfconfig_static |
First item in list of static GRF set up. |
Functions to find and configure NewGRFs.
Definition in file newgrf_config.h.
enum GCF_Flags |
GRF config bit flags.
Definition at line 19 of file newgrf_config.h.
enum GRFBugs |
Encountered GRF bugs.
Definition at line 40 of file newgrf_config.h.
enum GRFListCompatibility |
Status of post-gameload GRF compatibility check.
Definition at line 47 of file newgrf_config.h.
enum GRFStatus |
Status of GRF.
Definition at line 31 of file newgrf_config.h.
void AppendStaticGRFConfigs | ( | GRFConfig ** | dst | ) |
Appends the static GRFs to a list of GRFs.
dst | the head of the list to add to |
Definition at line 217 of file newgrf_config.cpp.
References CopyGRFConfigList(), GRFConfig::next, and RemoveDuplicatesFromGRFConfigList().
Appends an element to a list of GRFs.
dst | the head of the list to add to | |
el | the new tail to be |
Definition at line 229 of file newgrf_config.cpp.
References GRFConfig::next, and RemoveDuplicatesFromGRFConfigList().
void CheckForMissingSprites | ( | ) |
Check whether we are (obviously) missing some of the extra (Action 0x05) sprites that we like to use.
When missing sprites are found a warning will be shown.
Definition at line 4093 of file newgrf.cpp.
References A5BLOCK_INVALID, Action5Type::block_type, INVALID_STRING_ID, lengthof, Action5Type::max_sprites, Action5Type::name, ShowErrorMessage(), and Action5Type::sprite_base.
Copy a GRF Config list.
dst | pointer to destination list | |
src | pointer to source list values | |
init_only | the copied GRF will be processed up to GLS_INIT |
Definition at line 165 of file newgrf_config.cpp.
References ClrBit(), DuplicateGRFConfig(), GRFConfig::flags, GCF_INIT_ONLY, GRFConfig::next, and SetBit().
Referenced by AppendStaticGRFConfigs(), NewGRFConfirmationCallback(), and NewGRFWindow::OnClick().
Make a deep copy of a GRFConfig.
c | the grfconfig to copy |
Definition at line 139 of file newgrf_config.cpp.
References ClrBit(), GRFError::custom_message, GRFError::data, GRFConfig::error, GRFConfig::filename, GCF_COPY, GRFConfig::info, GRFError::message, GRFConfig::name, GRFError::num_params, GRFError::param_value, and GRFError::severity.
Referenced by CopyGRFConfigList(), and NewGRFAddWindow::OnClick().
char* FindUnknownGRFName | ( | uint32 | grfid, | |
uint8 * | md5sum, | |||
bool | create | |||
) |
Finds the name of a NewGRF in the list of names for unknown GRFs.
An unknown GRF is a GRF where the .grf is not found during scanning.
The names are resolved via UDP calls to servers that should know the name, though the replies may not come. This leaves "<Unknown>" as name, though that shouldn't matter _very_ much as they need GRF crawler or so to look up the GRF anyway and that works better with the GRF ID.
grfid | the GRF ID part of the 'unique' GRF identifier | |
md5sum | the MD5 checksum part of the 'unique' GRF identifier | |
create | whether to create a new GRFConfig if the GRFConfig did not exist in the fake list of GRFConfigs. |
Definition at line 457 of file newgrf_config.cpp.
References GRFIdentifier::grfid, lastof, GRFIdentifier::md5sum, and strecpy().
Referenced by DEF_UDP_RECEIVE_COMMAND(), ClientNetworkUDPSocketHandler::HandleIncomingNetworkGameInfoGRFConfig(), and NetworkAfterNewGRFScan().
GRFListCompatibility IsGoodGRFConfigList | ( | ) |
Check if all GRFs in the GRF config from a savegame can be loaded.
Definition at line 255 of file newgrf_config.cpp.
References BSWAP32(), GRFConfig::error, GRFConfig::filename, GRFConfig::flags, GamelogGRFCompatible(), GamelogGRFRemove(), GCF_COMPATIBLE, GCF_COPY, GCS_NOT_FOUND, GLC_ALL_GOOD, GLC_COMPATIBLE, GLC_NOT_FOUND, GRFIdentifier::grfid, HasBit(), GRFConfig::info, lastof, GRFIdentifier::md5sum, md5sumToString(), GRFConfig::name, GRFConfig::next, SetBit(), and GRFConfig::status.
void ShowNewGRFSettings | ( | bool | editable, | |
bool | show_params, | |||
bool | exec_changes, | |||
GRFConfig ** | config | |||
) |
Setup the NewGRF gui.
editable | allow the user to make changes to the grfconfig in the window | |
show_params | show information about what parameters are set for the grf files | |
exec_changes | if changes are made to the list (editable is true), apply these changes immediately or only update the list | |
config | pointer to a linked-list of grfconfig's that will be shown |
Definition at line 1106 of file newgrf_gui.cpp.
References DeleteWindowByClass().
Referenced by NetworkGameWindow::OnClick(), and SelectGameWindow::OnClick().