The International Simutrans Forum

Simutrans Extended => Patches/pull requests for consideration => Simutrans-Extended development => Incorporated patches/merged pull requests => Topic started by: anoKTOK on May 07, 2020, 01:00:08 PM

Title: [patch]vehicles show line name or convoy name
Post by: anoKTOK on May 07, 2020, 01:00:08 PM
This is a patch of soukouki and anoKTOK.

Overview:
Vehicles show line name or convoy name.

Source code:
https://github.com/anoKTOK/simutrans-extended-building-extension/tree/vehicles_show_line_name_or_convoi_name (https://github.com/anoKTOK/simutrans-extended-building-extension/tree/vehicles_show_line_name_or_convoi_name)
Remark. This source is based on the latest version (2020/ May / 07).


How to use:
(https://simutrans-germany.com/files/upload/20200507_sou_patch4.png)
(1) Open Option.
(2) Select Display.
(3) Choose "line name tooltips" where we often choose "convoi error tooltips", "convoi mouseover tooltips" and "all convoi tooltips".

Behavior:
If a vehicle have a line name, the vehicle shows the line name.
Otherwise, the vehicle shows the convoy name.

Example:
(https://simutrans-germany.com/files/upload/20200507_sou_patch2.PNG)
This is a picture near Nagasaki station.

tab:
line name tooltips
Title: Re: [patch]vehicles show line name or convoy name
Post by: Vladki on May 07, 2020, 06:39:05 PM
Wow, that's cool ;)
Title: Re: [patch]vehicles show line name or convoy name
Post by: Mariculous on May 07, 2020, 07:56:33 PM
Indeed a nice one :)
I'll always know immediately if that tram was intended to run on the mainline or just did a stupid detour because I messed up the route :D
Title: Re: [patch]vehicles show line name or convoy name
Post by: prissi on May 08, 2020, 03:08:25 PM
Was a very good idea, now in r9077 in standard too. (Since I could not easily find the diff, I just wrote it myself.)
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on May 09, 2020, 12:07:10 AM
I think it's a very good idea. Otsukare thanks.  :)
IMO, some improvements will make it even better.


1) Separate from the convoy status message and assign a dedicated shortcut key. Because it's different genre information than displaying convoy alerts.
I don't think it is a good idea to hide the anomalous status with this display. Not suitable for constant display.

And while this display is convenient, at the same time it tends to be very annoying, so it is preferable that it can be easily turned on and off. However, it is troublesome to switch if it is in an unrelated cycle. It would be convenient to be able to separate and turn on and off only that.


2) Add an option to show it only when the mouse is over.
As mentioned above, this display can be very annoying, so if it has such option, I would prefer to use that option during usual.


3) Avoid confusion with station name displays.
The station name can switch between multiple display styles, but this is not possible. Therefore, if the station display is a square box with a player color background, it is difficult to distinguish it from that. (I usually use that style.)

I had some ideas; adding a waytype symbol to the name, adding a status bar to make it look different from the station etc
For the time being, I try to avoid conflict with the station display by making white letters on a dark background.

4) Make a distinction between line name and convoy name. I tried changing the background color slightly, but it may be difficult to understand. The background color of lineless convoy is a little dark.


I made a version with these improvements.
(https://i.imgur.com/Vrkog1S.gif)


The repository is here
https://github.com/Ranran-the-JuicyPork/simutrans-extended/tree/independent-convoy-nameplate



# TOOL_CONVOY_NAMEPLATES=133
simple_tool[133]=,0

We can assign its shortcut key in menuconf.tab. In the example, it is assigned to the "0" key. Well this is a pakset task. In Britain-EX, the key of the convoy status tooltip is assigned to shift + 7, so a key close to this is preferable.



Future improvement idea:
Added a symbol for whether it is a reverse route on it. For example, an up arrow and a down arrow. ↩ ↦




Aside from that, your original code does not correctly correspond to key assignments. If you implement it with the original specifications, you will need to modify it by referring to the prissi's code.
Title: Re: [patch]vehicles show line name or convoy name
Post by: anoKTOK on May 09, 2020, 07:15:20 AM
Quote from: prissi on May 08, 2020, 03:08:25 PM
Was a very good idea, now in r9077 in standard too. (Since I could not easily find the diff, I just wrote it myself.)

Thank you very much for adding this patch!


Quote from: Ranran on May 09, 2020, 12:07:10 AM
IMO, some improvements will make it even better.


1) Separate from the convoy status message and assign a dedicated shortcut key. Because it's different genre information than displaying convoy alerts.
I don't think it is a good idea to hide the anomalous status with this display. Not suitable for constant display.

And while this display is convenient, at the same time it tends to be very annoying, so it is preferable that it can be easily turned on and off. However, it is troublesome to switch if it is in an unrelated cycle. It would be convenient to be able to separate and turn on and off only that.


2) Add an option to show it only when the mouse is over.
As mentioned above, this display can be very annoying, so if it has such option, I would prefer to use that option during usual.


3) Avoid confusion with station name displays.
The station name can switch between multiple display styles, but this is not possible. Therefore, if the station display is a square box with a player color background, it is difficult to distinguish it from that. (I usually use that style.)

I had some ideas; adding a waytype symbol to the name, adding a status bar to make it look different from the station etc
For the time being, I try to avoid conflict with the station display by making white letters on a dark background.

4) Make a distinction between line name and convoy name. I tried changing the background color slightly, but it may be difficult to understand. The background color of lineless convoy is a little dark.

Thank you for advising. Arigato thanks.  :)
I played with your patch. I think it is more useful.


Quote from: Ranran on May 09, 2020, 12:07:10 AM
Future improvement idea:
Added a symbol for whether it is a reverse route on it. For example, an up arrow and a down arrow. ↩ ↦

Certainly, it may be easier to see.
Title: Re: [patch]vehicles show line name or convoy name
Post by: jamespetts on May 16, 2020, 03:50:58 PM
Thank you all for your work on this: this looks very good. I have been testing Ranran's version of this. One or two small things need addressing before being incorporated.

First of all, the text "mouseover convoy nameplates" is too large to fit in the space between the horizontal scroll bars in the display settings dialogue. Secondly, even if I widen the dialogue, the rightmost horizontal scroll bar element remains in place, unlike that of the "Mouse-over convoy tooltips" selector, which dynamically moves to the right. Finally, I wonder whether it might be possible to set up a shortcut key for this? I am not immediately clear on whether this has been done or at least all but alteration of menuconf.tab done. In Pak128.Britain-Ex, the SHIFT+I key combination is currently free.

Apart from those small things, this does seem to be a very good enhancement: thank you all for your work on this.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on May 16, 2020, 11:00:02 PM
I reply only two point first.
QuoteFirst of all, the text "mouseover convoy nameplates" is too large to fit in the space between the horizontal scroll bars in the display settings dialogue.
I expected to solve this using translated text.
Because I'm not an English native speaker I can't come up with a better short word. Is that possible?


QuoteFinally, I wonder whether it might be possible to set up a shortcut key for this? I am not immediately clear on whether this has been done or at least all but alteration of menuconf.tab done. In Pak128.Britain-Ex, the SHIFT+I key combination is currently free.
As far as I tested it worked with 0 key. But I'll check it again.
Title: Re: [patch]vehicles show line name or convoy name
Post by: jamespetts on May 16, 2020, 11:10:51 PM
For the translation text, you might simply replace "nameplate" with "names", which should shorten it somewhat. I also suggest that the first letter of the first word of the text be a capital letter to match the others.

As to the shortcut key, I cannot get this to work; but do I need to download a modified menuconf.tab for this? Incidentally, merging this into the latest master caused merge conflicts in ja.tab again which you may need to resolve by re-instating the deleted part.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on May 16, 2020, 11:21:53 PM
Quotebut do I need to download a modified menuconf.tab for this?
Yes, you need to edit britain-ex manuconf as menuconf is pakset specific.

please left Japanese.tab as is. I think many fixes are needed, so I'll pull request the fixes in bulk later. :done:

EDIT:
I attached the edited menuconf.tab. It is set to Shift + I.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on May 17, 2020, 12:29:56 AM
Thank you for your advice. Now I think I have solved those issues.
- Right arrow left behind, and "nameplate" text is too long.

Please confirm.

Shortcut key seems to work for me. Test using the menuconf.tab attached to the previous post.
You have to press the key three times to cycle through the display.

EDIT:
Merged and tested to resolve conflict issues involving translations. Note that the save version is incremented. (You can't open a saved game that you've already saved a nameplate build with the old revision number(21). It only happens if you build and test your own)
I redone the pull request, please confirm:
https://github.com/jamespetts/simutrans-extended/pull/167
Also for pakset:
https://github.com/jamespetts/simutrans-pak128.britain/pull/88
Title: Re: [patch]vehicles show line name or convoy name
Post by: jamespetts on May 17, 2020, 11:57:45 AM
Thank you very much for this - this is now confirmed working. I have merged and incorporated this and updated the English translation texts.

Unfortunately, there were still merge conflicts in the Japanese translation texts - I tried to resolve these as best as I could, but you may want to check this.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on May 17, 2020, 12:04:06 PM
Quote from: jamespetts on May 17, 2020, 11:57:45 AMUnfortunately, there were still merge conflicts in the Japanese translation texts - I tried to resolve these as best as I could, but you may want to check this.
That is odd.
Did you check this branch?
https://github.com/Ranran-the-JuicyPork/simutrans-extended/tree/show-line-nameplate-with-resolved-conflicts
Title: Re: [patch]vehicles show line name or convoy name
Post by: jamespetts on May 18, 2020, 12:20:18 AM
Yes, it was the resolved conflicts one that I used.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on May 18, 2020, 01:11:45 AM
If you cannot find any problem other than ja.tab with that patch, please discard the changes of ja.tab. I will check and fix it later.

EDIT:
I checked and fixed it again so I think now the ja.tab conflict is resolved. please check pull request #168.
Title: Re: [patch]vehicles show line name or convoy name
Post by: jamespetts on May 18, 2020, 11:08:35 AM
Now incorporated - thank you.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on June 16, 2020, 09:46:06 AM
I have pull-requested a Dwachs fix for a tooltip location issue. Please check pull request #197.

However, airplanes behave strangely on slopes, but might phystam know something about this?
Title: Re: [patch]vehicles show line name or convoy name
Post by: jamespetts on June 16, 2020, 10:40:36 AM
Thank you - now incorporated.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Vladki on June 16, 2020, 12:22:33 PM
Quote from: jamespetts on June 16, 2020, 10:40:36 AM
Thank you - now incorporated.

Ah accidentally we both backported the same fix... https://github.com/jamespetts/simutrans-extended/pull/151
So maybe there were some conficts trying to merge both
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on June 16, 2020, 01:36:16 PM
Quote from: Vladki on June 16, 2020, 12:22:33 PMSo maybe there were some conficts trying to merge both
It's a simple two line fix though.

As I pointed out in that thread, it's not just a convoy line name tooltip issue.
The same applies to station name plates and alert tooltips. Did you try to fix it individually?
All you need to do is fix the original issue and it should be cured.

And the code in that part was completely the same as standard.

Issues not fixed by this, such as airplane tooltips, are likely to be other issues.
Title: Re: [patch]vehicles show line name or convoy name
Post by: jamespetts on June 16, 2020, 01:41:11 PM
The merge conflict was easy to resolve and has now been resolved - thank you both for your work on this.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on June 16, 2020, 01:49:27 PM
I apologize for not confirming. (´・ω・`)
The issue with airplane tooltips seems to be a standard's issue.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Vladki on June 16, 2020, 02:02:14 PM
Quote from: Ranran on June 16, 2020, 01:36:16 PMThe same applies to station name plates and alert tooltips. Did you try to fix it individually?
Station names were fixed too by the original patch.
Title: Re: [patch]vehicles show line name or convoy name
Post by: Ranran(retired) on June 17, 2020, 04:02:52 PM
In void air_vehicle_t::display_overlay(int xpos_org, int ypos_org) const,



vehicle_t::display_overlay(xpos_org, ypos_org - tile_raster_scale_y(current_flughohe - get_hoff() - 2, raster_width));

I think this is the reason why the tooltip display of the airplane is incorrect.
I haven't checked if the standard code is the same, but the behavior in the game looks the same.
Title: Re: [patch]vehicles show line name or convoy name
Post by: prissi on June 18, 2020, 02:26:46 AM
Since airplanes cannot handle slopes it should be save to remove this.