FS#6415 - Road depot window changes size frequently

Attached to Project: OpenTTD
Opened by Airbus (Airbus) - Monday, 25 January 2016, 17:01 GMT
Last edited by frosch (frosch) - Sunday, 29 May 2016, 12:21 GMT
Type Bug
Category Interface
Status Closed
Assigned To No-one
Operating System Linux
Severity Low
Priority Normal
Reported Version 1.5.3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


In road vehicle depot, if a vehicle with 3 or 4 digit unit number enters the depot, depot window changes cell size, amount of columns and size of the whole window. Because of that, it's possible to miss sixth vehicle in a row, because a 3-digit vehicle just entered. And it's just not beautiful to have a jumping window.

This happens because in depot_gui.cpp default unit length is 2, OnPaint() looks for new unit number length, and if finds one that is not equal to current - changes current and reinits whole drawing.

How about changing this (depot_gui.cpp line 664-665):

if (this->unitnumber_digits != new_unitnumber_digits) {
this->unitnumber_digits = new_unitnumber_digits;

to this:

if (this->unitnumber_digits < new_unitnumber_digits) {
this->unitnumber_digits = new_unitnumber_digits;

This way it will reinit depot window less frequently (max 3 times for every window?), plus there will be no jumping from size to size.
This task depends upon

Closed by  frosch (frosch)
Sunday, 29 May 2016, 12:21 GMT
Reason for closing:  Fixed
Additional comments about closing:  in r27583