Beta test the new forum at
Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

[Patch]Routing penalty signal (includes change of saving/paking)

Started by cfds, July 12, 2011, 03:24:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


As discussed in the german forum ( I built a signal that discourages the router to use the way across the signal by adding a value (that is defined in the .dat-file) in the get_kosten() call of waggons and automobiles. Since this made 16bit flags for signals necessary I included Eriks announce signal patch and slightly modified the handling of the minSpeed-Sign (it gets an own flag, too), this sign will have to be repaked with new version of makeobj. This patch (as Erik's) changes the savegame/pak version to 4.

64bit Linux binary:
32bit Linux binary:
32bit WinGDI binary
Pak(64)Addon: (Penalty signal and repacked minimum80)

Structure of penalty signal .dat-file:
[image stuff]

for a penalty sign with 20 penalty points (for comparison: hill up is 25)

Please leave feedback.


I updated my patch with:
-Dialog to set the routing penalty (similar to traffic lights)
-A signal that just closes the track without prompting trains to look for a new route (just a signal that never switches to green, perfect to clear a piece of track for recontruction measures

New executables, pak and patch:
64bit Linux binary
32bit Linux binary
32bit WinGDI binary


This sounds great!  I've downloaded the patch; how do I apply it?

Also makes me think: is there a way to include this route finding penalty into into regular traffic lights?  Logically a bus or truck would want to avoid routes that contained a large number of traffic lights, but I've noticed that they don't appear to have an impact on route selection.


Would be a nice signal.

Perhaps I would build a signal for pak 128 and test it.
But it has to wait  few weeks.
I'm quiet busy at the moment.

Nice to hear that my efforts on the announce signal are helpfull.


To apply the patch just download the appropriate executable and put it into your simutrans program folder. Then download the pak-Addon and extract it to your addon pak folder (typically in home/[user]/simutrans on linux systems and in [Own Documents]\simutrans\ on windows systems).

Savegames created with the new executable cannot be opened with an older version of simutrans, so keep a copy of your savegame.


A new version (based on r4721) that addresses problems with the not save-safe variable signal_speed_limit from Erik's patch (yes, looking at you, erik). Now there should be no longer any strangely slow trains lurking about.

Links: (linux64bit) (linux32bit) (windows 32bit gdi)


Was that still a case?

I tough it was solved.
If you saved the game, the variable "speed_limit" would be saved.
By starting up the game, the variable "signal_speed_limit" is set on Unlimited so the train would use his "speed_limit" variable.
The "signal_speed_limit" is only used if the train approach the signal.

By not making new save variables, then the saved game is still usable for other versions (older when needed).
It also keeps the save files smaller.


I used the patch from this forum and there the signal_speed_limit is not set after loading (I did it in set_convoi(), since it is called after loading). I also set signal_speed_limit to SPEED_UNLIMITED in the constructor and "repaired" the graphic selection part (On electrified tracks your announce signal showed sometimes weird images since the check for 3 phases is only done for the presignal).

[Edit] Perhaps I should have posted this to your thread...


Totally forgotten to test it with electified tracks.
I hope having some time to change it soon.

At any way.
I wand to make a whole new way of managing the signals and trains if I have finished a other project (NS-pakset V2.0).
Your idea of routing penalty signal is also very useful for that.


I'm struggling to get this patch to work.  Can anyone see what I'm doing wrong?

I'm using pak128.  I created a simple sign model and made a set of images.  Then I created a .dat file using the format given in this thread.  Then I created a pak file - using pak helper 3.2 - based on my images and the dat file.  I put the pak file in my pak128 folder and downloaded the executable (sim4721_4) and put that in my Simutrans folder.  I ran the executable but was unable to see my sign on any of the menus.  Do I need to do something in Menuconfig as well to get this to work?




It should work out of the box. I do not know if pak_helper checks the .dat file for mistakes and just erases the offending line. I will check this afternoon with pak128 and post the results.


Quote from: Andyh on August 10, 2011, 05:04:17 AM
I'm struggling to get this patch to work.  Can anyone see what I'm doing wrong?

I'm using pak128.  I created a simple sign model and made a set of images.  Then I created a .dat file using the format given in this thread.  Then I created a pak file - using pak helper 3.2 - based on my images and the dat file.  I put the pak file in my pak128 folder and downloaded the executable (sim4721_4) and put that in my Simutrans folder.

Do you use the right makeobj?
Becouse of some changes the official makeobj 51 won't make the pak right for this.


Yes, you have to compile makeobj with my changed code. If you don't want to (or can) do this just send me the graphics and I will make a pak-file for you.


That would be the problem.  I was simply using the standard MakeObj.

Thanks cfds for the offer to create a pak file for me, but do you think you could put a compiled version of the modified MakeObj executable on the Simutrans-Germany site?  That way I (and others) could create/modify signs as we wanted.


I can publish a Linux-Executable. The Windows variant fails due to mingw-libpng incombatibilities...


I loaded a new patchfile and a batch of patched executables to, including makeobj for win32 and linux64 (linux32 has to wait until I figure out how to compile libpng15 for multilib).


Thanks cdfs, I'll try out my pak128 sign with the win32 makeobj tonight.

Update 8/25: tried it last night.  Signal works a treat.  Thanks a lot for this patch cdfs.