Changeset - r22518:bf65c0efa303
[Not reviewed]
master
0 4 0
frosch - 7 years ago 2017-01-07 21:36:25
frosch@openttd.org
(svn r27725) -Codechange: Remove IsOpenTTDBaseGRF and test for GCF_CONFIG instead, which does the same in all use-cases.
4 files changed with 1 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -5618,13 +5618,13 @@ static void GraphicsNew(ByteReader *buf)
 

	
 
	uint8 type = buf->ReadByte();
 
	uint16 num = buf->ReadExtendedByte();
 
	uint16 offset = HasBit(type, 7) ? buf->ReadExtendedByte() : 0;
 
	ClrBit(type, 7); // Clear the high bit as that only indicates whether there is an offset.
 

	
 
	if ((type == 0x0D) && (num == 10) && _cur.grffile->is_ottdfile) {
 
	if ((type == 0x0D) && (num == 10) && HasBit(_cur.grfconfig->flags, GCF_SYSTEM)) {
 
		/* Special not-TTDP-compatible case used in openttd.grf
 
		 * Missing shore sprites and initialisation of SPR_SHORE_BASE */
 
		grfmsg(2, "GraphicsNew: Loading 10 missing shore sprites from extra grf.");
 
		LoadNextSprite(SPR_SHORE_BASE +  0, _cur.file_index, _cur.nfo_line++, _cur.grf_container_ver); // SLOPE_STEEP_S
 
		LoadNextSprite(SPR_SHORE_BASE +  5, _cur.file_index, _cur.nfo_line++, _cur.grf_container_ver); // SLOPE_STEEP_W
 
		LoadNextSprite(SPR_SHORE_BASE +  7, _cur.file_index, _cur.nfo_line++, _cur.grf_container_ver); // SLOPE_WSE
 
@@ -8855,13 +8855,12 @@ void LoadNewGRFFile(GRFConfig *config, u
 
	 * processed once at initialization.  */
 
	if (stage != GLS_FILESCAN && stage != GLS_SAFETYSCAN && stage != GLS_LABELSCAN) {
 
		_cur.grffile = GetFileByFilename(filename);
 
		if (_cur.grffile == NULL) usererror("File '%s' lost in cache.\n", filename);
 
		if (stage == GLS_RESERVE && config->status != GCS_INITIALISED) return;
 
		if (stage == GLS_ACTIVATION && !HasBit(config->flags, GCF_RESERVED)) return;
 
		_cur.grffile->is_ottdfile = config->IsOpenTTDBaseGRF();
 
	}
 

	
 
	if (file_index > LAST_GRF_SLOT) {
 
		DEBUG(grf, 0, "'%s' is not loaded as the maximum number of GRFs has been reached", filename);
 
		config->status = GCS_DISABLED;
 
		config->error  = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED);
src/newgrf.h
Show inline comments
 
@@ -100,13 +100,12 @@ struct GRFLabel {
 
	struct GRFLabel *next;
 
};
 

	
 
/** Dynamic data of a loaded NewGRF */
 
struct GRFFile : ZeroedMemoryAllocator {
 
	char *filename;
 
	bool is_ottdfile;
 
	uint32 grfid;
 
	byte grf_version;
 

	
 
	uint sound_offset;
 
	uint16 num_sounds;
 

	
src/newgrf_config.cpp
Show inline comments
 
@@ -913,21 +913,12 @@ char *GRFBuildParamList(char *dst, const
 
}
 

	
 
/** Base GRF ID for OpenTTD's base graphics GRFs. */
 
static const uint32 OPENTTD_GRAPHICS_BASE_GRF_ID = BSWAP32(0xFF4F5400);
 

	
 
/**
 
 * Checks whether this GRF is a OpenTTD base graphic GRF.
 
 * @return true if and only if it is a base GRF.
 
 */
 
bool GRFConfig::IsOpenTTDBaseGRF() const
 
{
 
	return (this->ident.grfid & 0x00FFFFFF) == OPENTTD_GRAPHICS_BASE_GRF_ID;
 
}
 

	
 
/**
 
 * Search a textfile file next to this NewGRF.
 
 * @param type The type of the textfile to search for.
 
 * @return The filename for the textfile, \c NULL otherwise.
 
 */
 
const char *GRFConfig::GetTextfile(TextfileType type) const
 
{
src/newgrf_config.h
Show inline comments
 
@@ -176,14 +176,12 @@ struct GRFConfig : ZeroedMemoryAllocator
 
	bool has_param_defaults;                       ///< NOSAVE: did this newgrf specify any defaults for it's parameters
 

	
 
	struct GRFConfig *next;                        ///< NOSAVE: Next item in the linked list
 

	
 
	void CopyParams(const GRFConfig &src);
 

	
 
	bool IsOpenTTDBaseGRF() const;
 

	
 
	const char *GetTextfile(TextfileType type) const;
 
	const char *GetName() const;
 
	const char *GetDescription() const;
 
	const char *GetURL() const;
 

	
 
	void SetParameterDefaults();
0 comments (0 inline, 0 general)