src/newgrf.cpp
changeset 9146 dbe2317185eb
parent 9113 c2856e41abf3
child 9208 191eb01c025a
equal deleted inserted replaced
9145:ae595994eb03 9146:dbe2317185eb
    94 
    94 
    95 static byte _grf_data_blocks;
    95 static byte _grf_data_blocks;
    96 static GrfDataType _grf_data_type;
    96 static GrfDataType _grf_data_type;
    97 
    97 
    98 
    98 
    99 typedef void (*SpecialSpriteHandler)(byte *buf, int len);
    99 typedef void (*SpecialSpriteHandler)(byte *buf, size_t len);
   100 
   100 
   101 enum {
   101 enum {
   102 	MAX_STATIONS = 256,
   102 	MAX_STATIONS = 256,
   103 };
   103 };
   104 
   104 
   150 	va_end(va);
   150 	va_end(va);
   151 
   151 
   152 	DEBUG(grf, severity, "[%s:%d] %s", _cur_grfconfig->filename, _nfo_line, buf);
   152 	DEBUG(grf, severity, "[%s:%d] %s", _cur_grfconfig->filename, _nfo_line, buf);
   153 }
   153 }
   154 
   154 
   155 static inline bool check_length(int real, int wanted, const char *str)
   155 static inline bool check_length(size_t real, size_t wanted, const char *str)
   156 {
   156 {
   157 	if (real >= wanted) return true;
   157 	if (real >= wanted) return true;
   158 	grfmsg(0, "%s: Invalid pseudo sprite length %d (expected %d)!", str, real, wanted);
   158 	grfmsg(0, "%s: Invalid pseudo sprite length %d (expected %d)!", str, real, wanted);
   159 	return false;
   159 	return false;
   160 }
   160 }
  2246 	*bufp = buf;
  2246 	*bufp = buf;
  2247 	return ret;
  2247 	return ret;
  2248 }
  2248 }
  2249 
  2249 
  2250 /* Action 0x00 */
  2250 /* Action 0x00 */
  2251 static void FeatureChangeInfo(byte *buf, int len)
  2251 static void FeatureChangeInfo(byte *buf, size_t len)
  2252 {
  2252 {
  2253 	byte *bufend = buf + len;
  2253 	byte *bufend = buf + len;
  2254 
  2254 
  2255 	/* <00> <feature> <num-props> <num-info> <id> (<property <new-info>)...
  2255 	/* <00> <feature> <num-props> <num-info> <id> (<property <new-info>)...
  2256 	 *
  2256 	 *
  2361 		if (ignoring) grfmsg(1, "FeatureChangeInfo: Ignoring property 0x%02X of feature 0x%02X (not implemented)", prop, feature);
  2361 		if (ignoring) grfmsg(1, "FeatureChangeInfo: Ignoring property 0x%02X of feature 0x%02X (not implemented)", prop, feature);
  2362 	}
  2362 	}
  2363 }
  2363 }
  2364 
  2364 
  2365 /* Action 0x00 (GLS_SAFETYSCAN) */
  2365 /* Action 0x00 (GLS_SAFETYSCAN) */
  2366 static void SafeChangeInfo(byte *buf, int len)
  2366 static void SafeChangeInfo(byte *buf, size_t len)
  2367 {
  2367 {
  2368 	if (!check_length(len, 6, "SafeChangeInfo")) return;
  2368 	if (!check_length(len, 6, "SafeChangeInfo")) return;
  2369 	buf++;
  2369 	buf++;
  2370 	uint8 feature  = grf_load_byte(&buf);
  2370 	uint8 feature  = grf_load_byte(&buf);
  2371 	uint8 numprops = grf_load_byte(&buf);
  2371 	uint8 numprops = grf_load_byte(&buf);
  2384 	/* Skip remainder of GRF */
  2384 	/* Skip remainder of GRF */
  2385 	_skip_sprites = -1;
  2385 	_skip_sprites = -1;
  2386 }
  2386 }
  2387 
  2387 
  2388 /* Action 0x00 (GLS_RESERVE) */
  2388 /* Action 0x00 (GLS_RESERVE) */
  2389 static void ReserveChangeInfo(byte *buf, int len)
  2389 static void ReserveChangeInfo(byte *buf, size_t len)
  2390 {
  2390 {
  2391 	byte *bufend = buf + len;
  2391 	byte *bufend = buf + len;
  2392 
  2392 
  2393 	if (!check_length(len, 6, "ReserveChangeInfo")) return;
  2393 	if (!check_length(len, 6, "ReserveChangeInfo")) return;
  2394 	buf++;
  2394 	buf++;
  2480 	group->g.result.num_sprites = num_sprites;
  2480 	group->g.result.num_sprites = num_sprites;
  2481 	return group;
  2481 	return group;
  2482 }
  2482 }
  2483 
  2483 
  2484 /* Action 0x01 */
  2484 /* Action 0x01 */
  2485 static void NewSpriteSet(byte *buf, int len)
  2485 static void NewSpriteSet(byte *buf, size_t len)
  2486 {
  2486 {
  2487 	/* <01> <feature> <num-sets> <num-ent>
  2487 	/* <01> <feature> <num-sets> <num-ent>
  2488 	 *
  2488 	 *
  2489 	 * B feature       feature to define sprites for
  2489 	 * B feature       feature to define sprites for
  2490 	 *                 0, 1, 2, 3: veh-type, 4: train stations
  2490 	 *                 0, 1, 2, 3: veh-type, 4: train stations
  2516 		LoadNextSprite(_cur_spriteid++, _file_index, _nfo_line);
  2516 		LoadNextSprite(_cur_spriteid++, _file_index, _nfo_line);
  2517 	}
  2517 	}
  2518 }
  2518 }
  2519 
  2519 
  2520 /* Action 0x01 (SKIP) */
  2520 /* Action 0x01 (SKIP) */
  2521 static void SkipAct1(byte *buf, int len)
  2521 static void SkipAct1(byte *buf, size_t len)
  2522 {
  2522 {
  2523 	if (!check_length(len, 4, "SkipAct1")) return;
  2523 	if (!check_length(len, 4, "SkipAct1")) return;
  2524 	buf++;
  2524 	buf++;
  2525 	grf_load_byte(&buf);
  2525 	grf_load_byte(&buf);
  2526 	uint8 num_sets  = grf_load_byte(&buf);
  2526 	uint8 num_sets  = grf_load_byte(&buf);
  2575 
  2575 
  2576 	return NewResultSpriteGroup(_cur_grffile->spriteset_start + spriteid * num_sprites, num_sprites);
  2576 	return NewResultSpriteGroup(_cur_grffile->spriteset_start + spriteid * num_sprites, num_sprites);
  2577 }
  2577 }
  2578 
  2578 
  2579 /* Action 0x02 */
  2579 /* Action 0x02 */
  2580 static void NewSpriteGroup(byte *buf, int len)
  2580 static void NewSpriteGroup(byte *buf, size_t len)
  2581 {
  2581 {
  2582 	/* <02> <feature> <set-id> <type/num-entries> <feature-specific-data...>
  2582 	/* <02> <feature> <set-id> <type/num-entries> <feature-specific-data...>
  2583 	 *
  2583 	 *
  2584 	 * B feature       see action 1
  2584 	 * B feature       see action 1
  2585 	 * B set-id        ID of this particular definition
  2585 	 * B set-id        ID of this particular definition
  3180 	}
  3180 	}
  3181 }
  3181 }
  3182 
  3182 
  3183 
  3183 
  3184 /* Action 0x03 */
  3184 /* Action 0x03 */
  3185 static void FeatureMapSpriteGroup(byte *buf, int len)
  3185 static void FeatureMapSpriteGroup(byte *buf, size_t len)
  3186 {
  3186 {
  3187 	/* <03> <feature> <n-id> <ids>... <num-cid> [<cargo-type> <cid>]... <def-cid>
  3187 	/* <03> <feature> <n-id> <ids>... <num-cid> [<cargo-type> <cid>]... <def-cid>
  3188 	 * id-list    := [<id>] [id-list]
  3188 	 * id-list    := [<id>] [id-list]
  3189 	 * cargo-list := <cargo-type> <cid> [cargo-list]
  3189 	 * cargo-list := <cargo-type> <cid> [cargo-list]
  3190 	 *
  3190 	 *
  3265 			return;
  3265 			return;
  3266 	}
  3266 	}
  3267 }
  3267 }
  3268 
  3268 
  3269 /* Action 0x04 */
  3269 /* Action 0x04 */
  3270 static void FeatureNewName(byte *buf, int len)
  3270 static void FeatureNewName(byte *buf, size_t len)
  3271 {
  3271 {
  3272 	/* <04> <veh-type> <language-id> <num-veh> <offset> <data...>
  3272 	/* <04> <veh-type> <language-id> <num-veh> <offset> <data...>
  3273 	 *
  3273 	 *
  3274 	 * B veh-type      see action 0 (as 00..07, + 0A
  3274 	 * B veh-type      see action 0 (as 00..07, + 0A
  3275 	 *                 But IF veh-type = 48, then generic text
  3275 	 *                 But IF veh-type = 48, then generic text
  3419 
  3419 
  3420 	return 0;
  3420 	return 0;
  3421 }
  3421 }
  3422 
  3422 
  3423 /* Action 0x05 */
  3423 /* Action 0x05 */
  3424 static void GraphicsNew(byte *buf, int len)
  3424 static void GraphicsNew(byte *buf, size_t len)
  3425 {
  3425 {
  3426 	/* <05> <graphics-type> <num-sprites> <other data...>
  3426 	/* <05> <graphics-type> <num-sprites> <other data...>
  3427 	 *
  3427 	 *
  3428 	 * B graphics-type What set of graphics the sprites define.
  3428 	 * B graphics-type What set of graphics the sprites define.
  3429 	 * E num-sprites   How many sprites are in this set?
  3429 	 * E num-sprites   How many sprites are in this set?
  3533 
  3533 
  3534 	_skip_sprites = skip_num;
  3534 	_skip_sprites = skip_num;
  3535 }
  3535 }
  3536 
  3536 
  3537 /* Action 0x05 (SKIP) */
  3537 /* Action 0x05 (SKIP) */
  3538 static void SkipAct5(byte *buf, int len)
  3538 static void SkipAct5(byte *buf, size_t len)
  3539 {
  3539 {
  3540 	if (!check_length(len, 2, "SkipAct5")) return;
  3540 	if (!check_length(len, 2, "SkipAct5")) return;
  3541 	buf++;
  3541 	buf++;
  3542 
  3542 
  3543 	/* Ignore type byte */
  3543 	/* Ignore type byte */
  3709 			return UINT_MAX;
  3709 			return UINT_MAX;
  3710 	}
  3710 	}
  3711 }
  3711 }
  3712 
  3712 
  3713 /* Action 0x06 */
  3713 /* Action 0x06 */
  3714 static void CfgApply(byte *buf, int len)
  3714 static void CfgApply(byte *buf, size_t len)
  3715 {
  3715 {
  3716 	/* <06> <param-num> <param-size> <offset> ... <FF>
  3716 	/* <06> <param-num> <param-size> <offset> ... <FF>
  3717 	 *
  3717 	 *
  3718 	 * B param-num     Number of parameter to substitute (First = "zero")
  3718 	 * B param-num     Number of parameter to substitute (First = "zero")
  3719 	 *                 Ignored if that parameter was not specified in newgrf.cfg
  3719 	 *                 Ignored if that parameter was not specified in newgrf.cfg
  3797 	}
  3797 	}
  3798 }
  3798 }
  3799 
  3799 
  3800 /* Action 0x07 */
  3800 /* Action 0x07 */
  3801 /* Action 0x09 */
  3801 /* Action 0x09 */
  3802 static void SkipIf(byte *buf, int len)
  3802 static void SkipIf(byte *buf, size_t len)
  3803 {
  3803 {
  3804 	/* <07/09> <param-num> <param-size> <condition-type> <value> <num-sprites>
  3804 	/* <07/09> <param-num> <param-size> <condition-type> <value> <num-sprites>
  3805 	 *
  3805 	 *
  3806 	 * B param-num
  3806 	 * B param-num
  3807 	 * B param-size
  3807 	 * B param-size
  3952 	}
  3952 	}
  3953 }
  3953 }
  3954 
  3954 
  3955 
  3955 
  3956 /* Action 0x08 (GLS_FILESCAN) */
  3956 /* Action 0x08 (GLS_FILESCAN) */
  3957 static void ScanInfo(byte *buf, int len)
  3957 static void ScanInfo(byte *buf, size_t len)
  3958 {
  3958 {
  3959 	if (!check_length(len, 8, "Info")) return;
  3959 	if (!check_length(len, 8, "Info")) return;
  3960 	buf++;
  3960 	buf++;
  3961 	grf_load_byte(&buf);
  3961 	grf_load_byte(&buf);
  3962 	uint32 grfid  = grf_load_dword(&buf);
  3962 	uint32 grfid  = grf_load_dword(&buf);
  3979 	/* GLS_INFOSCAN only looks for the action 8, so we can skip the rest of the file */
  3979 	/* GLS_INFOSCAN only looks for the action 8, so we can skip the rest of the file */
  3980 	_skip_sprites = -1;
  3980 	_skip_sprites = -1;
  3981 }
  3981 }
  3982 
  3982 
  3983 /* Action 0x08 */
  3983 /* Action 0x08 */
  3984 static void GRFInfo(byte *buf, int len)
  3984 static void GRFInfo(byte *buf, size_t len)
  3985 {
  3985 {
  3986 	/* <08> <version> <grf-id> <name> <info>
  3986 	/* <08> <version> <grf-id> <name> <info>
  3987 	 *
  3987 	 *
  3988 	 * B version       newgrf version, currently 06
  3988 	 * B version       newgrf version, currently 06
  3989 	 * 4*B grf-id      globally unique ID of this .grf file
  3989 	 * 4*B grf-id      globally unique ID of this .grf file
  4003 	/* Do swap the GRFID for displaying purposes since people expect that */
  4003 	/* Do swap the GRFID for displaying purposes since people expect that */
  4004 	DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08lX - %s", version, BSWAP32(grfid), name);
  4004 	DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08lX - %s", version, BSWAP32(grfid), name);
  4005 }
  4005 }
  4006 
  4006 
  4007 /* Action 0x0A */
  4007 /* Action 0x0A */
  4008 static void SpriteReplace(byte *buf, int len)
  4008 static void SpriteReplace(byte *buf, size_t len)
  4009 {
  4009 {
  4010 	/* <0A> <num-sets> <set1> [<set2> ...]
  4010 	/* <0A> <num-sets> <set1> [<set2> ...]
  4011 	 * <set>: <num-sprites> <first-sprite>
  4011 	 * <set>: <num-sprites> <first-sprite>
  4012 	 *
  4012 	 *
  4013 	 * B num-sets      How many sets of sprites to replace.
  4013 	 * B num-sets      How many sets of sprites to replace.
  4039 		}
  4039 		}
  4040 	}
  4040 	}
  4041 }
  4041 }
  4042 
  4042 
  4043 /* Action 0x0A (SKIP) */
  4043 /* Action 0x0A (SKIP) */
  4044 static void SkipActA(byte *buf, int len)
  4044 static void SkipActA(byte *buf, size_t len)
  4045 {
  4045 {
  4046 	buf++;
  4046 	buf++;
  4047 	uint8 num_sets = grf_load_byte(&buf);
  4047 	uint8 num_sets = grf_load_byte(&buf);
  4048 
  4048 
  4049 	for (uint i = 0; i < num_sets; i++) {
  4049 	for (uint i = 0; i < num_sets; i++) {
  4055 
  4055 
  4056 	grfmsg(3, "SkipActA: Skipping %d sprites", _skip_sprites);
  4056 	grfmsg(3, "SkipActA: Skipping %d sprites", _skip_sprites);
  4057 }
  4057 }
  4058 
  4058 
  4059 /* Action 0x0B */
  4059 /* Action 0x0B */
  4060 static void GRFLoadError(byte *buf, int len)
  4060 static void GRFLoadError(byte *buf, size_t len)
  4061 {
  4061 {
  4062 	/* <0B> <severity> <language-id> <message-id> [<message...> 00] [<data...>] 00 [<parnum>]
  4062 	/* <0B> <severity> <language-id> <message-id> [<message...> 00] [<data...>] 00 [<parnum>]
  4063 	 *
  4063 	 *
  4064 	 * B severity      00: notice, contine loading grf file
  4064 	 * B severity      00: notice, contine loading grf file
  4065 	 *                 01: warning, continue loading grf file
  4065 	 *                 01: warning, continue loading grf file
  4165 
  4165 
  4166 	_cur_grfconfig->error = error;
  4166 	_cur_grfconfig->error = error;
  4167 }
  4167 }
  4168 
  4168 
  4169 /* Action 0x0C */
  4169 /* Action 0x0C */
  4170 static void GRFComment(byte *buf, int len)
  4170 static void GRFComment(byte *buf, size_t len)
  4171 {
  4171 {
  4172 	/* <0C> [<ignored...>]
  4172 	/* <0C> [<ignored...>]
  4173 	 *
  4173 	 *
  4174 	 * V ignored       Anything following the 0C is ignored */
  4174 	 * V ignored       Anything following the 0C is ignored */
  4175 
  4175 
  4176 	if (len == 1) return;
  4176 	if (len == 1) return;
  4177 
  4177 
  4178 	int text_len = len - 1;
  4178 	size_t text_len = len - 1;
  4179 	const char *text = (const char*)(buf + 1);
  4179 	const char *text = (const char*)(buf + 1);
  4180 	grfmsg(2, "GRFComment: %.*s", text_len, text);
  4180 	grfmsg(2, "GRFComment: %.*s", text_len, text);
  4181 }
  4181 }
  4182 
  4182 
  4183 /* Action 0x0D (GLS_SAFETYSCAN) */
  4183 /* Action 0x0D (GLS_SAFETYSCAN) */
  4184 static void SafeParamSet(byte *buf, int len)
  4184 static void SafeParamSet(byte *buf, size_t len)
  4185 {
  4185 {
  4186 	if (!check_length(len, 5, "SafeParamSet")) return;
  4186 	if (!check_length(len, 5, "SafeParamSet")) return;
  4187 	buf++;
  4187 	buf++;
  4188 	uint8 target = grf_load_byte(&buf);
  4188 	uint8 target = grf_load_byte(&buf);
  4189 
  4189 
  4311 	return UINT_MAX;
  4311 	return UINT_MAX;
  4312 }
  4312 }
  4313 
  4313 
  4314 
  4314 
  4315 /* Action 0x0D */
  4315 /* Action 0x0D */
  4316 static void ParamSet(byte *buf, int len)
  4316 static void ParamSet(byte *buf, size_t len)
  4317 {
  4317 {
  4318 	/* <0D> <target> <operation> <source1> <source2> [<data>]
  4318 	/* <0D> <target> <operation> <source1> <source2> [<data>]
  4319 	 *
  4319 	 *
  4320 	 * B target        parameter number where result is stored
  4320 	 * B target        parameter number where result is stored
  4321 	 * B operation     operation to perform, see below
  4321 	 * B operation     operation to perform, see below
  4602 			break;
  4602 			break;
  4603 	}
  4603 	}
  4604 }
  4604 }
  4605 
  4605 
  4606 /* Action 0x0E (GLS_SAFETYSCAN) */
  4606 /* Action 0x0E (GLS_SAFETYSCAN) */
  4607 static void SafeGRFInhibit(byte *buf, int len)
  4607 static void SafeGRFInhibit(byte *buf, size_t len)
  4608 {
  4608 {
  4609 	/* <0E> <num> <grfids...>
  4609 	/* <0E> <num> <grfids...>
  4610 	 *
  4610 	 *
  4611 	 * B num           Number of GRFIDs that follow
  4611 	 * B num           Number of GRFIDs that follow
  4612 	 * D grfids        GRFIDs of the files to deactivate */
  4612 	 * D grfids        GRFIDs of the files to deactivate */
  4630 		}
  4630 		}
  4631 	}
  4631 	}
  4632 }
  4632 }
  4633 
  4633 
  4634 /* Action 0x0E */
  4634 /* Action 0x0E */
  4635 static void GRFInhibit(byte *buf, int len)
  4635 static void GRFInhibit(byte *buf, size_t len)
  4636 {
  4636 {
  4637 	/* <0E> <num> <grfids...>
  4637 	/* <0E> <num> <grfids...>
  4638 	 *
  4638 	 *
  4639 	 * B num           Number of GRFIDs that follow
  4639 	 * B num           Number of GRFIDs that follow
  4640 	 * D grfids        GRFIDs of the files to deactivate */
  4640 	 * D grfids        GRFIDs of the files to deactivate */
  4655 		}
  4655 		}
  4656 	}
  4656 	}
  4657 }
  4657 }
  4658 
  4658 
  4659 /* Action 0x0F */
  4659 /* Action 0x0F */
  4660 static void FeatureTownName(byte *buf, int len)
  4660 static void FeatureTownName(byte *buf, size_t len)
  4661 {
  4661 {
  4662 	/* <0F> <id> <style-name> <num-parts> <parts>
  4662 	/* <0F> <id> <style-name> <num-parts> <parts>
  4663 	 *
  4663 	 *
  4664 	 * B id          ID of this definition in bottom 7 bits (final definition if bit 7 set)
  4664 	 * B id          ID of this definition in bottom 7 bits (final definition if bit 7 set)
  4665 	 * V style-name  Name of the style (only for final definition)
  4665 	 * V style-name  Name of the style (only for final definition)
  4755 		grfmsg(6, "FeatureTownName: part %d, total probability %d", i, townname->partlist[id][i].maxprob);
  4755 		grfmsg(6, "FeatureTownName: part %d, total probability %d", i, townname->partlist[id][i].maxprob);
  4756 	}
  4756 	}
  4757 }
  4757 }
  4758 
  4758 
  4759 /* Action 0x10 */
  4759 /* Action 0x10 */
  4760 static void DefineGotoLabel(byte *buf, int len)
  4760 static void DefineGotoLabel(byte *buf, size_t len)
  4761 {
  4761 {
  4762 	/* <10> <label> [<comment>]
  4762 	/* <10> <label> [<comment>]
  4763 	 *
  4763 	 *
  4764 	 * B label      The label to define
  4764 	 * B label      The label to define
  4765 	 * V comment    Optional comment - ignored */
  4765 	 * V comment    Optional comment - ignored */
  4785 
  4785 
  4786 	grfmsg(2, "DefineGotoLabel: GOTO target with label 0x%02X", label->label);
  4786 	grfmsg(2, "DefineGotoLabel: GOTO target with label 0x%02X", label->label);
  4787 }
  4787 }
  4788 
  4788 
  4789 /* Action 0x11 */
  4789 /* Action 0x11 */
  4790 static void GRFSound(byte *buf, int len)
  4790 static void GRFSound(byte *buf, size_t len)
  4791 {
  4791 {
  4792 	/* <11> <num>
  4792 	/* <11> <num>
  4793 	 *
  4793 	 *
  4794 	 * W num      Number of sound files that follow */
  4794 	 * W num      Number of sound files that follow */
  4795 
  4795 
  4802 
  4802 
  4803 	if (_cur_grffile->sound_offset == 0) _cur_grffile->sound_offset = GetNumSounds();
  4803 	if (_cur_grffile->sound_offset == 0) _cur_grffile->sound_offset = GetNumSounds();
  4804 }
  4804 }
  4805 
  4805 
  4806 /* Action 0x11 (SKIP) */
  4806 /* Action 0x11 (SKIP) */
  4807 static void SkipAct11(byte *buf, int len)
  4807 static void SkipAct11(byte *buf, size_t len)
  4808 {
  4808 {
  4809 	/* <11> <num>
  4809 	/* <11> <num>
  4810 	 *
  4810 	 *
  4811 	 * W num      Number of sound files that follow */
  4811 	 * W num      Number of sound files that follow */
  4812 
  4812 
  4928 		}
  4928 		}
  4929 	}
  4929 	}
  4930 }
  4930 }
  4931 
  4931 
  4932 /* Action 0x12 */
  4932 /* Action 0x12 */
  4933 static void LoadFontGlyph(byte *buf, int len)
  4933 static void LoadFontGlyph(byte *buf, size_t len)
  4934 {
  4934 {
  4935 	/* <12> <num_def> <font_size> <num_char> <base_char>
  4935 	/* <12> <num_def> <font_size> <num_char> <base_char>
  4936 	 *
  4936 	 *
  4937 	 * B num_def      Number of definitions
  4937 	 * B num_def      Number of definitions
  4938 	 * B font_size    Size of font (0 = normal, 1 = small, 2 = large)
  4938 	 * B font_size    Size of font (0 = normal, 1 = small, 2 = large)
  4960 		}
  4960 		}
  4961 	}
  4961 	}
  4962 }
  4962 }
  4963 
  4963 
  4964 /* Action 0x12 (SKIP) */
  4964 /* Action 0x12 (SKIP) */
  4965 static void SkipAct12(byte *buf, int len)
  4965 static void SkipAct12(byte *buf, size_t len)
  4966 {
  4966 {
  4967 	/* <12> <num_def> <font_size> <num_char> <base_char>
  4967 	/* <12> <num_def> <font_size> <num_char> <base_char>
  4968 	 *
  4968 	 *
  4969 	 * B num_def      Number of definitions
  4969 	 * B num_def      Number of definitions
  4970 	 * B font_size    Size of font (0 = normal, 1 = small, 2 = large)
  4970 	 * B font_size    Size of font (0 = normal, 1 = small, 2 = large)
  4990 
  4990 
  4991 	grfmsg(3, "SkipAct12: Skipping %d sprites", _skip_sprites);
  4991 	grfmsg(3, "SkipAct12: Skipping %d sprites", _skip_sprites);
  4992 }
  4992 }
  4993 
  4993 
  4994 /* Action 0x13 */
  4994 /* Action 0x13 */
  4995 static void TranslateGRFStrings(byte *buf, int len)
  4995 static void TranslateGRFStrings(byte *buf, size_t len)
  4996 {
  4996 {
  4997 	/* <13> <grfid> <num-ent> <offset> <text...>
  4997 	/* <13> <grfid> <num-ent> <offset> <text...>
  4998 	 *
  4998 	 *
  4999 	 * 4*B grfid     The GRFID of the file whose texts are to be translated
  4999 	 * 4*B grfid     The GRFID of the file whose texts are to be translated
  5000 	 * B   num-ent   Number of strings
  5000 	 * B   num-ent   Number of strings
  5084 	}
  5084 	}
  5085 }
  5085 }
  5086 
  5086 
  5087 
  5087 
  5088 /* Used during safety scan on unsafe actions */
  5088 /* Used during safety scan on unsafe actions */
  5089 static void GRFUnsafe(byte *buf, int len)
  5089 static void GRFUnsafe(byte *buf, size_t len)
  5090 {
  5090 {
  5091 	SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
  5091 	SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
  5092 
  5092 
  5093 	/* Skip remainder of GRF */
  5093 	/* Skip remainder of GRF */
  5094 	_skip_sprites = -1;
  5094 	_skip_sprites = -1;