News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

All info in signal window

Started by Ves, September 05, 2016, 10:53:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ves

As talked about on the server, here is a suggestion as to show more coded info about a signal.
Example of usefull information:

* Longblock signal
* choose signal
* pre signal
* intermediate block signal
* etc etc

Ves

#1
I am quite happy to announce my absolute debut in writing code that actually works for simutrans!
I will let this picture explain:

(notice the "CLEAR" text in the infowindow)

James, what are your thought on this, would you consider implement it?
I would also like to try to show the other stuff as well mentioned earlier (long block, choose signal etc) if you would consider adding it.

jamespetts

I should indeed consider adding it (although the text should not be in all caps, and will need translation data); is this on Github somewhere?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I wrote it in caps, so it would distinguish from the other parameters to show that it is shifting (between states).
One question though:

Watching the signal state shifting, it appears that the states are shifting quite alot some times and non choose signal are showing sometimes clear, some times clear no choose, making it difficult to have the difference between them shown. Maybe worth looking into?

Also, I have not renamed the "clear no choose", "caution no choose" etc. as I am unsure which is intended to be main route and diverging route (both show occasionally up in the infowindow).

I was anyway also wondering if I was allowed to reallocate some of the information in the window (now that I learned how to do it), as it gets a bit messy with not so needed information quite high (as rotations) and more needed information scattered around (time since last train etc).

I Tried to make a Pull Request to your devel-new2 branch, but an error came up telling me I have no permission. What is the best to do?

jamespetts

If you can let me know the name of your Github repository, I can follow you and pull from you manually. I am not sure why you are having trouble with pull requests. I will certainly consider any suggestions that you have to rearrange the data in the signal window, although I cannot guarantee that I will incorporate it.

As to the changings of state, I will need rather more information to understand whether or not this is a problem. Does it affect either the appearance of signal graphics or the operation of trains in practice? If not, it would seem hard to classify this as a bug.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I have this time made a local branch of your devel-new-2, hence why I tried to push it to the devel-new branch directly (I thought I could create a pull-request?)

Anyway, in order for you to check the files in the meantime, they are put here as attachment.
The files are:

obj\roadsign.h
obj\signal.cc


And they are syncronized with the latest devel-new version, so you could just replace your existing files.

jamespetts

May I suggest that you set up an account with Github (which is free) and put your changes there? It is much easier for me to integrate them that way.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

#7
I already have a github account (hosting the Swedish pakset), however I thought the proper way was to create a branch within your project. Will work on it tonight!

edit:
I am afraid that I really do hit a wall when messing around with git:

If I clone a copy of your repository to my harddrive, I can update whenever you do, I can create local branches and edit files as I please. But I cannot make my local branch go online in any way. If I try to "publish" it, it tells me I dont have permission, and if I try to make a pull request, I also do not have permission. I have no clue how to publish my branch onto my own github account.

The other alternative I can see, is to make a copy of the entire simutrans experimental folder on my harddrive, delete the "git" folders inside and create a new repository in git, featuring the complete copy. With this, I can go live, but I have no clue how I am suppose to keep it in sync with your devel-new-branch (besides manually copying files, which will be very tedious).

How do you do this?

edit2:
I have now added information in the signal window wether it is a choose signal, longblock -, combined -, station - or distant signal. Still have intermediate - and permissive signal to go as well. Is there any other signal types that would be worth mentioning? Would a "normal signal" be in place when the signal is a plain signal?


jamespetts

Ahh - what you need to do is to clone the Simutrans-Experimental repository on Github (so that you have your own mirror of the repository on Github), and then pull your mirror to your own hard drive. When you make a change on your own computer, you then push that change to the version on Github, and then I can pull from your version on Github to my local computer. I cannot pull from the version on your local computer unless you have a Git server on your local computer that I can access from my computer running constantly, which would not be sensible or easy to set up.

As to additional information, you may want to specify whether a signal is a pre-signal and to have "station signal" become "directional signal" for track circuit block and cab signalling.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

#9
I think that I have done the right thing now. I had the issue of cloning it to my computer, but I could not push anything because it only wanted to push to your repository. It is currently cloning (I think...) and eventually it should be available here: https://github.com/VictorErik/Simutrans-Experimental.
I did not know what to name it, so I just used "Simutrans-Experimental", hope that is fine?

edit:
The branch that I have currently made stuff in is called "Signal-info-window" and is found here: https://github.com/VictorErik/Simutrans-Experimental/commits/Signal-info-window

As to the signal windows, you think "station signal" should be renamed "directional signal"?
It could actually be cool to also write wether the signal is able to create directional reservations (ie signals with longblock and other doubble faced signals). Can one check wether two signals is on the same tile?

Ves

It seems you found my branch!

I have question:
I would like to show the maximum speed a signal can be passed (the same number that is shown in the tooltip). But whenever I use get_max_speed(), It shows an extremely high number that doesnt seem to correlate with the speed. How am I supposed to find the max speed of a signal?

jamespetts

Thank you very much for this work, and apologies for the delay in replying/looking into integrating the code: I have been really rather busy with work/going to Paris/upgrading to Visual Studio 2015/profiling/optimising in the last few days.

However, to answer your latest question, speed in the game is stored in internal units. To convert to km/h, use the (global) speed_to_kmh() method.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Thank you, it is now working!

You can pull from the "Signal-info-window"-branch on my github. Have a look and see if you like it! :)

jamespetts

I have tried to merge this, but I am afraid that it caused some very odd problems: I was not able to load saved games at all as the directory appeared to be empty. Looking at the merge history, there appears to be some very odd rebasing or something similar happening, with your branch ultimately being based on the master rather than the devel-new-2 branch, which seems to be at least in part what is causing the trouble, although it is hard to tell, as, because of that oddness, I cannot clearly see each commit.

Also, the base_texts_experimental-passenger-generation.dat file has not been updated with the new translation texts.

However, if those two issues can be fixed, this looks like a very worthwhile patch, as the actual display of text in the signal information window seems quite useful.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

#14
I was messing around with github when I could not get it to work, and also since I still cannot compile the latest version due to the reasons given in the other thread. I accidentally pressed merge from master, but it looks like nothing did actually change with that. Also I have tried to revert that and so on. Maybe it is just easier if I create a completely new branch and put it all there...

edit:
I made some new experiments with github and have organized it in a completely new way (the way I suppose it is meant to be organized), and there should now be a new clean version of the commit. Also, the translation texts are added as you wanted.
I have not tried it though, due to the compiling issues...

Ves

Now there should be a fully working version on the Github, you can pull it James and check it out.
Be aware, that due to certain Github "inagreements", it is the branch "signal-in-infowindow-2" that contains the correct version and can be found here:
https://github.com/VictorErik/Simutrans-Experimental-Ves/tree/signal-in-infowindow-2

I was thinking about creating a button next to the signal box name, to make the world center above the signal box, much like factory suppliers do. Would you approve such a change (if I can get it to work)?

Junna

Quote from: Ves on October 04, 2016, 10:24:34 PM
I was thinking about creating a button next to the signal box name, to make the world center above the signal box, much like factory suppliers do. Would you approve such a change (if I can get it to work)?

That would be very useful.

jamespetts

#17
Thank you - I will have to look at that when I get a chance. That is most appreciated. Such a button, if you can make it work, would certainly be a good idea - thank you for that suggestion.

Edit: I have now incorporated this. It works very well - thank you.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Vladki

Info about signals is really good  :thumbsup:
I like also the plan to add "hyperlink" to signalbox.

Ves


Ves


jamespetts

Thank you very much for that. You will need to add, not just the translator::translate call and translation, however, but the .dat file reference for when this is uploaded to Simutranslator.

Edit: Testing this, it works splendidly, except that the tooltip appears not to be translated (it reads "goto_signalbox" instead of "Go to signalbox").
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

How typical! I did in fact change that dat file and commit it, however I must have forgotten to push it that last time as I was pushing many "last times"....
Will look into it tonight!

jamespetts

Also, this seems to generate a compile error in GCC (under Linux):

build/default/obj/signal.o: In function `signal_t::show_info()':
signal.cc:(.text+0x1d): undefined reference to `signal_info_t::signal_info_t(signal_t*)'
collect2: error: ld returned 1 exit status
common.mk:21: recipe for target 'simutrans/simutrans-experimental' failed
make: *** [simutrans/simutrans-experimental] Error 1
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Rollmaterial

Many thanks for this very helpful feature! If I might make a suggestion in relation to this, a feature that highlights the selected signalbox and its signals would be totally worth it in my opinion.

Ves

Now I have fixed the translation! I had forgot the last commit as well as forgotten the translate::translate section. Try again now, it should work!

Quote from: jamespetts on October 27, 2016, 12:23:35 PM
Also, this seems to generate a compile error in GCC (under Linux):

build/default/obj/signal.o: In function `signal_t::show_info()':
signal.cc:(.text+0x1d): undefined reference to `signal_info_t::signal_info_t(signal_t*)'
collect2: error: ld returned 1 exit status
common.mk:21: recipe for target 'simutrans/simutrans-experimental' failed
make: *** [simutrans/simutrans-experimental] Error 1


I am really sorry James, but I think I do not understand enough to resolve that. The only text I have added is the tooltip "goto_signalbox". I have collected pieces of the code from around the code. It should behave similar as to "trafficlight_info_t" and "privatesign_info_t".

Quote from: Rollmaterial on October 27, 2016, 03:22:47 PM
Many thanks for this very helpful feature! If I might make a suggestion in relation to this, a feature that highlights the selected signalbox and its signals would be totally worth it in my opinion.
Thanks! However, that is WAY above my skill level! Currently, I know only how to edit info windows and (in some occations) how to add a button to it  ;D

jamespetts

Ahh, no, the compile error is not about the text, but it is claiming that it cannot find the definition of the signal_info_t constructor that takes a pointer to a signal_t object as a parameter. It is actually a rather serious error, as this cannot currently be complied on Linux at all. I had a brief look, but could not immediately find a solution. I am afraid that this feature will have to be reverted if a fix cannot be found to this, as the code cannot be in a state where it cannot be compiled on Linux (or, indeed, anything else that uses GCC, such as Mac).
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I have spent some time now starring at the compiler and comparing it with privatesign_info_t and trafficlight_info_t, without anything that appears to be out of order.
To be clear, am I right that the problem is with signal_t and not the signal_info_t? That it is signal_t that cannot "find" signal_info_t?

jamespetts

#28
That is what appears to be the trouble. I have trouble finding exactly what the problem is, too: it is rather cryptic.

Edit: I have made some attempts to fix this, pushed to the devel-new-2 branch, but without success. It may be helpful to ask the Standard developers for assistance with this.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

On my phone now so cant check if this is what you did, but could it be something with the project file that the gcc compilers use (if it uses differently from windows)? Have have only modified the windows project file. I would not know how to successfully modify any of the other files.

Milko

Hello

I have similar problem compiling using MingW.

Giuseppe

jamespetts

Ves - that is the problem - you did not add signal_info.cc to the makefile: for every new .cc file, you need to add a line "SOURCES += [filename]" to the makefile. I have fixed this now and it compiles. Thank you very much.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I'm glad it worked! Had no idea about that, I will keep that in memory for the future! Thanks!

Ves

When testing some Swedish signal layouts, I found it really frustrating not knowing how far away the signal was from the signal box, and therefore how further out I could place signals. I dont know if this is information other people would want, but I could not help my self but find a way to code it.
The info window of a signal shows the distance to its signalbox (if connected) as well as max possible distance. If the distance is specified to zero in the dat-file, "infinite range" will show up on the range part. Similar for signal boxes. Also, I experimented with decimals. 0-999m is specified in meters, 1-19,9km is with one decimal and 20 and above is without any decimals, for easier reading.



I do however get an out of bounds crash quite rapidly when using a big brittish savegame, something about koord3d, and I have a pretty sure guess on where the faulty code is, I just dont know how to troubbleshoot it. I get many errors when I try to compile a debug build. If you are interrested in incorporating it, would you like to take a look at the out of bounds issue?

It is live on this branch: https://github.com/VictorErik/Simutrans-Experimental-Ves/tree/signal-in-infowindow-2

Incidently, James, do you think it is needed to show three coordinates for the signalbox in the signals info window? Is two not enough (x and y)?

jamespetts

Thank you very much for this: I will look into trying to fix this issue when I have the time. As to the necessity to have three co-ordinates, this is probably desirable, as it is possible to build signalboxes underground.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.