Skip to content

Commit

Permalink
(svn r27725) -Codechange: Remove IsOpenTTDBaseGRF and test for GCF_CO…
Browse files Browse the repository at this point in the history
…NFIG instead, which does the same in all use-cases.
  • Loading branch information
frosch123 committed Jan 7, 2017
1 parent 4df7125 commit a3b356e
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 14 deletions.
3 changes: 1 addition & 2 deletions src/newgrf.cpp
Expand Up @@ -5621,7 +5621,7 @@ static void GraphicsNew(ByteReader *buf)
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.");
Expand Down Expand Up @@ -8858,7 +8858,6 @@ void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage, S
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) {
Expand Down
1 change: 0 additions & 1 deletion src/newgrf.h
Expand Up @@ -103,7 +103,6 @@ struct GRFLabel {
/** Dynamic data of a loaded NewGRF */
struct GRFFile : ZeroedMemoryAllocator {
char *filename;
bool is_ottdfile;
uint32 grfid;
byte grf_version;

Expand Down
9 changes: 0 additions & 9 deletions src/newgrf_config.cpp
Expand Up @@ -915,15 +915,6 @@ char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last)
/** 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.
Expand Down
2 changes: 0 additions & 2 deletions src/newgrf_config.h
Expand Up @@ -179,8 +179,6 @@ struct GRFConfig : ZeroedMemoryAllocator {

void CopyParams(const GRFConfig &src);

bool IsOpenTTDBaseGRF() const;

const char *GetTextfile(TextfileType type) const;
const char *GetName() const;
const char *GetDescription() const;
Expand Down

0 comments on commit a3b356e

Please sign in to comment.