JGR's Patch Pack

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

nihues
Engineer
Engineer
Posts: 85
Joined: 13 Jan 2015 10:26

Re: JGR's Patch Pack

Post by nihues »

Also another problem, after last template replacement (also changed all tracks to electric), some trains won't go to maintence automatically... dunno if it's Iron Horse problem because of double head of all trains, tried add more depots and no change. Was using normal trains "not double" before and was all fine. Easy to find bad trains on the vehicle list by reliability.
O'Donnell & Co., Oct 1st, 1990.sav
(418.29 KiB) Downloaded 65 times
Save attached.

EDIT: Found the issue... was the Maintenance order (or seems that any depot order causes that problem), it disable the auto maintenance for trains (maybe for other modals too)... after removing that order all working, it seems a bug, because any train that needs repair (like a slow train that need to fix) don't go to any depot, only the depot on the order list.
Last edited by nihues on 18 Dec 2019 19:32, edited 1 time in total.
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

pixel_pirate wrote: 18 Dec 2019 10:45 Hello, just a question .

Is there a way to auto name trains / routes.
Like in jokers patch pack there is a button that just groups trains airplanes buses & ships , and auto names them.
it is very handy and quick to get things organised .

is there something similar in your patch

Thanks for all your work.
There isn't anything like this at the moment, however I may be able look into the feasibility of such a mechanism in future.
nihues wrote: 18 Dec 2019 11:40 Hey, I just found a little bug, the conditional order "slot occupancy" has "undefined" status, so I can't use it (or I need to do more things to use slots?).

Also I'm using a universal wagon with multiple cargos with refit to avaliable, when I do template replacement using with refit or no refit option, it always reset all cargos to "zero", isn't suppose to reuse the avaliable cargo?
The slot conditional orders are only for exceptionally advanced use cases, and aren't how you would use them normally. They shouldn't be shown in the order window when the slots feature isn't enabled in the UI but unfortunately that was missed due to an oversight; that has now been fixed.
To use slots, enable the "show advanced routing restrictions features" setting, use the manage slots window in the trains listing window dropdown, and routing restrictions.

There isn't any code to support current cargo dependent vehicle refitting. New wagons added to the train are refit as per the template. The existing wagons are refit to match the template if the refit option is enabled.
If you need to have different groups refit to different cargoes, you should create different templates for each of the required cargoes.
nihues wrote: 18 Dec 2019 15:47 Also another problem, after last template replacement (also changed all tracks to electric), some trains won't go to maintence automatically... dunno if it's Iron Horse problem because of double head of all trains, tried add more depots and no change. Was using normal trains "not double" before and was all fine. Easy to find bad trains on the vehicle list by reliability.
O'Donnell & Co., Oct 1st, 1990.sav
Save attached.
This looks like a problem with your use of conditional orders, the service order is conditionally skipped, preventing the train from being regularly serviced.
Ex TTDPatch Coder
Patch Pack, Github
nihues
Engineer
Engineer
Posts: 85
Joined: 13 Jan 2015 10:26

Re: JGR's Patch Pack

Post by nihues »

This looks like a problem with your use of conditional orders, the service order is conditionally skipped, preventing the train from being regularly serviced.
The conditional order was intencional so it won't stay on the line and helps with station load/unload... worked but generated that other issue it was the Maintenance order (or seems that any depot order causes that problem), it disable the auto maintenance for trains (maybe for other modals too)... after removing that order all working, it seems a bug, because any train that needs repair (like a slow train that need to fix) don't go to any depot, only the depot on the order list.
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

nihues wrote: 18 Dec 2019 19:36
This looks like a problem with your use of conditional orders, the service order is conditionally skipped, preventing the train from being regularly serviced.
The conditional order was intencional so it won't stay on the line and helps with station load/unload... worked but generated that other issue it was the Maintenance order (or seems that any depot order causes that problem), it disable the auto maintenance for trains (maybe for other modals too)... after removing that order all working, it seems a bug, because any train that needs repair (like a slow train that need to fix) don't go to any depot, only the depot on the order list.
This is the correct/documented behaviour, it is not a bug.
In general, vehicles heading to an arbitrary depot of their own accord is unwanted behaviour as it tends to create problems including vehicles becoming lost/misrouted, etc. Therefore it is only done if the order list does not include any depot order, as otherwise the vehicle would have no way of being serviced at all.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: JGR's Patch Pack

Post by MagicBuzz »

Hello JGR,

I'm trying to compile your fixes about vehicle template.

I get an error with Visual Studio 2019 (lastest version) when compiling in the vehicle_sl.cpp here :

Code: Select all

1>------ Build started: Project: version, Configuration: Debug Win32 ------
2>------ Skipped Build: Project: generate, Configuration: Debug Win32 ------
2>Project not selected to build for this solution configuration 
3>------ Build started: Project: settings, Configuration: Debug Win32 ------
1>Microsoft (R) Windows Script Host Version 5.812
1>Copyright (C) Microsoft Corporation. Tous droits r�serv�s.
1>
4>------ Build started: Project: openttd, Configuration: Release x64 ------
4>rev.cpp
4>vehicle_sl.cpp
4>F:\Projets\OpenTTD JGR\src\order_base.h(642,45): warning C4267: 'return': conversion from 'size_t' to 'VehicleOrderID', possible loss of data (compiling source file ..\src\saveload\vehicle_sl.cpp)
4>F:\Projets\OpenTTD JGR\src\saveload\vehicle_sl.cpp(1112,61): error C2398: Element '1': conversion from 'int' to '_Ty1 &' requires a narrowing conversion
4>        with
4>        [
4>            _Ty1=const VehicleID
4>        ]
4>Done building project "openttd_vs142.vcxproj" -- FAILED.
5>------ Skipped Build: Project: regression, Configuration: Debug Win32 ------
5>Project not selected to build for this solution configuration 
========== Build: 2 succeeded, 1 failed, 4 up-to-date, 2 skipped ==========

Code: Select all

void Load_VESR()
{
	int index;
	while ((index = SlIterateArray()) != -1) {
		auto iter = pending_speed_restriction_change_map.insert({ index, {} }); /* <== error is here */
		PendingSpeedRestrictionChange *ptr = &(iter->second);
		SlObject(ptr, GetVehicleSpeedRestrictionDescription());
	}
}
I can "fix" the issue by using a static_conversion... I'm not very comfortable with C++ (well... I'm completely zero at C++) so I'm not sure this is a good solution at all...
I'm not sure about possible side effects...

Your code :

Code: Select all

void Load_VESR()
{
	int index;
	while ((index = SlIterateArray()) != -1) {
		auto iter = pending_speed_restriction_change_map.insert({ index, { } });
		PendingSpeedRestrictionChange *ptr = &(iter->second);
		SlObject(ptr, GetVehicleSpeedRestrictionDescription());
	}
}
Mine :

Code: Select all

void Load_VESR()
{
	int index;
	while ((index = SlIterateArray()) != -1) {
		auto iter = pending_speed_restriction_change_map.insert({ static_cast<VehicleID>(index), { } });
		PendingSpeedRestrictionChange *ptr = &(iter->second);
		SlObject(ptr, GetVehicleSpeedRestrictionDescription());
	}
}
And I still have some warnings :

Code: Select all

1>------ Build started: Project: version, Configuration: Debug Win32 ------
2>------ Skipped Build: Project: generate, Configuration: Debug Win32 ------
2>Project not selected to build for this solution configuration 
3>------ Build started: Project: settings, Configuration: Debug Win32 ------
1>Microsoft (R) Windows Script Host Version 5.812
1>Copyright (C) Microsoft Corporation. Tous droits r�serv�s.
1>
4>------ Build started: Project: openttd, Configuration: Release x64 ------
4>rev.cpp
4>vehicle_sl.cpp
4>F:\Projets\OpenTTD JGR\src\order_base.h(642,45): warning C4267: 'return': conversion from 'size_t' to 'VehicleOrderID', possible loss of data (compiling source file ..\src\saveload\vehicle_sl.cpp)
4>F:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(149,1): warning C4267: 'initializing': conversion from 'size_t' to '_Ty2', possible loss of data
4>        with
4>        [
4>            _Ty2=unsigned short
4>        ] (compiling source file ..\src\saveload\vehicle_sl.cpp)
4>F:\Projets\OpenTTD JGR\src\station_base.h(455): message : see reference to function template instantiation 'std::pair<Key,unsigned short>::pair<StationID&,unsigned __int64,0>(_Other1,_Other2 &&) noexcept' being compiled
4>        with
4>        [
4>            Key=uint16,
4>            _Other1=StationID &,
4>            _Other2=unsigned __int64
4>        ] (compiling source file ..\src\saveload\vehicle_sl.cpp)
4>F:\Projets\OpenTTD JGR\src\station_base.h(455): message : see reference to function template instantiation 'std::pair<Key,unsigned short>::pair<StationID&,unsigned __int64,0>(_Other1,_Other2 &&) noexcept' being compiled
4>        with
4>        [
4>            Key=uint16,
4>            _Other1=StationID &,
4>            _Other2=unsigned __int64
4>        ] (compiling source file ..\src\saveload\vehicle_sl.cpp)
4>Generating code
4>14 of 50817 functions (<0.1%) were compiled, the rest were copied from previous compilation.
4>  0 functions were new in current compilation
4>  162 functions had inline decision re-evaluated but remain unchanged
4>Finished generating code
4>tbtr_template_gui_main.obj : warning LNK4204: 'F:\Projets\OpenTTD JGR\objs\x64\Release\openttd.pdb' is missing debugging information for referencing module; linking object as if no debug info
[...]
4>scope_info.obj : warning LNK4204: 'F:\Projets\OpenTTD JGR\objs\x64\Release\openttd.pdb' is missing debugging information for referencing module; linking object as if no debug info
4>openttd_vs142.vcxproj -> F:\Projets\OpenTTD JGR\projects\..\objs\x64\Release\openttd.exe
4>        1 fichier(s) copié(s).
4>Done building project "openttd_vs142.vcxproj".
5>------ Skipped Build: Project: regression, Configuration: Debug Win32 ------
5>Project not selected to build for this solution configuration 
========== Build: 3 succeeded, 0 failed, 4 up-to-date, 2 skipped ==========
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

MagicBuzz wrote: 18 Dec 2019 20:15 Hello JGR,

I'm trying to compile your fixes about vehicle template.

I get an error with Visual Studio 2019 (lastest version) when compiling in the vehicle_sl.cpp here :

...

I can "fix" the issue by using a static_conversion... I'm not very comfortable with C++ (well... I'm completely zero at C++) so I'm not sure this is a good solution at all...
I'm not sure about possible side effects...

Your code :

Code: Select all

void Load_VESR()
{
	int index;
	while ((index = SlIterateArray()) != -1) {
		auto iter = pending_speed_restriction_change_map.insert({ index, { } });
		PendingSpeedRestrictionChange *ptr = &(iter->second);
		SlObject(ptr, GetVehicleSpeedRestrictionDescription());
	}
}
Mine :

Code: Select all

void Load_VESR()
{
	int index;
	while ((index = SlIterateArray()) != -1) {
		auto iter = pending_speed_restriction_change_map.insert({ static_cast<VehicleID>(index), { } });
		PendingSpeedRestrictionChange *ptr = &(iter->second);
		SlObject(ptr, GetVehicleSpeedRestrictionDescription());
	}
}
...
Thanks for reporting this.
Yes, that's a correct fix. I've pushed fixes for this and the other warning.

On your earlier workaround, I would not recommend removing the save/load of those chunks as this creates a risk of multiplayer desyncs and other misbehaviour at load time when using the speed restrictions feature.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: JGR's Patch Pack

Post by MagicBuzz »

While testing the vehicle template feature, I still have one bug with templates.

You'll find attached a savegame with an example.

Train group "Coal 10".
I created a vehicle template (template 0) composed of one "030" engine and 7 "Low sided wagon w/out brakes" and 6 "Low sided wagon" refited to transport coal.
We can see in the template there is a total capacity of 104 tons of coal, and nothing else.

But :
- When a train with less wagons is replaced with this template, all added wagons have their standard cargo (goods)
- When I send again the train to depot, it still keep "goods" refit for some wagons

Wagons created from the template should have the same cargo as the template, and when "refit" is enabled in the template vehicle, the existing wagons should be refitted to match the template.
Attachments
jgr and snail.sav
(2.48 MiB) Downloaded 71 times
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

MagicBuzz wrote: 18 Dec 2019 21:17 While testing the vehicle template feature, I still have one bug with templates.

You'll find attached a savegame with an example.

Train group "Coal 10".
I created a vehicle template (template 0) composed of one "030" engine and 7 "Low sided wagon w/out brakes" and 6 "Low sided wagon" refited to transport coal.
We can see in the template there is a total capacity of 104 tons of coal, and nothing else.

But :
- When a train with less wagons is replaced with this template, all added wagons have their standard cargo (goods)
- When I send again the train to depot, it still keep "goods" refit for some wagons

Wagons created from the template should have the same cargo as the template, and when "refit" is enabled in the template vehicle, the existing wagons should be refitted to match the template.
Thanks for letting me know.
I've pushed a fix which should fix the earlier fix.
Ex TTDPatch Coder
Patch Pack, Github
Sparvass
Engineer
Engineer
Posts: 6
Joined: 19 Dec 2019 16:43

Re: JGR's Patch Pack

Post by Sparvass »

Allright, probably a question asked a million times. Is this just to download and play or do I need to install the patches somehow?
I downloaded the windows binary but quite a few things doesn't seem to work.
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7240
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: JGR's Patch Pack

Post by Redirect Left »

Sparvass wrote: 20 Dec 2019 05:46 Allright, probably a question asked a million times. Is this just to download and play or do I need to install the patches somehow?
I downloaded the windows binary but quite a few things doesn't seem to work.
This is a download and play deal. Simply download the file from the first post, unzip it into its own folder, and then launch openttd.exe, this is the JGR patchpack installed and ready to play, what sort of issues are you having and things not seeming to work?
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
Sparvass
Engineer
Engineer
Posts: 6
Joined: 19 Dec 2019 16:43

Re: JGR's Patch Pack

Post by Sparvass »

Redirect Left wrote: 20 Dec 2019 05:57
Sparvass wrote: 20 Dec 2019 05:46 Allright, probably a question asked a million times. Is this just to download and play or do I need to install the patches somehow?
I downloaded the windows binary but quite a few things doesn't seem to work.
This is a download and play deal. Simply download the file from the first post, unzip it into its own folder, and then launch openttd.exe, this is the JGR patchpack installed and ready to play, what sort of issues are you having and things not seeming to work?
Picking and placing single houses in scenario editor and chunnels so far :)
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: JGR's Patch Pack

Post by ColdIce »

Hy JGR,

Thank you for this patch pack. I know it's hard to maintain this, so i really appreciate the effort.

I searched "drag and drop objects" and I found a post from 1 year ago. viewtopic.php?f=33&t=73469&p=1215069&hi ... s#p1215069

Did you do anything further to this idea? Asking because there are a lot of settings in this pack and maybe I missed something.

Thank you
The rest is confetti!
p4nzer
Engineer
Engineer
Posts: 31
Joined: 27 Jun 2017 21:43

Re: JGR's Patch Pack

Post by p4nzer »

Sparvass wrote: 20 Dec 2019 17:05
Redirect Left wrote: 20 Dec 2019 05:57
Sparvass wrote: 20 Dec 2019 05:46 Allright, probably a question asked a million times. Is this just to download and play or do I need to install the patches somehow?
I downloaded the windows binary but quite a few things doesn't seem to work.
This is a download and play deal. Simply download the file from the first post, unzip it into its own folder, and then launch openttd.exe, this is the JGR patchpack installed and ready to play, what sort of issues are you having and things not seeming to work?
Picking and placing single houses in scenario editor and chunnels so far :)
I believe both of those features are required to be enabled in settings.
eshield
Engineer
Engineer
Posts: 32
Joined: 24 Feb 2009 12:41
Contact:

Re: JGR's Patch Pack

Post by eshield »

Hello, JGR.

This can be not related to you but ... just in case.

I've been playing with a new "speed restriction" (SR) feature for a while and there are some, imho, inconsistencies:
1. SR should not be persistent. I have 1 train passed thru SR sema with limit of 70 KPH and now this poor train runs at 70 KPH all the time! Even after depot. Even after game restart. So I had to place "remove restriction" sema. This is ridiculous, I believe; IMHO, this feature should work like in IRL: until next sema, i.e. restriction is applied within the section. Maybe, there should be more SR options.
2. SR can't be used with pre-signalling. SR is pretty much useless in routefinding because you just cant slowdown a cargo train to let it pass the passenger express heading towards Y cross. If SR could be applied to pre-signalling then this scenario would be real.


Personally, I don't see any real usage of SR in it's current targeting. Anyone else on this forum have ever tried to play with a SR feature? It would be nice to read some other opinions and SR usage cases.
Last edited by eshield on 23 Dec 2019 08:34, edited 1 time in total.
Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall open unto you.
ino
Traffic Manager
Traffic Manager
Posts: 152
Joined: 09 Apr 2017 14:58

Re: JGR's Patch Pack

Post by ino »

eshield wrote: 23 Dec 2019 08:19 IMHO, this feature should work like in IRL: until next sema, i.e. restriction is applied within the section.
Not in many parts of the world -- speed restriction applies until it is explicitly lifted or another restriction come into effect.

There's always problem with "IRL" thing here -- trains in different countries operate differently.
eshield wrote: 23 Dec 2019 08:19 Personally, I don't see any real usage of SR in it's current targeting. Anyone else on this forum have ever tried to play with a SR feature? It would be nice to read some other opinions and SR usage cases.
I don't use pre-signal, but I use SR for more realistic speed on rural tracks, to slow down train approaching stations, and to force same operation speed on busy part of the network.
eshield
Engineer
Engineer
Posts: 32
Joined: 24 Feb 2009 12:41
Contact:

Re: JGR's Patch Pack

Post by eshield »

ino wrote: 23 Dec 2019 08:29Not in many parts of the world -- speed restriction applies until it is explicitly lifted or another restriction come into effect.
That's right, there is always an exception in the rule. This is why I've said: "Maybe, there should be more SR options." .... like "SR until next sema" and "SR until it's lifted" and etc. I don't need an IRL simulator, I just want to build really complex and complicated railway networks with some nasty rules not just FIFO :D
Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall open unto you.
User avatar
vincentkoevoets
Engineer
Engineer
Posts: 48
Joined: 14 Nov 2014 10:49
Location: Assen, Netherlands

Re: JGR's Patch Pack

Post by vincentkoevoets »

ino wrote: 23 Dec 2019 08:29
eshield wrote: 23 Dec 2019 08:19 IMHO, this feature should work like in IRL: until next sema, i.e. restriction is applied within the section.
Not in many parts of the world -- speed restriction applies until it is explicitly lifted or another restriction come into effect.

There's always problem with "IRL" thing here -- trains in different countries operate differently.
eshield wrote: 23 Dec 2019 08:19 Personally, I don't see any real usage of SR in it's current targeting. Anyone else on this forum have ever tried to play with a SR feature? It would be nice to read some other opinions and SR usage cases.
I don't use pre-signal, but I use SR for more realistic speed on rural tracks, to slow down train approaching stations, and to force same operation speed on busy part of the network.
Same here, I use it just to slow down trains before stations or junctions, or in rural areas, for a bit more realistism.
Another thing I use it for is to let a freight train crawl through a siding, so a passanger train can pass at full speed without the freight train having to stop completely.

And indeed, in many parts of the world, the speed limit has to be explicitly lifted or changed.
Also, JGR said this would be a limitation of SR, that you would have to place a signal that lifts the speed restriction.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: JGR's Patch Pack

Post by wallyweb »

... speed limits ...
An interesting point is that in OpenTTD maximum speed limits can be set with railtypes (Action 0, property 14) and now roadtypes as well (Action 0, property 14 too) thus signage and signals become optional in such cases. 8)
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

ColdIce wrote: 20 Dec 2019 18:07 Hy JGR,

Thank you for this patch pack. I know it's hard to maintain this, so i really appreciate the effort.

I searched "drag and drop objects" and I found a post from 1 year ago. viewtopic.php?f=33&t=73469&p=1215069&hi ... s#p1215069

Did you do anything further to this idea? Asking because there are a lot of settings in this pack and maybe I missed something.

Thank you
Nothing further has been done on this. Potentially something may be looked into in the future though.
eshield wrote: 23 Dec 2019 08:19 Hello, JGR.

This can be not related to you but ... just in case.

I've been playing with a new "speed restriction" (SR) feature for a while and there are some, imho, inconsistencies:
1. SR should not be persistent. I have 1 train passed thru SR sema with limit of 70 KPH and now this poor train runs at 70 KPH all the time! Even after depot. Even after game restart. So I had to place "remove restriction" sema. This is ridiculous, I believe; IMHO, this feature should work like in IRL: until next sema, i.e. restriction is applied within the section. Maybe, there should be more SR options.
This is the intended behaviour. Having to place the restriction on every signal would be highly tedious. Nor should trains should arbitrarily unrestrict themselves.
I am aware that forgetting to add a remove speed restriction signal would be an issue, this was also part of the earlier discussion, and is one of the reasons why the feature is hidden away behind an advanced feature setting in the same way as the slots feature.
eshield wrote: 23 Dec 2019 08:19 2. SR can't be used with pre-signalling. SR is pretty much useless in routefinding because you just cant slowdown a cargo train to let it pass the passenger express heading towards Y cross. If SR could be applied to pre-signalling then this scenario would be real.
Without knowing exactly what sort of layout you are talking about, probably the most practical answer is to: not use pre-signals, use PBS, and use slots/the slot occupancy conditional.
eshield wrote: 23 Dec 2019 08:19 Personally, I don't see any real usage of SR in it's current targeting. Anyone else on this forum have ever tried to play with a SR feature? It would be nice to read some other opinions and SR usage cases.
Th original discussion which led to the feature is only 2 pages earlier.
Ex TTDPatch Coder
Patch Pack, Github
whispous
Engineer
Engineer
Posts: 5
Joined: 21 Sep 2008 20:29

Re: JGR's Patch Pack

Post by whispous »

Hello, I am repeatedly having trouble when I compile on ubuntu.

https://i.imgur.com/Amjl140.png

When I launch the game after this clearly incorrect compile, I have the version as nover000 - and so will not be able to connect to the eventual server it will be.
I have tried the latest, the previous 4 versions too with the same result. I'm downloading the zip. I am rather novice with linux and compiling. I have done this the same way with success a few times before.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 11 guests