Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Jun 19, 2013 6:30 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Sun Jan 08, 2012 8:43 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Sun Jan 27, 2008 1:02 pm
Posts: 298
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
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.


Attachments:
static_grfs_in_gui_v2_r24348.zip [22.75 KiB]
Downloaded 32 times
static_grfs_in_gui_v2_r24348.diff [34.32 KiB]
Downloaded 35 times

_________________
Create your own NewGRF? Check out this tutorial!


Last edited by Hirundo on Thu Jun 21, 2012 5:18 pm, edited 1 time in total.
Top
 Profile  
 
PostPosted: Sun Jan 08, 2012 8:57 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Sun Jan 27, 2008 1:02 pm
Posts: 298
- Reserved for future use -

_________________
Create your own NewGRF? Check out this tutorial!


Top
 Profile  
 
PostPosted: Mon Jan 09, 2012 4:55 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Feb 01, 2011 12:41 pm
Posts: 186
Very neat idea. I look forward to trying it out once you put up the windows binaries.

Are town name NewGRFs considered "static"? I don't think they are used after map creation.

_________________
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v10 - An AI that doubles as your highway department


Top
 Profile  
 
PostPosted: Mon Jan 09, 2012 5:30 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 4614
no, town name grfs are not static, they are constantly used, each time the name must be displayed (since the actual name is not stored, only the random value that created the name. it must therefore deterministically recreate the same name)

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
 Profile  
 
PostPosted: Mon Jan 09, 2012 1:13 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 21, 2007 11:47 am
Posts: 6122
Location: The Netherlands
Nice, great feature!

What I'd add is a clear message (warning if you will) that one is currently changing static newgrfs. This could be placed above the detailed newgrf information section.
I.e. something like: "Note: you are now configuring static NewGRFs. These will apply to all savegames. Only NewGRFs containing graphical modifications are permitted."

Or something along those lines. That should address the two main questions users may have. Plus it makes very clear what list one is configuring, to avoid situations where you had the wrong one activated and configured the wrong list as a result of that.

_________________
FooBar's Tram Tracks | TransRapid Track Set | Metro Track Set | OpenGFX base graphics set | FIRS Industry Replacement Set
Dutch Tram Set | Dutch Trainset 2 | Dutch Road Furniture


Top
 Profile  
 
PostPosted: Mon Jan 09, 2012 4:42 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Tue Apr 24, 2007 9:37 am
Posts: 2398
Location: The Land of Oz
How about making it a separate menu item instead?

_________________
--Stuff I made (or helped make)--
ImageImageImageImage

--My Award-Winning Screenshots and Videos--


Top
 Profile  
 
PostPosted: Mon Jan 09, 2012 7:29 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Feb 01, 2011 12:41 pm
Posts: 186
Eddi wrote:
no, town name grfs are not static, they are constantly used, each time the name must be displayed (since the actual name is not stored, only the random value that created the name. it must therefore deterministically recreate the same name)
What about the town name grfs that aren't used on the map? (you can have multiple town name grf's active, but only one can be actually used in generating names, right?)

_________________
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v10 - An AI that doubles as your highway department


Top
 Profile  
 
PostPosted: Mon Jan 09, 2012 9:46 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 4614
MinchinWeb wrote:
Eddi wrote:
no, town name grfs are not static, they are constantly used, each time the name must be displayed (since the actual name is not stored, only the random value that created the name. it must therefore deterministically recreate the same name)
What about the town name grfs that aren't used on the map? (you can have multiple town name grf's active, but only one can be actually used in generating names, right?)

that would be quite a lot of code for some marginal corner case, which i hereby question the benefit of. plus it would be very confusing about "why can i add town GRF X as static, but town GRF Y not?"

and "inactive" town grfs still influence the order and amount of entries in the town name dropdown, which is used to determine which town set is actually queried for the name.

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
 Profile  
 
PostPosted: Thu Jun 21, 2012 5:21 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Sun Jan 27, 2008 1:02 pm
Posts: 298
Bump

Patch updated to r24348, see first post.

_________________
Create your own NewGRF? Check out this tutorial!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000-2013 phpBB Group

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2013.
Hosted by Zernebok Hosting.