Commit Graph

87 Commits

Author SHA1 Message Date
Peter Nelson 72b2840a97
Codechange: Use PIP spacing instead of spacers in tree picker window. (#12623) 2024-05-05 12:37:45 +01:00
Peter Nelson de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Peter Nelson 7737aa6640 Codechange: Make all NWidgetPart arrays constexpr.
This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
2024-01-16 21:57:05 +00:00
Peter Nelson 7124b4eef1 Codechange: Use std::unique_ptr for all NWidgets. 2023-12-31 15:33:56 +00:00
Peter Nelson a0dfb76e34 Codechange: Replace mishmash of types for widget index with WidgetID.
Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
2023-12-30 00:23:57 +00:00
Peter Nelson b86182ab84 Codechange: Use std::map to provide indexed widget access.
This removes the need to determine the biggest widget index and replaces C-style memory handling.
2023-12-29 18:45:43 +00:00
Peter Nelson 8186182e4c Codechange: Set displayed plane earlier to avoid ReInit. 2023-12-10 12:01:55 +00:00
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
2023-11-02 22:25:01 +00:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Peter Nelson e8015e497d Codechange: Use begin/end of nwidget parts of begin/length.
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.

And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Tyler Trahan 5c64cdcb79
Feature: Press Ctrl to build a diagonal area of trees (#10342) 2023-01-13 18:04:30 -05:00
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson b6ed595176 Codechange: Prefer suggested widget padding. 2022-11-12 18:28:39 +00:00
Peter Nelson 6f95e04005 Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
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.
2022-11-12 18:28:39 +00:00
Michael Lutz 58cff7b081 Codechange: Un-bitstuff the remaining on-map commands. 2021-12-16 22:28:32 +01:00
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.
2021-12-16 22:28:32 +01:00
Michael Lutz a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 2021-12-16 22:28:32 +01:00
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
Vít Šefl 710b758b81
Fix #9241: Grove and forest tree brushes also create rainforests (#9542) 2021-09-12 08:42:24 +02:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Niels Martin Hansen 2d9fa81bd0 Feature: Plant clumps of trees in editor by dragging on the landscape 2020-12-27 01:03:27 +01:00
Niels Martin Hansen e0ee2d530a Change: Switch tree GUI to use dynamically generated buttons
This makes it look a bit better in climates with fewer tree types.
2020-12-27 01:03:27 +01:00
Niels Martin Hansen 4d0f19406b Fix: Wrong tree sprite in tree toolbar 2020-12-27 01:03:27 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
peter1138 317f69c152 Codechange: Use override specifier in Window-derived classes. 2019-03-24 16:10:04 +01: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
frosch 3352dc7e62 (svn r26419) -Cleanup: Remove implementation of BuildTreesWindow::OnPaint since it matches the one of the base class. 2014-03-23 12:47:04 +00:00
frosch 8157a8afd8 (svn r25290) -Add: Assign string names to notable windows. 2013-05-26 19:25:01 +00:00
frosch 56e4a8c4d6 (svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction. 2013-05-26 19:23:42 +00:00
frosch 3ce8d2ce70 (svn r24846) -Add: Advanced settings to disable certain sound effects. 2012-12-23 21:09:09 +00:00
frosch 03736af2ae (svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default. 2012-11-11 16:10:43 +00:00
frosch b998cbdff1 (svn r24697) -Codechange: Use WDF_UNCLICK_BUTTONS instead of duplicating the same functionality. 2012-11-11 16:07:46 +00:00
michi_cc ed56585388 (svn r24135) -Remove [FS#4757]: Tree drag size limit. 2012-04-17 19:43:57 +00:00
planetmaker 5ade484ce4 (svn r23538) -Codechange: Consistent naming of widgets in tree plant gui 2011-12-16 16:57:15 +00:00
truebrain 2aa774e831 (svn r23528) -Codechange: move widget enums to widgets/NNN_type.h 2011-12-15 22:22:55 +00:00
truebrain df0afdf0dc (svn r23525) -Codechange: make Window::flags4 WindowFlags instead of uint16, with only values known in WindowFlags (and move out 2 timers to their own variable)
-Codechange: rename Window::flags4 to Window::flags
-Codechange: move some non-inline functions from .hpp to .cpp
2011-12-15 19:54:23 +00:00
rubidium db12a5f703 (svn r22908) -Codechange: silence MSVC warning 2011-09-08 17:54:49 +00:00
planetmaker 56c36aed86 (svn r22862) -Add: Allow the tree build gui to resize according to tree size 2011-08-31 22:52:26 +00:00
frosch ec9540a12a (svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData(). 2011-03-13 21:31:29 +00:00
rubidium 7eba2bf4d3 (svn r21890) -Cleanup: remove some unneeded includes 2011-01-22 14:52:20 +00:00
alberth 852e647bcc (svn r21627) -Codechange: Remove _place_proc global variable. 2010-12-24 15:08:19 +00:00
frosch aea2252960 (svn r19634) -Codechange: Use TREE_INVALID more consistently. 2010-04-14 19:57:19 +00:00
frosch 88019e64e1 (svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick(). 2010-01-30 18:34:48 +00:00
alberth 91872aca48 (svn r18588) -Feature [FS#2943]: Add shading and unshading of windows. 2009-12-21 16:24:29 +00:00
rubidium ac4ef286f4 (svn r18447) -Change: make some more windows (e.g. graphs, company view) stickyable 2009-12-09 17:10:57 +00:00
rubidium 1f0da3710f (svn r18324) -Codechange: there's no need for a default size when the window isn't resizable 2009-11-28 15:01:49 +00:00