Commit Graph

291 Commits (b1718478c853a22481ea756ab0ea2f8b57da47f9)

Author SHA1 Message Date
Charles Pigott 80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 1 year ago
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 1 year ago
PeterN 018f0f63a6
Change: Centre company face in scaled widget. (#10688) 1 year ago
Patric Stout 1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
1 year ago
Peter Nelson 701092003d Fix: DropDownListColourItem didn't provide width nor scale vertical padding. 1 year ago
PeterN 2d3250923c
Fix #10554: Let Scrollbar::SetPosition clamp instead of assert. (#10555) 1 year ago
Rubidium 947a789bf6 Codechange: split large function into smaller steps and simplify logic 1 year ago
rubidium42 6ba55e663e Codechange: do not hide variables with other variables 1 year ago
Rubidium b3b8c3fd2d Codechange: pass the randomizer to use directly to the company face generation 1 year ago
Rubidium 170f37d07f Codechange: silence some potentially uninitialized local variable errors
In these cases technically they are false positives, however dismissing the
alerts when the underlying code may make them true positives does not seem
like the safest solution.
1 year ago
Rubidium 496ec1f012 Fix: use reference and array indexing to prevent suspicious pointer scaling 1 year ago
Tyler Trahan 0d631a6fda Change: Reword Finance window's Net Profit to Profit 2 years ago
Tyler Trahan adf94d7970 Change: Add a Total caption to each category of the finance window 2 years ago
Tyler Trahan bba1a16836 Change: Make Company GUI Bank Balance text white 2 years ago
Peter Nelson 920e588334 Change: Use standard dimensions instead of custom widths. 2 years ago
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2 years ago
Peter Nelson 46a1ab0937 Change: Use Rect when drawing infrastructure window. 2 years ago
Peter Nelson 6f95e04005 Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
2 years ago
Peter Nelson 632464a623 Codechange: Use Rect in DropDownListItem::Draw(). 2 years ago
Peter Nelson eb4ba1991b Change: Use CenterBounds function in more places.
CenterBounds may have a 1 pixel difference so the result is not exactly
the same.
2 years ago
SamuXarick e604b76d18 Fix: List a max of four share owners instead of three
An AI company may have four different share owners, but the company information window is limited to display a max of three. This commit increases that limit.
2 years ago
PeterN d7ceb7efea
Change: Use widget string parameters for face window. (#10046)
The face window previously drew the buttons of face settings itself.
Instead we can provide parameters for each widget and let the widget
system draw the buttons.
2 years ago
Tyler Trahan a4e00c5cb5
Fix #9989: Zero Net Profit is neither negative nor positive (#9991) 2 years ago
Tyler Trahan 41de69c5b7 Feature: Improved Finance window 2 years ago
Rubidium c73f578e8c Codechange: replace magic numbers and C-style arrays with C++-style array for share owners 2 years ago
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 3 years ago
Michael Lutz 58cff7b081 Codechange: Un-bitstuff the remaining on-map commands. 3 years ago
Michael Lutz e08b3abe7f Codechange: Un-bitstuff group and autoreplace commands. 3 years ago
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
3 years ago
Michael Lutz b0990fcff7 Codechange: Make TileIndex a "strong" typedef to give it a distinct type.
This is accomplished by changing it to a single member struct with the
appropriate operator overloads to make it all work with not too much
source modifications.
3 years ago
Michael Lutz a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 3 years ago
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 3 years ago
glx22 994bf19aef Fix f6d5c01: Delay deletion when closing windows 3 years ago
rubidium42 b791ffc6de Fix: do not hide parameter by local variable with the same name 3 years ago
Peter Nelson de81afdf4b Cleanup: Replace FOR_ALL_SORTED_ROADTYPES macro with range iterator. 3 years ago
Peter Nelson 3b3d80c8ef Cleanup: Replace FOR_ALL_SORTED_RAILTYPES macro with range iterator. 3 years ago
Peter Nelson 994ffaa382 Codechange: Use alignment feature in company finances window. 3 years ago
Peter Nelson c361246bec Codechange: Replace face window custom drawing with new widget features. 3 years ago
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.
3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 4 years ago
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.
4 years ago
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.
4 years ago
Patric Stout a3f0ee3b63 Codechange: fix alignment of Company GUI
Code acted as if WWT_TEXT starts a scope; it does not.
4 years ago
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.
4 years ago
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 4 years ago
TechGeekNZ a10013dd00 Codechange: Spell 'Viewport' consistently
Some places in the codebase misspell 'Viewport' as 'ViewPort' or 'view_port'.
This patch makes everything consistent.
4 years ago
stormcone 816fada2b1
Fix #8250: [NRT] Company infrastructure window always omits last road/tramtype 4 years ago
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
4 years ago
glx 4ae829cb27 Codechange: Replace FOR_ALL_GROUPS with range-based for loops 5 years ago
glx 1f6b3a37f9 Codechange: Replace FOR_ALL_ENGINES with range-based for loops 5 years ago
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 5 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 5 years ago
Niels Martin Hansen 08284e005d Fix: Automatic line breaking of the warning 5 years ago
glx 2db88953e7 Codechange: use std::sort() in GUIList 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
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.
5 years ago
glx22 66dd7c3879
Fix: MSVC warnings (#7423) 5 years ago
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 5 years ago
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 5 years ago
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 5 years ago
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 5 years ago
Henry Wilson 9cba6f7193 Codechange: Replaced SmallVector::Compact() with std::vector::shrink_to_fit() 5 years ago
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 5 years ago
peter1138 317f69c152 Codechange: Use override specifier in Window-derived classes. 5 years ago
peter1138 aafce47596 Codechange: Use override specifier for DropDownListItem classes. 5 years ago
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.
5 years ago
peter1138 fb35cb5ed2 Remove: Unnecessary virtual destructors on drop down list items. 5 years ago
peter1138 811bf22620 Codechange: Use Colours type instead of byte. 5 years ago
peter1138 93a6fd42d1 Fix 23960d0f2c: Company livery window shows incorrect groups when opened from group window in multiplayer. 5 years ago
peter1138 7ac17f5ae4 Fix #7281: Unable to select last group in open livery window on group creation. 5 years ago
Peter Nelson c9d801a98d Fix: Make livery window resize properly if GUI scale changes whilst open. 5 years ago
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.
5 years ago
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.
5 years ago
Peter Nelson 6e5b90f4f7 Change: For consistency, add company name to colour scheme window. 5 years ago
Peter Nelson 256b94a03d Fix: Ignore company colour selection when showing different company's colour scheme. 5 years ago
nikolas fa95af2da8 Codechange: Fix typo in variable name: pices -> pieces (#7033) 6 years ago
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 6 years ago
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 7 years ago
frosch a682962719 (svn r27889) -Change: Do not cancel headquarter construction and engine-preview-query when shift-clicking (adf88) 7 years ago
frosch 2d636266f5 (svn r27427) -Fix: Use the NewGRF railtype sorting order in the infrastructure window. 9 years ago
frosch a8080b6256 (svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ScaleGUITrad(). 10 years ago
peter1138 58458c6652 (svn r26935) -Codechange: Fit company colour selection drop down list to UI scale. 10 years ago
peter1138 ea33b69798 (svn r26856) -Codechange: Ensure company face widgets can fit company face. 10 years ago
frosch 2a16c33461 (svn r26527) -Codechange: Rename STR_MAPGEN_RANDOM to STR_FACE_RANDOM 10 years ago
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 10 years ago
planetmaker 3dd1a6ad2d (svn r26416) -Fix [FS#5947]: Shares button state was not appropriately updated when switching setting or company (frosch) 10 years ago
rubidium 83eeba28b7 (svn r26086) -Codechange: use AutoDeleteSmallVector instead std::list for dropdowns 11 years ago
frosch 98fdd20f84 (svn r25531) -Codechange: Use separate function to set data of WWT_MATRIX widgets. 11 years ago
rubidium 4356510408 (svn r25517) -Fix-ish (r25515) / Feature-ish [FS#5623]: properly align the statistics as well when the infra sharing is turned on 11 years ago
rubidium ba1e42d057 (svn r25516) -Codechange: reduce code duplication in infrastructure statistics window 11 years ago
rubidium c27ce651c9 (svn r25515) -Feature [FS#5595]: right align the infrastructure statistics 11 years ago
rubidium d724088a1c (svn r25442) -Codechange: move height and ascender information into the FontCache instances 11 years ago
frosch 8157a8afd8 (svn r25290) -Add: Assign string names to notable windows. 11 years ago
frosch 56e4a8c4d6 (svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction. 11 years ago
rubidium 99a08e1e8c (svn r24968) -Fix [FS#5379]: company window was not updated when shared were enabled/disabled 12 years ago
frosch b533523258 (svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations. 12 years ago
frosch 03736af2ae (svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default. 12 years ago
alberth f883454db2 (svn r24655) -Codechange(r18310): Difference between female and male is no longer needed for tie and earrings (found by botankras) 12 years ago
michi_cc 32ab630bda (svn r24131) -Add [FS#1952]: Ctrl-Clicking to change colour of all colour schemes at once. (Roest) 12 years ago