Suggestion for Bridges

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
SimYouLater
Chief Executive
Chief Executive
Posts: 675
Joined: 03 Apr 2016 20:19

Suggestion for Bridges

Post by SimYouLater »

I have no experience in making patches and I don't expect anyone to take up this idea just because I propose it. That being said...

Is it possible to have more than 19 13 bridges by separating bridges by the NewGRF that provides the bridges?
Last edited by SimYouLater on 02 Nov 2019 00:11, edited 2 times in total.
Licenses for my work...
You automatically have my permission to re-license graphics or code by me if needed for use in any project that is not GPL v2, on the condition that if you release any derivatives of my graphics they're automatically considered as ALSO GPL v2 (code may remain unreleased, but please do provide it) and carry this provision in GPL v2 uses.
Please ask someone in-the-know to be sure that the graphics are done by me. Especially TTD-Scale, long story.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Suggestion for Bridges

Post by Eddi »

SimYouLater wrote: 01 Nov 2019 21:31 Is it possible to have more than 19 bridges
No.
SimYouLater
Chief Executive
Chief Executive
Posts: 675
Joined: 03 Apr 2016 20:19

Re: Suggestion for Bridges

Post by SimYouLater »

Eddi wrote: 01 Nov 2019 22:33
SimYouLater wrote: 01 Nov 2019 21:31 Is it possible to have more than 19 13 bridges
No.
Why not? What's preventing a patch from allowing multiple instances of bridges, defined by whichever NewGRF the bridges are from?
Licenses for my work...
You automatically have my permission to re-license graphics or code by me if needed for use in any project that is not GPL v2, on the condition that if you release any derivatives of my graphics they're automatically considered as ALSO GPL v2 (code may remain unreleased, but please do provide it) and carry this provision in GPL v2 uses.
Please ask someone in-the-know to be sure that the graphics are done by me. Especially TTD-Scale, long story.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Suggestion for Bridges

Post by wallyweb »

SimYouLater wrote: 02 Nov 2019 00:09 Why not? What's preventing a patch from allowing multiple instances of bridges, defined by whichever NewGRF the bridges are from?
Each bridge in a set has a unique ID between 0x00 and 0x0C inclusive.
A patch to extend that number is possible. JGR and cirdan gave us three extra bridge IDs: 0x0D, 0x0E and 0x0F.
16 is hard set in OpenTTD's code and that set of 16 is not repeatable.
To complicate the situation, each of those 16 IDs has four types: RAIL, ROAD, MONOrail and MAGLev. so in reality one could say there are 48 bridges to a set.
It is possible for each of those 16 IDs to have its own NewGRF, but depending upon the placement of that GRF in your GRF load sequence, it will either overwrite or be overwritten by any other bridge set using the same ID.
So now the question becomes: Is it possible to patch the code to allow multiple bridge sets such that one set won't overwrite all or part of another set?
The short answer would be yes. It is, after all, only code, but the task would be fraught with peril. The code for bridges touches upon so many other features of the game that it would probably require a complete rewrite of OpenTTD's code and that's the simplistic "no" answer to your question.

I do stand to be corrected on this.
SimYouLater
Chief Executive
Chief Executive
Posts: 675
Joined: 03 Apr 2016 20:19

Re: Suggestion for Bridges

Post by SimYouLater »

wallyweb wrote: 02 Nov 2019 06:54
SimYouLater wrote: 02 Nov 2019 00:09 Why not? What's preventing a patch from allowing multiple instances of bridges, defined by whichever NewGRF the bridges are from?
Each bridge in a set has a unique ID between 0x00 and 0x0C inclusive.
A patch to extend that number is possible. JGR and cirdan gave us three extra bridge IDs: 0x0D, 0x0E and 0x0F.
16 is hard set in OpenTTD's code and that set of 16 is not repeatable.
To complicate the situation, each of those 16 IDs has four types: RAIL, ROAD, MONOrail and MAGLev. so in reality one could say there are 48 bridges to a set.
It is possible for each of those 16 IDs to have its own NewGRF, but depending upon the placement of that GRF in your GRF load sequence, it will either overwrite or be overwritten by any other bridge set using the same ID.
So now the question becomes: Is it possible to patch the code to allow multiple bridge sets such that one set won't overwrite all or part of another set?
The short answer would be yes. It is, after all, only code, but the task would be fraught with peril. The code for bridges touches upon so many other features of the game that it would probably require a complete rewrite of OpenTTD's code and that's the simplistic "no" answer to your question.

I do stand to be corrected on this.
Ah. Okay, that makes sense and it's too bad that's the case. Is it possible to add more types that appear only with railtype and roadtype NewGRFs?
Licenses for my work...
You automatically have my permission to re-license graphics or code by me if needed for use in any project that is not GPL v2, on the condition that if you release any derivatives of my graphics they're automatically considered as ALSO GPL v2 (code may remain unreleased, but please do provide it) and carry this provision in GPL v2 uses.
Please ask someone in-the-know to be sure that the graphics are done by me. Especially TTD-Scale, long story.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Suggestion for Bridges

Post by wallyweb »

SimYouLater wrote: 02 Nov 2019 06:59 Ah. Okay, that makes sense and it's too bad that's the case. Is it possible to add more types that appear only with railtype and roadtype NewGRFs?
In a manner, that happens now. railtypes and roadtypes define bridge surfaces that are applied as overlays to a bridge deck as long as the bridge is built from within a railtype/roadtype's GUI. The limitation is that the superstucture of a bridge is not addressable from within a railtype/roadtype's code.

You might want to refer to this page of my tutorial (W.I.P.)
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: Suggestion for Bridges

Post by Emperor Jake »

wallyweb wrote: 02 Nov 2019 06:54 A patch to extend that number is possible. JGR and cirdan gave us three extra bridge IDs: 0x0D, 0x0E and 0x0F.
Are there any other bridge GRFs that make use of these extra IDs? Just found out about your bridge set but it would also be possible to create an extension for TBRS or something.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Suggestion for Bridges

Post by wallyweb »

Emperor Jake wrote: 11 Nov 2019 22:18 Are there any other bridge GRFs that make use of these extra IDs?
Not that I am aware of.
Just found out about your bridge set but it would also be possible to create an extension for TBRS or something.
One could have a standalone set of one, two or three extra bridges. It would work alongside any bridge set.
At the moment my set replaces three bridges and adds one.
It will grow eventually.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Suggestion for Bridges

Post by Eddi »

NewGRFs tend to not use this kind of custom modifications, because it's not really possible to test if you're in a version that has them or not.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Suggestion for Bridges

Post by michael blunck »

Eddi wrote: 14 Nov 2019 20:42 NewGRFs tend to not use this kind of custom modifications, because it's not really possible to test if you're in a version that has them or not.
Wasn't there a special "platform" type number (action 7/9, var 8B) of "2" for cirdan's NMF? And probably another one for JGRPP as well? (At least it had been discussed for the latter).

regards
Michael
Image
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: Suggestion for Bridges

Post by JGR »

michael blunck wrote: 15 Nov 2019 08:45
Eddi wrote: 14 Nov 2019 20:42 NewGRFs tend to not use this kind of custom modifications, because it's not really possible to test if you're in a version that has them or not.
Wasn't there a special "platform" type number (action 7/9, var 8B) of "2" for cirdan's NMF? And probably another one for JGRPP as well? (At least it had been discussed for the latter).

regards
Michael
There is a feature test for this in JGRPP.
See "more_bridge_types" in this document
Ex TTDPatch Coder
Patch Pack, Github
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 8 guests