diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index cdb1de65ac..1a14d47601 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -46,6 +46,9 @@ static const SpriteID * const _landscape_spriteindexes[] = { _landscape_spriteindexes_toyland, }; +/** file index of first user-added GRF file */ +int _first_user_grf_file_index; + /** * Load an old fashioned GRF file. * @param filename The name of the file to open. @@ -238,6 +241,8 @@ static void LoadSpriteTables() LoadNewGRF(SPR_NEWGRFS_BASE, i); + _first_user_grf_file_index = i + 1; + /* Free and remove the top element. */ delete master; _grfconfig = top; diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index ce59e3758d..bdae420d15 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -35,6 +35,7 @@ #include "object_map.h" #include "tracerestrict.h" #include "programmable_signals.h" +#include "spritecache.h" #include "table/strings.h" #include "table/railtypes.h" @@ -2003,6 +2004,8 @@ static void DrawSingleSignal(TileIndex tile, const RailtypeInfo *rti, Track trac sprite = SPR_PROGSIGNAL_BASE + 16 + image * 2 + condition; is_custom_sprite = false; } + extern uint _first_user_grf_file_index; + if (!is_custom_sprite) is_custom_sprite = (GetOriginFileSlot(sprite) >= _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) {