diff options
author | frosch <frosch@openttd.org> | 2017-01-14 15:48:19 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2017-01-14 15:48:19 +0000 |
commit | 1aedadb49b75862457bf29ac58a55d7dc80dcb35 (patch) | |
tree | 9697f62b4690d88c7f85db1dffe4ee53682ae841 /src | |
parent | ec9a920aab1af1001abb216a89cdc13e0ba1c3ab (diff) | |
download | openttd-1aedadb49b75862457bf29ac58a55d7dc80dcb35.tar.xz |
(svn r27730) -Change: Split openttd.grf into openttd.grf and orig_extra.grf
openttd.grf is now always loaded and provides all extra graphics in case the (possibly outdated) baseset does not.
orig_extra.grf contains graphics specific to the original baseset only.
Diffstat (limited to 'src')
-rw-r--r-- | src/gfxinit.cpp | 26 | ||||
-rw-r--r-- | src/newgrf.cpp | 5 | ||||
-rw-r--r-- | src/newgrf.h | 2 |
3 files changed, 22 insertions, 11 deletions
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index 10bc0afa1..23172bdd5 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -197,31 +197,41 @@ static void LoadSpriteTables() InitializeUnicodeGlyphMap(); /* - * Load the base NewGRF with OTTD required graphics as first NewGRF. + * Load the base and extra NewGRF with OTTD required graphics as first NewGRF. * However, we do not want it to show up in the list of used NewGRFs, * so we have to manually add it, and then remove it later. */ GRFConfig *top = _grfconfig; - GRFConfig *master = new GRFConfig(used_set->files[GFT_EXTRA].filename); + + /* Default extra graphics */ + GRFConfig *master = new GRFConfig("OPENTTD.GRF"); + master->palette |= GRFP_GRF_DOS; + FillGRFDetails(master, false, BASESET_DIR); + ClrBit(master->flags, GCF_INIT_ONLY); + + /* Baseset extra graphics */ + GRFConfig *extra = new GRFConfig(used_set->files[GFT_EXTRA].filename); /* We know the palette of the base set, so if the base NewGRF is not * setting one, use the palette of the base set and not the global * one which might be the wrong palette for this base NewGRF. * The value set here might be overridden via action14 later. */ switch (used_set->palette) { - case PAL_DOS: master->palette |= GRFP_GRF_DOS; break; - case PAL_WINDOWS: master->palette |= GRFP_GRF_WINDOWS; break; + case PAL_DOS: extra->palette |= GRFP_GRF_DOS; break; + case PAL_WINDOWS: extra->palette |= GRFP_GRF_WINDOWS; break; default: break; } - FillGRFDetails(master, false, BASESET_DIR); + FillGRFDetails(extra, false, BASESET_DIR); + ClrBit(extra->flags, GCF_INIT_ONLY); - ClrBit(master->flags, GCF_INIT_ONLY); - master->next = top; + extra->next = top; + master->next = extra; _grfconfig = master; - LoadNewGRF(SPR_NEWGRFS_BASE, i); + LoadNewGRF(SPR_NEWGRFS_BASE, i, 2); /* Free and remove the top element. */ + delete extra; delete master; _grfconfig = top; } diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 7b862149d..e0246bdf6 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -9203,8 +9203,9 @@ static void AfterLoadGRFs() * Load all the NewGRFs. * @param load_index The offset for the first sprite to add. * @param file_index The Fio index of the first NewGRF to load. + * @param num_baseset Number of NewGRFs at the front of the list to look up in the baseset dir instead of the newgrf dir. */ -void LoadNewGRF(uint load_index, uint file_index) +void LoadNewGRF(uint load_index, uint file_index, uint num_baseset) { /* In case of networking we need to "sync" the start values * so all NewGRFs are loaded equally. For this we use the @@ -9270,7 +9271,7 @@ void LoadNewGRF(uint load_index, uint file_index) if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue; if (stage > GLS_INIT && HasBit(c->flags, GCF_INIT_ONLY)) continue; - Subdirectory subdir = slot == file_index ? BASESET_DIR : NEWGRF_DIR; + Subdirectory subdir = slot < file_index + num_baseset ? BASESET_DIR : NEWGRF_DIR; if (!FioCheckFileExists(c->filename, subdir)) { DEBUG(grf, 0, "NewGRF file is missing '%s'; disabling", c->filename); c->status = GCS_NOT_FOUND; diff --git a/src/newgrf.h b/src/newgrf.h index 51b00da7c..1ab55dd04 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -183,7 +183,7 @@ extern GRFLoadedFeatures _loaded_newgrf_features; byte GetGRFContainerVersion(); void LoadNewGRFFile(struct GRFConfig *config, uint file_index, GrfLoadingStage stage, Subdirectory subdir); -void LoadNewGRF(uint load_index, uint file_index); +void LoadNewGRF(uint load_index, uint file_index, uint num_baseset); void ReloadNewGRFData(); // in saveload/afterload.cpp void ResetNewGRFData(); void ResetPersistentNewGRFData(); |