diff options
author | frosch <frosch@openttd.org> | 2008-01-28 15:55:59 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-01-28 15:55:59 +0000 |
commit | 5d9326ff0354c93115d0410dd5c5f60517425157 (patch) | |
tree | 5d81081bccfedb11bb4eda1287ac37c5225a1574 /src | |
parent | b7946e07a6cd70eb119f48fea4ca60a1bcfbe641 (diff) | |
download | openttd-5d9326ff0354c93115d0410dd5c5f60517425157.tar.xz |
(svn r12001) -Fix: When skipping Action 11 or 12, also skip belonging sprites.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf.cpp | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index c2d17c616..119def0d5 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4560,6 +4560,20 @@ static void GRFSound(byte *buf, int len) if (_cur_grffile->sound_offset == 0) _cur_grffile->sound_offset = GetNumSounds(); } +/* Action 0x11 (SKIP) */ +static void SkipAct11(byte *buf, int len) +{ + /* <11> <num> + * + * W num Number of sound files that follow */ + + if (!check_length(len, 1, "SkipAct11")) return; + buf++; + _skip_sprites = grf_load_word(&buf); + + grfmsg(3, "SkipAct11: Skipping %d sprites", _skip_sprites); +} + static void ImportGRFSound(byte *buf, int len) { const GRFFile *file; @@ -4704,6 +4718,36 @@ static void LoadFontGlyph(byte *buf, int len) } } +/* Action 0x12 (SKIP) */ +static void SkipAct12(byte *buf, int len) +{ + /* <12> <num_def> <font_size> <num_char> <base_char> + * + * B num_def Number of definitions + * B font_size Size of font (0 = normal, 1 = small, 2 = large) + * B num_char Number of consecutive glyphs + * W base_char First character index */ + + buf++; len--; + if (!check_length(len, 1, "SkipAct12")) return; + uint8 num_def = grf_load_byte(&buf); + + if (!check_length(len, 1 + num_def * 4, "SkipAct12")) return; + + for (uint i = 0; i < num_def; i++) { + /* Ignore 'size' byte */ + grf_load_byte(&buf); + + /* Sum up number of characters */ + _skip_sprites += grf_load_byte(&buf); + + /* Ignore 'base_char' word */ + grf_load_word(&buf); + } + + grfmsg(3, "SkipAct12: Skipping %d sprites", _skip_sprites); +} + /* Action 0x13 */ static void TranslateGRFStrings(byte *buf, int len) { @@ -5461,8 +5505,8 @@ static void DecodeSpecialSprite(uint num, GrfLoadingStage stage) /* 0x0E */ { NULL, SafeGRFInhibit, NULL, GRFInhibit, GRFInhibit, GRFInhibit, }, /* 0x0F */ { NULL, GRFUnsafe, NULL, FeatureTownName, NULL, NULL, }, /* 0x10 */ { NULL, NULL, DefineGotoLabel, NULL, NULL, NULL, }, - /* 0x11 */ { NULL, GRFUnsafe, NULL, NULL, NULL, GRFSound, }, - /* 0x12 */ { NULL, NULL, NULL, NULL, NULL, LoadFontGlyph, }, + /* 0x11 */ { SkipAct11,GRFUnsafe, SkipAct11, SkipAct11, SkipAct11, GRFSound, }, + /* 0x12 */ { SkipAct12, SkipAct12, SkipAct12, SkipAct12, SkipAct12, LoadFontGlyph, }, /* 0x13 */ { NULL, NULL, NULL, NULL, NULL, TranslateGRFStrings, }, }; |