newgrf_config.h
author celestar
Fri, 29 Dec 2006 10:13:35 +0000
branchcustombridgeheads
changeset 5592 fd60d4ecc921
parent 5581 d0407b8e20ce
child 5387 3047d553859c
permissions -rw-r--r--
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
5228
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
     1
/* $Id$ */
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
     2
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
     3
#ifndef NEWGRF_CONFIG_H
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
     4
#define NEWGRF_CONFIG_H
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
     5
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
     6
/* GRF config bit flags */
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
     7
enum {
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
     8
	GCF_DISABLED,
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
     9
	GCF_NOT_FOUND,
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    10
	GCF_ACTIVATED,
5329
2b117d8652f0 (svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents: 5308
diff changeset
    11
	GCF_SYSTEM,
2b117d8652f0 (svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents: 5308
diff changeset
    12
	GCF_UNSAFE,
2b117d8652f0 (svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents: 5308
diff changeset
    13
	GCF_STATIC,
5339
7573f179efe8 (svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents: 5333
diff changeset
    14
	GCF_COPY,      ///< The data is copied from a grf in _all_grfs
5228
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    15
};
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    16
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    17
typedef struct GRFConfig {
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    18
	char *filename;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    19
	char *name;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    20
	char *info;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    21
	uint32 grfid;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    22
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    23
	uint8 flags;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    24
	uint8 md5sum[16];
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    25
	uint32 param[0x80];
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    26
	uint8 num_params;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    27
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    28
	struct GRFConfig *next;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    29
} GRFConfig;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    30
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    31
/* First item in list of all scanned NewGRFs */
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    32
extern GRFConfig *_all_grfs;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    33
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    34
/* First item in list of current GRF set up */
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    35
extern GRFConfig *_grfconfig;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    36
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    37
/* First item in list of default GRF set up */
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    38
extern GRFConfig *_grfconfig_newgame;
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    39
5329
2b117d8652f0 (svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents: 5308
diff changeset
    40
/* First item in list of static GRF set up */
2b117d8652f0 (svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents: 5308
diff changeset
    41
extern GRFConfig *_grfconfig_static;
2b117d8652f0 (svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents: 5308
diff changeset
    42
5228
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    43
void ScanNewGRFFiles(void);
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    44
const GRFConfig *FindGRFConfig(uint32 grfid, uint8 *md5sum);
5333
8e7d68b06399 (svn r7495) -Fix (r7354): [NewGRF] Deactivate the target GRF, not the current GRF.
peter1138
parents: 5329
diff changeset
    45
GRFConfig *GetGRFConfig(uint32 grfid);
5346
0d7cc9cefd2b (svn r7517) -Codechange: Set pointers to NULL when freeing the newgrf config variables and add the proper const to CopyGRFConfigList
Darkvater
parents: 5339
diff changeset
    46
GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src);
5581
d0407b8e20ce (svn r7582) -Fix (r7490): appending static GRFs to the list of to-be loaded GRF for a game could result in duplicate GRFs in that list, which can cause a segmentation fault while loading the GRFs.
rubidium
parents: 5352
diff changeset
    47
void AppendStaticGRFConfigs(GRFConfig **dst);
5346
0d7cc9cefd2b (svn r7517) -Codechange: Set pointers to NULL when freeing the newgrf config variables and add the proper const to CopyGRFConfigList
Darkvater
parents: 5339
diff changeset
    48
void ClearGRFConfig(GRFConfig **config);
5347
18836f961808 (svn r7518) -Codechange: more NULL pointer resets after free.
Darkvater
parents: 5346
diff changeset
    49
void ClearGRFConfigList(GRFConfig **config);
5228
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    50
void ResetGRFConfig(bool defaults);
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    51
bool IsGoodGRFConfigList(void);
5329
2b117d8652f0 (svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents: 5308
diff changeset
    52
bool FillGRFDetails(GRFConfig *config, bool is_static);
5308
bad31e174cc6 (svn r7464) -Codechange: move BuildParamList from newgrf_gui to newgrf_config and
peter1138
parents: 5237
diff changeset
    53
char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last);
5228
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    54
5237
c14c97d7030a (svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents: 5234
diff changeset
    55
/* In newgrf_gui.c */
5352
82a50c80b0c4 (svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents: 5347
diff changeset
    56
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config);
5237
c14c97d7030a (svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents: 5234
diff changeset
    57
5339
7573f179efe8 (svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents: 5333
diff changeset
    58
/* For communication about GRFs over the network */
7573f179efe8 (svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents: 5333
diff changeset
    59
#define UNKNOWN_GRF_NAME_PLACEHOLDER "<Unknown>"
7573f179efe8 (svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents: 5333
diff changeset
    60
char *FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create);
7573f179efe8 (svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents: 5333
diff changeset
    61
5228
c4a780348f66 (svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
diff changeset
    62
#endif /* NEWGRF_CONFIG_H */