File diff r11869:98a01e945794 → r11870:92eb16f6d311
src/newgrf.cpp
Show inline comments
 
@@ -147,13 +147,13 @@ void CDECL grfmsg(int severity, const ch
 
	DEBUG(grf, severity, "[%s:%d] %s", _cur_grfconfig->filename, _nfo_line, buf);
 
}
 

	
 
static inline bool check_length(size_t real, size_t wanted, const char *str)
 
{
 
	if (real >= wanted) return true;
 
	grfmsg(0, "%s: Invalid pseudo sprite length %d (expected %d)!", str, real, wanted);
 
	grfmsg(0, "%s: Invalid pseudo sprite length " PRINTF_SIZE " (expected " PRINTF_SIZE ")!", str, real, wanted);
 
	return false;
 
}
 

	
 
static inline byte grf_load_byte(byte **buf)
 
{
 
	return *(*buf)++;
 
@@ -4224,13 +4224,13 @@ static void GRFInfo(byte *buf, size_t le
 

	
 
	_cur_grffile->grfid = grfid;
 
	_cur_grffile->grf_version = version;
 
	_cur_grfconfig->status = _cur_stage < GLS_RESERVE ? GCS_INITIALISED : GCS_ACTIVATED;
 

	
 
	/* Do swap the GRFID for displaying purposes since people expect that */
 
	DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08lX - %s (palette: %s)", version, BSWAP32(grfid), name, _cur_grfconfig->windows_paletted ? "Windows" : "DOS");
 
	DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08X - %s (palette: %s)", version, BSWAP32(grfid), name, _cur_grfconfig->windows_paletted ? "Windows" : "DOS");
 
}
 

	
 
/* Action 0x0A */
 
static void SpriteReplace(byte *buf, size_t len)
 
{
 
	/* <0A> <num-sets> <set1> [<set2> ...]
 
@@ -4401,13 +4401,13 @@ static void GRFComment(byte *buf, size_t
 
	 * V ignored       Anything following the 0C is ignored */
 

	
 
	if (len == 1) return;
 

	
 
	size_t text_len = len - 1;
 
	const char *text = (const char*)(buf + 1);
 
	grfmsg(2, "GRFComment: %.*s", text_len, text);
 
	grfmsg(2, "GRFComment: %.*s", (int)text_len, text);
 
}
 

	
 
/* Action 0x0D (GLS_SAFETYSCAN) */
 
static void SafeParamSet(byte *buf, size_t len)
 
{
 
	if (!check_length(len, 5, "SafeParamSet")) return;
 
@@ -4943,13 +4943,13 @@ static void FeatureTownName(byte *buf, s
 
		townname->nb_gen++;
 
	}
 

	
 
	if (!check_length(len, 1, "FeatureTownName: number of parts")) return;
 
	byte nb = grf_load_byte(&buf);
 
	len--;
 
	grfmsg(6, "FeatureTownName: %d parts", nb, nb);
 
	grfmsg(6, "FeatureTownName: %u parts", nb);
 

	
 
	townname->nbparts[id] = nb;
 
	townname->partlist[id] = CallocT<NamePartList>(nb);
 

	
 
	for (int i = 0; i < nb; i++) {
 
		if (!check_length(len, 3, "FeatureTownName: parts header")) return;