NotRoadTypes

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

User avatar
stefino_cz
Traffic Manager
Traffic Manager
Posts: 255
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NotRoadTypes

Post by stefino_cz »

Hi, I wanted to code road vehicle for specific roadtype but vehicle properties like road_type or current_roadtype doesn't work. So how to code vehicle what has to go only on XY label roadtype? Thanks :)
Image
User avatar
stefino_cz
Traffic Manager
Traffic Manager
Posts: 255
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NotRoadTypes

Post by stefino_cz »

Can somebody help me with crossings tram X rail? Thanks a lot :)
tram_railroad.PNG
(3.5 MiB) Not downloaded yet
Image
User avatar
Comm Cody
Tycoon
Tycoon
Posts: 1058
Joined: 07 Mar 2008 22:21
Location: In a galaxy far far away.

Re: NotRoadTypes

Post by Comm Cody »

that's trunk OTTD behavior, if a tram track alone crosses a railroad track, then the crossing has a road on it.
Something goes here, hell if I know.
User avatar
stefino_cz
Traffic Manager
Traffic Manager
Posts: 255
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NotRoadTypes

Post by stefino_cz »

Comm Cody wrote: 31 Dec 2019 21:26 that's trunk OTTD behavior, if a tram track alone crosses a railroad track, then the crossing has a road on it.
Yes, but if I switch off NRT, it works good. When I turn on NRT, it doesn't display tram track on crossing like in the picture above. In the picture below you can see "old" version without NRT.
Výstřižek.PNG
Výstřižek.PNG (301.48 KiB) Viewed 2825 times
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 5784
Joined: 27 Nov 2004 15:05
Location: Canada

Re: NotRoadTypes

Post by wallyweb »

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5264
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: NotRoadTypes

Post by andythenorth »

In super exciting news, the newgrf docs for NRT are now done https://wiki.openttd.org/NewGRF_Specification_Status

NFO is done and GRFCodec should just work (did when I tested).

NML docs are done. If you want to build NML yourself, the source is on Github: https://github.com/openTTD/nml Otherwise it's patience until NML 0.5 to be released, track progress of that here :) https://github.com/OpenTTD/nml/issues/43

OpenGFX support is in progress https://github.com/OpenTTD/OpenGFX/issues/9
User avatar
Gadg8eer
Traffic Manager
Traffic Manager
Posts: 137
Joined: 14 Dec 2019 14:22

Re: NotRoadTypes

Post by Gadg8eer »

Why is it that the "catenary_back" in the graphics block of NML doesn't actually draw the catenary under the road vehicle? The rear poles are showing up over the road vehicles. I thought this was implemented specifically to fix the rear catenary being drawn on top of the road vehicle?
User avatar
Gadg8eer
Traffic Manager
Traffic Manager
Posts: 137
Joined: 14 Dec 2019 14:22

Re: NotRoadTypes

Post by Gadg8eer »

Gadg8eer wrote: 25 May 2020 20:07 Why is it that the "catenary_back" in the graphics block of NML doesn't actually draw the catenary under the road vehicle? The rear poles are showing up over the road vehicles. I thought this was implemented specifically to fix the rear catenary being drawn on top of the road vehicle?
So apparently it was an issue with JGRPP 0.34.3, I'll go to JGR before asking here next time.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1264
Joined: 15 Feb 2003 17:32
Location: Villefranche-sur-Saône, France

Re: NotRoadTypes

Post by MagicBuzz »

Hello,

I'm trying to use NRT with a GS, but I don't see dedicated functions.
Right now, "RoadType" is " ROADTYPE_ROAD", "ROADTYPE_TRAM", "ROADTYPE_INVALID".
How could I get the complete list of roads, their max speed and other data if existing (is it for general vehicles, trucks, cities, country, express roads, etc.?) and use them with GSRoad ?
User avatar
jfs
Tycoon
Tycoon
Posts: 1249
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: NotRoadTypes

Post by jfs »

You should be able to just create a GSRoadTypeList to get all the valid type id's, then you can query each of them for properties.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1264
Joined: 15 Feb 2003 17:32
Location: Villefranche-sur-Saône, France

Re: NotRoadTypes

Post by MagicBuzz »

Ok thank you, so the RoadType enum is updated by the NewGRF.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1264
Joined: 15 Feb 2003 17:32
Location: Villefranche-sur-Saône, France

Re: NotRoadTypes

Post by MagicBuzz »

Hello, I still have some problems with this feature.

I'm trying, from the GS, to find the list of the current available road types.

I do this:

Code: Select all

   
    local roadTypeList = GSRoadTypeList(GSRoad.ROADTRAMTYPES_ROAD);
    roadTypeList.Valuate(function(roadType) { return GSRoad.IsRoadTypeAvailable(roadType) ? 1 : 0; });
    roadTypeList.KeepValue(1);
But I get all roadtypes, even types that are still not available in game.

In the documentation of GSRoad.IsRoadTypeAvailable(roadType) is said that the current company it taken as context.
But GS doesn't have a company !

So I changed to :

Code: Select all

    local company_zero = GSCompanyMode(0);
    local roadTypeList = GSRoadTypeList(GSRoad.ROADTRAMTYPES_ROAD);
    roadTypeList.Valuate(function(roadType) { return GSRoad.IsRoadTypeAvailable(roadType) ? 1 : 0; });
    roadTypeList.KeepValue(1);
    company_zero = null;
But:
1/ I still get all the road types (?)
2/ In the Init() of my GS it might fail or return invalid roads as company 0 still not exists.

How to get the available roads based on the current game year ?
Also, I can query GetName() and GetMaxSpeed() but I would like also get some other information like presence of stripes, or any extended feature.

Edit: I moved my code from Init() to the main loop (after a Sleep(1)) and the company #0 now exists. It works fine. But I'm still convinced the GS should get a more general IsRoadTypeAvailable() that only check introduction year of the road, without needing to request a company RoadType list
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 4 guests