Commit Graph

203 Commits

Author SHA1 Message Date
Peter Nelson 2a0365b3d9 Cleanup: Remove unnecessary parameter of GetScrolledRowFromWidget()
Line height defaults to the resize height of the relevant widget, which is
set in all cases. Therefore it is not necessary to specify this value every time.

Additionally fixes scrolled padding for the framerate window.
2021-04-21 23:12:10 +02:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Patric Stout 62cdadb582 Change: move "give money" from client-list to company window
This is a much better location for this button, as you send
money from one company to another company, not from player
to player.

This is based on work done by JGRPP in:
f820543391
and surrounding commits, which took the work from estys:
https://www.tt-forums.net/viewtopic.php?p=1183311#p1183311

We did modify it to fix several bugs and clean up the code while
here anyway.

The callback was removed, as it meant a modified client could
prevent anyone from seeing money was transfered. The message
is now generated in the command itself, making that impossible.
2021-01-05 21:56:24 +01:00
Patric Stout d6e15d4943 Fix: make the "password" button the same size as the other buttons in Company window
Currently password-lock icon + button was the same size, but this
looks really weird. Now they are in sync, even with other fonts
and languages.
2021-01-05 21:56:24 +01:00
Patric Stout a3f0ee3b63 Codechange: fix alignment of Company GUI
Code acted as if WWT_TEXT starts a scope; it does not.
2021-01-05 21:56:24 +01:00
Patric Stout fc474b02fa Fix: change all Company planes on paint, not only the first that needs changing
Otherwise it can take a few OnPaint() calls before all planes are
set correctly when switching companies.
2021-01-05 21:56:24 +01:00
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 2020-12-27 10:55:42 +00:00
TechGeekNZ a10013dd00 Codechange: Spell 'Viewport' consistently
Some places in the codebase misspell 'Viewport' as 'ViewPort' or 'view_port'.
This patch makes everything consistent.
2020-07-27 17:31:29 +01:00
stormcone 816fada2b1
Fix #8250: [NRT] Company infrastructure window always omits last road/tramtype 2020-07-02 12:35:28 +02:00
Jonathan G Rennison c167648d75 Fix: Violation of strict weak ordering in group name sorters
This could be caused by a group being renamed, and the old
name being cached from a previous sort.

See: #7838
2020-06-18 12:38:43 +02:00
glx 4ae829cb27 Codechange: Replace FOR_ALL_GROUPS with range-based for loops 2019-12-21 20:13:03 +01:00
glx 1f6b3a37f9 Codechange: Replace FOR_ALL_ENGINES with range-based for loops 2019-12-21 20:13:03 +01:00
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 2019-05-01 21:36:27 +02:00
Niels Martin Hansen 08284e005d Fix: Automatic line breaking of the warning 2019-04-24 17:40:11 +02:00
glx 2db88953e7 Codechange: use std::sort() in GUIList 2019-04-13 12:49:18 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Michael Lutz c7b9987d08 Codechange: Switch DropDownList to directly use std::vector, thus making AutoDeleteSmallVector obsolete.
DropDownListItem are strongly managed using std::unique_ptr to ensure leak-free handling. Appropriate use
of move-semantics make intent a lot clearer than parameter comments and allows the compiler to generate
copy-free code for most situations.
2019-04-09 22:45:15 +02:00
glx22 66dd7c3879
Fix: MSVC warnings (#7423) 2019-03-28 00:09:33 +01:00
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 2019-03-26 20:15:57 +00:00
Henry Wilson 9cba6f7193 Codechange: Replaced SmallVector::Compact() with std::vector::shrink_to_fit() 2019-03-26 20:15:57 +00:00
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 2019-03-26 20:15:57 +00:00
peter1138 317f69c152 Codechange: Use override specifier in Window-derived classes. 2019-03-24 16:10:04 +01:00
peter1138 aafce47596 Codechange: Use override specifier for DropDownListItem classes. 2019-03-24 16:10:04 +01:00
Patric Stout e3c639a09f Remove: ENABLE_NETWORK switch
This switch has been a pain for years. Often disabling broke
compilation, as no developer compiles OpenTTD without, neither do
any of our official binaries.

Additionaly, it has grown so hugely in our codebase, that it
clearly shows that the current solution was a poor one. 350+
instances of "#ifdef ENABLE_NETWORK" were in the code, of which
only ~30 in the networking code itself. The rest were all around
the code to do the right thing, from GUI to NewGRF.

A more proper solution would be to stub all the functions, and
make sure the rest of the code can simply assume network is
available. This was also partially done, and most variables were
correct if networking was disabled. Despite that, often the #ifdefs
were still used.

With the recent removal of DOS, there is also no platform anymore
which we support where networking isn't working out-of-the-box.

All in all, it is time to remove the ENABLE_NETWORK switch. No
replacement is planned, but if you feel we really need this option,
we welcome any Pull Request which implements this in a way that
doesn't crawl through the code like this diff shows we used to.
2019-03-20 19:24:55 +01:00
peter1138 fb35cb5ed2 Remove: Unnecessary virtual destructors on drop down list items. 2019-03-10 09:20:11 +00:00
peter1138 811bf22620 Codechange: Use Colours type instead of byte. 2019-03-10 09:20:11 +00:00
peter1138 93a6fd42d1 Fix 23960d0f2c: Company livery window shows incorrect groups when opened from group window in multiplayer. 2019-03-03 13:13:35 +01:00
peter1138 7ac17f5ae4 Fix #7281: Unable to select last group in open livery window on group creation. 2019-02-26 11:20:23 +01:00
Peter Nelson c9d801a98d Fix: Make livery window resize properly if GUI scale changes whilst open. 2019-02-02 16:57:47 +00:00
Peter Nelson 9e9d485713 Fix 23960d0f2c: Scrollbar was broken for non-group liveries.
Simplify how list position is determined by using existing functions.
Also rename livery_height -> rows and SetLiveryHeight() -> SetRows(), as height implies pixels.
2019-02-01 13:25:42 +00:00
PeterN 23960d0f2c Feature: Group liveries, and livery window usability enhancements. (#7108)
* Change: Replace checkbox in livery selection window with Default option in drop down selection.

This reduces clutter in the UI and allows for primary/secondary colours to independently follow the default scheme if desired.

* Feature: Add vehicle group liveries.
2019-01-31 14:57:44 +01:00
Peter Nelson 6e5b90f4f7 Change: For consistency, add company name to colour scheme window. 2019-01-27 12:34:49 +01:00
Peter Nelson 256b94a03d Fix: Ignore company colour selection when showing different company's colour scheme. 2019-01-27 12:34:49 +01:00
nikolas fa95af2da8 Codechange: Fix typo in variable name: pices -> pieces (#7033) 2019-01-11 16:08:02 +01:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
frosch a682962719 (svn r27889) -Change: Do not cancel headquarter construction and engine-preview-query when shift-clicking (adf88) 2017-07-11 19:37:10 +00:00
frosch 2d636266f5 (svn r27427) -Fix: Use the NewGRF railtype sorting order in the infrastructure window. 2015-10-30 17:24:30 +00:00
frosch a8080b6256 (svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ScaleGUITrad(). 2015-02-01 20:54:24 +00:00
peter1138 58458c6652 (svn r26935) -Codechange: Fit company colour selection drop down list to UI scale. 2014-09-28 19:19:47 +00:00
peter1138 ea33b69798 (svn r26856) -Codechange: Ensure company face widgets can fit company face. 2014-09-20 09:18:22 +00:00
frosch 2a16c33461 (svn r26527) -Codechange: Rename STR_MAPGEN_RANDOM to STR_FACE_RANDOM 2014-04-27 15:30:53 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
planetmaker 3dd1a6ad2d (svn r26416) -Fix [FS#5947]: Shares button state was not appropriately updated when switching setting or company (frosch) 2014-03-18 20:53:34 +00:00
rubidium 83eeba28b7 (svn r26086) -Codechange: use AutoDeleteSmallVector instead std::list for dropdowns 2013-11-24 14:46:26 +00:00