Speed info tab in the vehicle window

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
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Speed info tab in the vehicle window

Post by MagicBuzz »

May be you already got the issue that is really anoying myself...

Some trains sets use speed limit for wagons, and it's great. But when the vehicle is built, you know its global speed limit, but you can't figure out which wagons or engines are responsible of this limit.

So I just designed a very small patch in order to add a new tab in the vehicle info, to see the actual vehicle speed limit for each element of the train.

It remains just a small problem : The buttons are smaller now, so the labels should not fit with all languages.

Flyspray http://bugs.openttd.org/task/1199

PS : don't care about the strange composition of the train on the pictures, it was just a test with several combination of locos and wagons ;)

History :
r11050 : Update - Vehicule GUI unification made this patch totally obsolete, then I have to rewrite it. Thus, button resizing is fixed.
r11051 : Fix - With the r11050 I added 3 blank panels after the speed button in order to get correct resizing. Thank to skidd13 who suggested me a easy way to get rid of these 3 new panels.

I think it's now ready for trunk as this now.
Attachments
The panel when the wagons speed limit feature is enabled.
The panel when the wagons speed limit feature is enabled.
speed_info_wagon_limits.png (6.33 KiB) Viewed 8037 times
The panel when the wagons speed limit feature is disabled.
The panel when the wagons speed limit feature is disabled.
speed_info_wagon_no_limits.png (6.1 KiB) Viewed 8038 times
speed_info_r11051.patch
r11051
(12.37 KiB) Downloaded 201 times
Last edited by MagicBuzz on 07 Sep 2007 16:23, edited 4 times in total.
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Speed info tab in the vehicle window

Post by athanasios »

That's very practical. Thanks.
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Speed info tab in the vehicle window

Post by PhilSophus »

Nice patch.

One small suggestion: Could you align the speed in one column, please (maybe by making them right-justified). It would be easier to capture the information in one glance then.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

I already thought about this, but I have a small issue with this : the vehicle picture is drawed line by line at the same time that the text.
So I can't know the actual size of the larger picture when drawing the string.

This patch might work fine with most sets, but could look weird with GRFs that use very long vehicles.
Attachments
speed_info_r11044_aligned.patch
r11044 with right alignement
(5.1 KiB) Downloaded 188 times
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Speed info tab in the vehicle window

Post by PhilSophus »

MagicBuzz wrote:So I can't know the actual size of the larger picture when drawing the string.
That's why I suggested just using right justification.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

PhilSophus wrote:
MagicBuzz wrote:So I can't know the actual size of the larger picture when drawing the string.
That's why I suggested just using right justification.
that's what i did.

the text was just set right after the picture. so when the picture was 20px width or 200px width, that was not a problème, the text was just displaying fine, just beside the picture.

with right align, i must decide to align evey line to the same value. i choosed 100px.

for normal GRFs that will be ok. but for vehicules with large pictures, 100px won't be enought.

if i set 120px by exemple, to get rid of this problem, it will look weird with normal GRFs as the text will be too far :)

another solution should be writing the text first, then drawing the picture after. but it won't be nice and need to rewrite a big part of the display function.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Speed info tab in the vehicle window

Post by chrissicom »

Hmpf seen this patch a minute too late, just posted a new ChrisIN :) I like the idea of this patch, definitely give it a look!
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

When I presented this patch to a friend on another forum, he just said something that I think is interresting : in TTDP, while a wagon speed limit is X, it can run at speed Y when it's empty.

According to this topic, it's Y = X + 20 kmph
http://www.tt-forums.net/viewtopic.php?p=374957#p374957

At first, I thought this was not a good think, and sounded quite unrealistic to me.

So I decided to ask some rail professional workers, so here is their reply : (french)
http://forum.hardware.fr/forum2.php?con ... #t12602236

Mostly this sentence :
Effectivement, sur chaque wagons, un cartouche des charges, te donne les aptitudes du wagons en fonction de la charge, et la charge maximale admise suivant la catégorie de ligne.
Yes, on every wagon, there is a weight signal, that gives its different abilities according the charge, and the maximal charge admitted according the track category.
As a result, yes, an wagon can run at different speeds when fully loaded or empty.

So, I could try do add this feature (or does it already exist ??), then update this patch according this feature.

What do you think about it ?
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

Small update according some suggestions and asked changes on Flyspray.

Here are the corrections:
- Used space rather than tabs in english.txt
- Added a new button line in order to keep original size for the original buttons
- Used an enum TLW_* (for Train List Widgets) to name the widgets in the code instead of "magic numbers"

Still a minor bug:
- The original buttons are resized when resizing the window. Mine doesn't, and I can't understand why...
Attachments
speed_info_r11046_aligned_newline.patch
r11046
(7.55 KiB) Downloaded 172 times
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Speed info tab in the vehicle window

Post by chrissicom »

So, I could try do add this feature (or does it already exist ??), then update this patch according this feature.

What do you think about it ?
This doesn't seem to work properly in the game anyway. I am using DB Set XL all the time and there are some passenger waggons for local traffic which have a limit of 140 km/h and those for interrail have 160 km/h. But when I use any of these waggons on a 200 km/h passenger locomotive the train will go by 200 km/h no matter if loaded or unloaded so the waggon speed limit seems to be totally irrellevant. I think this might be a .grf problem as well though because afaik it doesn't happen when putting an 80 km/h coal waggon on a 120 km/h train (then the speed is limited to 80 km/h).
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

Well strange :)

Thus, another answer on the same forum :
http://forum.hardware.fr/forum2.php?con ... #t12605102

It just says the opposite : a wagon speed limit applies when the wagon is empty as well. (grmpf)
And I just trust this guy, as he is a fret train conductor for the french company SNCF...
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Speed info tab in the vehicle window

Post by PhilSophus »

chrissicom wrote:But when I use any of these waggons on a 200 km/h passenger locomotive the train will go by 200 km/h no matter if loaded or unloaded so the waggon speed limit seems to be totally irrellevant.
If this is one of the locomotives that also changes the look of the waggons (like TEE or ICE, in your case probably the TEE) than it is probably okay as they are than turned into special waggons for just this kind of locomotive. Some S-Bahn-like locomotives also change the (un)loading speed.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

PhilSophus wrote:
chrissicom wrote:But when I use any of these waggons on a 200 km/h passenger locomotive the train will go by 200 km/h no matter if loaded or unloaded so the waggon speed limit seems to be totally irrellevant.
If this is one of the locomotives that also changes the look of the waggons (like TEE or ICE, in your case probably the TEE) than it is probably okay as they are than turned into special waggons for just this kind of locomotive. Some S-Bahn-like locomotives also change the (un)loading speed.
Damn !
Thank you, you just explained me why I had to add the "!UseOverride(v)" test in my patch in order to get the actual speed :mrgreen:
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

Well...
I was trying to update the patch with a complete enumeration (I only updated the controls that were used in the code), but I just face to a problem I can't solve myself:

With the r11050, the vehicle detail window has been unified between all types of vehicles.
But the "Speed" tab will apply only for trains, then I don't know what to do...

I don't know how to hide/unhide some controls in a windows dynamically (for any vehicle but trains, the new line with the "speed" button shouldn't be displayed).
And I don't think that creating a new window definition especialy for the trains is a good idea.

Could someone help me ?
nycom
Engineer
Engineer
Posts: 62
Joined: 14 Nov 2005 13:14
Location: Paris, France

Re: Speed info tab in the vehicle window

Post by nycom »

Hello,

Add (VLD_WIDGET_DETAILS_SPEED) and (VLD_WIDGET_BOTTOM_RIGHT2) before VLD_RESIZE to "enum VehicleDetailsWindowWidgets {"

In the "CreateVehicleDetailsWindow" function, replace w->height += 12 by w->height +=24.
In the "DrawVehicleDetailsWindow" function , add (VLD_WIDGET_DETAILS_SPEED) and (VLD_WIDGET_BOTTOM_RIGHT2) to "SetWindowWidgetsHiddenState(w, v->type != VEH_TRAIN, ..." and "SetWindowWidgetsDisabledState(w, false,..."
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

Thank you, I'll try this !
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

I just updated the patch with unified gui r11050.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Speed info tab in the vehicle window

Post by MagicBuzz »

Small update to r11051.

Thanks to skidd13 who helped me to get rid of the 3 panels I added with the last version in order to get correct resizing buttons.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Speed info tab in the vehicle window

Post by chrissicom »

Is it really necessary to add

Code: Select all

/** Constants of vehicle details widget indices */
enum VehicleDetailsWindowWidgets {
...
to vehicle_gui.h ? It's a duplication of code.
User avatar
Maedhros
OpenTTD Developer
OpenTTD Developer
Posts: 603
Joined: 30 Mar 2006 18:24
Location: Durham, UK

Re: Speed info tab in the vehicle window

Post by Maedhros »

Is another tab really needed for this? Why not add the speed to the end of the text in the "Information" tab?
No-one's more important than the earthworm.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 19 guests