Special case OpenGFX as a "base" set to allow recolouring signals.

pull/6/merge
Jonathan G Rennison 9 years ago
parent 4d484a858f
commit 8edf5e0a34

@ -42,6 +42,7 @@ static const SpriteID * const _landscape_spriteindexes[] = {
/** file index of first user-added GRF file */
int _first_user_grf_file_index;
int _opengfx_grf_file_index;
/**
* Load an old fashioned GRF file.
@ -228,6 +229,16 @@ static void LoadSpriteTables()
LoadNewGRF(SPR_NEWGRFS_BASE, i);
_first_user_grf_file_index = i + 1;
_opengfx_grf_file_index = -1;
uint index = i;
for (GRFConfig *c = master; c != NULL; c = c->next, index++) {
if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND || HasBit(c->flags, GCF_INIT_ONLY)) continue;
if (c->ident.grfid == BSWAP32(0xFF4F4701)) {
/* Detect OpenGFX GRF ID */
_opengfx_grf_file_index = index;
break;
}
}
/* Free and remove the top element. */
delete master;

@ -1871,8 +1871,11 @@ static void DrawSingleSignal(TileIndex tile, const RailtypeInfo *rti, Track trac
sprite = (type == SIGTYPE_NORMAL && variant == SIG_ELECTRIC) ? SPR_ORIGINAL_SIGNALS_BASE : SPR_SIGNALS_BASE - 16;
sprite += type * 16 + variant * 64 + image * 2 + condition + (type > SIGTYPE_LAST_NOPBS ? 64 : 0);
}
uint origin_slot = GetOriginFileSlot(sprite);
extern uint _first_user_grf_file_index;
if (!is_custom_sprite) is_custom_sprite = (GetOriginFileSlot(sprite) >= _first_user_grf_file_index);
extern uint _opengfx_grf_file_index;
if (!is_custom_sprite) is_custom_sprite = origin_slot != _opengfx_grf_file_index && (origin_slot >= _first_user_grf_file_index);
if (!is_custom_sprite && variant == SIG_ELECTRIC && IsRestrictedSignal(tile) && GetExistingTraceRestrictProgram(tile, track) != NULL) {
if (type == SIGTYPE_PBS || type == SIGTYPE_PBS_ONEWAY) {

Loading…
Cancel
Save