This turned out to be due to continue to drag the old vehicle, that autoreplace sold
This could also be triggered if more than one player used the same company
Now deleting a vehicle will remove all depot highlights of that vehicle
to allow clicking if a button was disabled. This has been superseded in r212 with
general code that doesn't allow any click events for disabled buttons.
WWT_IMGBTN must contain an image for drawing. Renamed WWT_PANEL_2 to WWT_IMGBTN_2
because that is what it is. Added WWT_PUSHBTN that is either just a pushable button,
or a textbutton, which text's drawn dynamically independent of widget.
to MB for the initial design and skidd13 for the iconified version(s).
-Codechange: Change the autorenew sprites from recycle to upgrade (skidd13)
-Codechange: Change the shared orders icon (MeusH)
-Add missing table/files.h file to VS project file.
Nobody had problems so far, so we can assume that InvalidateWindowData() is used everywhere where it's needed
The check is just disabled, not deleted so it's quick to reenable if we change some code and wants to check this again
This should not be a big slowdown as it's only called each time the list is generated and will normally be much faster than the list generation itself (only a small % of the total number of vehicles is in the depot)
This gives the ability to invalidate some window data and recalculate as needed instead of doing it for each WE_PAINT
This event is called right away when using InvalidateWindowData(), so it may be a good idea to set a bool or similar in the window
or similar and then act on that bool in WE_PAINT instead of doing a lot of stuff in WE_INVALIDATE_DATA as it might be called more than once before WE_PAINT is called
InvalidateWindowData() will not automatically repaint the window, so if you want to repaint it as well, you need to mark it dirty as well.
Made the depot windows use WE_INVALIDATE_DATA to set when to generate the engine and wagon lists instead of at each redraw
It makes no sense to regenerate the list when say using the scrollbar if we know that no vehicle have entered or left the list
NOTE: currently there is a piece of code to generate the list when it's not needed and compare it to the stored list and assert if they mismatch
This check is somewhat slow and kills the whole idea of WE_INVALIDATE_DATA, so it's a short lived one to verify that InvalidateWindowData() is used everywhere where it's needed
Also changed the sprites on some of the other buttons to make the buttons consistent
Credits for this:
Drawing: skidd13 (first sprite copied/heavily inspired by Bot_40)
Grfencoding: peter1138
Coding to apply the new sprites: peter1138 (modified by me)
Ideas:
Born Acorn
MeusH
ValHallA|SW
XeryusTC
Sorry if I forgot to mention somebody
This is a request from translators as depot is not valid for all vehicle types in all translations
This will cause a lot of warnings when generating the lang files. MiHaMiX will fix them in a moment (hopefully)
It got one known issue though. The top bar got a plural issue so expect to see stuff like "1 trains" until we figure out why it behaves this way
Added the button to the depot windows. Made the autoreplace button bigger while I was moving some widgets anyway
Made road vehicle depot windows start with one more row to make room for the buttons
It made no sense to maintain 8 nearly identically arrays when a single one can do the job
Also made the two buttons always use half of the bottom width each, even when resizing
It's right below the sell button (sell whole chain button for trains)
It's still missing a sprite. That one will be added as soon as anybody draws something we can use
To make room for this button, all depots except train depots now opens with an additional row and can't be resized shorter than that
Really bad stuff will happen if one of them contains a different number of widgets ;)
This is meant as a protection against incorrect additions of code rather than verifying that the current code works
This will ensure that say the horizontal scrollbar is as wide as the matrix even if only the matrix is altered in size
This is meant to make it easier to add more widgets without coding a lot of vehicle type specific stuff (you should still check all windows though)
This means that "Build vehicle", "Clone vehicle" and "Location" will always fill the space from the left window border to the resize button and they are equal in size
The sell button will also use all the space between the start/stop buttons and the resize button and for trains, the sell button is split into two buttons in equal sizes
This will prevent the issue where a small window is resized into a large one and the buttons remains pretty small
-Codechange: [depot window] The enum with widget names is now changed into automatic numbering so all lines will not have to be changed each time a new widget is added
This change is intended to make it easier to make depot behaviour consistent
and faster to code when adding more features in the future
The user interface should hopefully not be affected by this