1
0
Fork 0

(svn r7345) -Codechange: enumification of NewGRF loading stage, and move enum definition to header for future use.

release/0.5
peter1138 2006-12-03 23:46:54 +00:00
parent 5f2b62f49f
commit 0a88e202e5
2 changed files with 12 additions and 13 deletions

View File

@ -49,7 +49,7 @@ static GRFFile *_cur_grffile;
GRFFile *_first_grffile; GRFFile *_first_grffile;
GRFConfig *_first_grfconfig; GRFConfig *_first_grfconfig;
static SpriteID _cur_spriteid; static SpriteID _cur_spriteid;
static int _cur_stage; static GrfLoadingStage _cur_stage;
static uint32 _nfo_line; static uint32 _nfo_line;
/* Miscellaneous GRF features, set by Action 0x0D, parameter 0x9E */ /* Miscellaneous GRF features, set by Action 0x0D, parameter 0x9E */
@ -65,14 +65,6 @@ static byte *_preload_sprite = NULL;
bool _have_2cc = false; bool _have_2cc = false;
typedef enum GrfLoadingStage {
GLS_LABELSCAN,
GLS_INIT,
GLS_ACTIVATION,
GLS_END,
} GrfLoadingStage;
typedef enum GrfDataType { typedef enum GrfDataType {
GDT_SOUND, GDT_SOUND,
} GrfDataType; } GrfDataType;
@ -2554,7 +2546,7 @@ static void GRFError(byte *buf, int len)
msgid = buf[3]; msgid = buf[3];
// Undocumented TTDPatch feature. // Undocumented TTDPatch feature.
if ((severity & 0x80) == 0 && _cur_stage < 2) { if ((severity & 0x80) == 0 && _cur_stage < GLS_ACTIVATION) {
DEBUG(grf, 7) ("Skipping non-fatal GRFError in stage 1"); DEBUG(grf, 7) ("Skipping non-fatal GRFError in stage 1");
return; return;
} }
@ -2645,7 +2637,7 @@ static void ParamSet(byte *buf, int len)
return; return;
} else { } else {
/* GRF Resource Management */ /* GRF Resource Management */
if (_cur_stage != 2) { if (_cur_stage != GLS_ACTIVATION) {
/* Ignore GRM during initialization */ /* Ignore GRM during initialization */
src1 = 0; src1 = 0;
} else { } else {
@ -3528,7 +3520,7 @@ static void DecodeSpecialSprite(uint num, GrfLoadingStage stage)
} }
static void LoadNewGRFFile(const char* filename, uint file_index, uint stage) static void LoadNewGRFFile(const char *filename, uint file_index, GrfLoadingStage stage)
{ {
uint16 num; uint16 num;
@ -3541,7 +3533,7 @@ static void LoadNewGRFFile(const char* filename, uint file_index, uint stage)
* During activation, only actions 0, 1, 2, 3, 4, 5, 7, 8, 9, 0A and 0B are * During activation, only actions 0, 1, 2, 3, 4, 5, 7, 8, 9, 0A and 0B are
* carried out. All others are ignored, because they only need to be * carried out. All others are ignored, because they only need to be
* processed once at initialization. */ * processed once at initialization. */
if (stage != 0) { if (stage != GLS_LABELSCAN) {
_cur_grffile = GetFileByFilename(filename); _cur_grffile = GetFileByFilename(filename);
if (_cur_grffile == NULL) error("File ``%s'' lost in cache.\n", filename); if (_cur_grffile == NULL) error("File ``%s'' lost in cache.\n", filename);
if (stage > 1 && !(_cur_grffile->flags & 0x0001)) return; if (stage > 1 && !(_cur_grffile->flags & 0x0001)) return;

View File

@ -5,6 +5,13 @@
#include "station.h" #include "station.h"
typedef enum GrfLoadingStage {
GLS_LABELSCAN,
GLS_INIT,
GLS_ACTIVATION,
GLS_END,
} GrfLoadingStage;
typedef struct GRFLabel { typedef struct GRFLabel {
byte label; byte label;
uint32 nfo_line; uint32 nfo_line;