OpenTTD has for a long time (since 0.5.0 many moons ago) provided the ability to load NewGRFs
statically. This means that these NewGRFs are not saved in the savegame and are loaded in all games, including network games. For obvious (desync-)reasons, NewGRFs loaded this way may only contain graphical modifications. Altering the game state in any way, e.g. by adding new vehicles is not permitted.
While the GUI for working with NewGRFs has improved a lot in recent versions of OpenTTD, static grfs can still only be configured by editing a .cfg file, setting filename and parameters manually. This is not really user-friendly and I guess that many didn't even know that the feature exists. This patch aims to change that, by allowing static NewGRFs to be configured from the standard NewGRF settings window. In principle, it should be possible to even change NewGRFs during a running (network) game, but this requires further work beyond the scope of this patch.
This patch adds two buttons 'normal' and 'static' to the NewGRF window, with tooltips explaining their meaning. The static grf list is automatically filtered, so only grfs that are 'safe' to add appear in the list. This safety scan takes place during the file scan at startup.
Please test this patch and report any bugs / suggestions you have. I'll try to provide a windows binary asap, but of course you're free to compile your own
Attachment:
screenshot.png [ 15.74 KiB | Viewed 1354 times ]
Attached below is the patch file. The patch was developed as a mercurial queue of 7 smaller patches, these are contained in the zip file. These patches do the following in order, this should provide a good overview of how the patch works internally.
Code:
Codechange: Unify GLS_FILESCAN and GLS_SAFETYSCAN. This causes all NewGRFs to be scanned for safety during the filescan, not just static ones.
Add: GRFConfig::ResetStatus(), and use that to reset grfconfigs prior to loading.
Codechange: Move the calls to GFFConfig::ResetStatus() to a separate function.
Change: Disable duplicate (static) grfs during grf loading instead of removing them when starting / loading a game.
Codechange: Move the 'Apply Changes' part in the NewGRF settings window to a separate function.
Codechange: Prepare the NewGRF settings window for handling two lists of active GRFs.
Feature: Configure static NewGRFs via the NewGRF settings window.
_________________
Create your own NewGRF? Check out this
tutorial!