Peter Nelson and GitHub
1f18894408
Change: Determine industry directory width only on visible rows. ( #13097 )
...
When rebuilding the industry directory list, the width of every item in the list is obtained to get the maximum width required for the horizontal scrollbar. This can take considerable time if there are a lot of industries.
Instead, calculate only for the visible rows, and grow as needed.
2024-11-24 06:51:58 +00:00
Jonathan G Rennison and GitHub
59c399c795
Codefix: Documentation comment in IndustryDirectoryWindow ( #13059 )
2024-11-06 18:52:30 +00:00
Anatoly Eltsov and GitHub
3fca0cf3ee
Feature: Industry production graph ( #10541 )
2024-10-31 22:35:04 +00:00
Peter Nelson and GitHub
14b986609b
Add: AppendStringInPlace() to append translated string ID into an existing string. ( #12969 )
...
This allows avoiding a string copy when building strings.
2024-10-07 19:05:38 +01:00
Peter Nelson and GitHub
3cd1200668
Fix #12976 : Incorrect widget rect scrolling for RTL languages. ( #12978 )
...
Industry directory, AS/GS and Textfile window did not consider RTL when applying horizontal scrolling.
2024-10-05 08:02:59 +01:00
Loïc Guilloux and GitHub
8ef3a3d463
Codefix: "maybe uninitialized" warnings for linux generic release build ( #12838 )
2024-07-02 11:04:07 +02:00
Rubidium and rubidium42
14200212b7
Codechange: use std::optional<std::string> over char * for text query results
2024-06-29 16:33:16 +02:00
Steve Goldman and rubidium42
a23ff227e7
Add: Industry window zoom with mouse wheel
2024-06-25 20:48:07 +02:00
Peter Nelson and GitHub
e802c1a97f
Add: Show count of towns and industries in their directory window captions. ( #12800 )
...
These windows now show "(<visible> of <total>)" in the caption.
2024-06-23 17:55:37 +01:00
Peter Nelson and GitHub
91fd082e93
Fix: Apply widget's internal padding to scrollbar capacity/position. ( #12801 )
...
For non-WWT_MATRIX widgets, scrollbars need to take account of the internal padding used for the widget.
This is not normally noticeable as framerect padding is only 2 extra pixels
2024-06-22 15:42:13 +00:00
Peter Nelson and GitHub
55314513ce
Codechange: Pass NWidgetParts as span instead of begin/end pointers. ( #12779 )
2024-06-12 23:08:35 +01:00
Peter Nelson and GitHub
4cf6d1dd79
Codechange: Pass WindowDesc by reference instead of pointer. ( #12771 )
...
WindowDesc as passed to Windows is not optional so don't allow to it to be nullptr.
2024-06-11 08:58:03 +01:00
Rubidium and rubidium42
d183d8e587
Codechange: remove INVALID_STRING_ID now drop down uses spans
2024-04-28 18:47:31 +02:00
Rubidium and rubidium42
37a03b513f
Codechange: refactor string list dimension finding into a separate function
2024-04-28 18:47:31 +02:00
Rubidium and rubidium42
ad50c4f298
Codechange: inline sorter name definitions and use proper static accessor instead of (implying) this->
2024-04-28 18:47:31 +02:00
Peter Nelson and Peter Nelson
33aedc43a5
Codechange: Shrink GUIList vectors less often, reserve before use.
...
After sorting and filter lists for GUI, we often shirnk them to reduce size. However this has very little benefit:
1) The memory has already been allocated, so it doesn't prevent that memory being required.
2) It causes a new allocation and copy when the vector is shrunk, actually using more memory.
3) The list is in window state, so the lifetime is only while the window is open.
4) When a filter is clearer, the original size will be needed again, which will cause another allocation.
In fact it is beneficial to reserve to the known maximum in most cases, so do that instead.
2024-04-27 19:25:34 +01:00
Peter Nelson and GitHub
f44d8fa2e4
Codechange: Remove CDECL from filter functions. ( #12578 )
...
These functions are not passed to qsort()...
2024-04-25 22:13:23 +01:00
Peter Nelson and GitHub
0075a95278
Codefix: Make three _filter_funcs definitions distinct. ( #12573 )
...
Rename the GUIList function lists defined as the same symbol.
2024-04-25 21:01:15 +01:00
Peter Nelson and GitHub
5bc9854be2
Codechange: Make sort list function lists safer. ( #12574 )
...
GUIList has a pointer only to the start of each sort/filter func list, which has the potential for UB as it is unable to validate that the selected sort or filter type is in range.
Use a std::span instead and check if the selected type is in range before using it.
2024-04-25 21:00:49 +01:00
Peter Nelson and GitHub
959ced71bb
Codechange: Add constants for original input/output cargo counts. ( #12548 )
...
This replaces some magic 3s and 2s.
2024-04-20 20:50:48 +01:00
Rubidium and rubidium42
c377c4740d
Codechange: replace cpp_lengthof with safe alternatives
2024-04-20 13:36:19 +02:00
Rubidium and rubidium42
e441033d68
Codechange: use std::array instead of C-style array for produced/accepts cargo
2024-04-20 11:29:55 +02:00
Peter Nelson and Peter Nelson
16eb17418b
Change: Use aspect ratios for some common widgets.
2024-04-19 22:11:16 +01:00
Peter Nelson and GitHub
e83e2df023
Fix: Build industry window did not take width of count into account. ( #12476 )
2024-04-12 23:07:31 +01:00
Rubidium and rubidium42
ff27b9e76a
Codechange: use std::any_of instead of custom loop
2024-04-11 07:05:04 +02:00
Peter Nelson and GitHub
a42aa1a086
Codechange: Remove cargo_suffix C-array from GetIndustryString. ( #12472 )
...
The information is pushed onto a vector, so string ownership can be moved there instead of using a pointer into to the CargoSuffix array.
2024-04-10 21:32:21 +01:00
Peter Nelson and GitHub
144bcbbaf1
Fix: Use clear() to clear std::string. ( #12471 )
2024-04-10 17:27:30 +00:00
Rubidium and rubidium42
883d3e7a9f
Codechange: use std::span instead of pointer + length
2024-04-09 10:11:50 +02:00
Peter Nelson and GitHub
de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. ( #12457 )
...
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Peter Nelson and GitHub
995fca58a2
Codechange: Use begin/end instead of endof for some industry arrays. ( #12447 )
2024-04-07 22:01:46 +01:00
Peter Nelson and Peter Nelson
56cac21086
Codechange: Use functions to create common drop down list items.
2024-04-01 22:33:16 +01:00
Peter Nelson and Peter Nelson
f6b38e8e06
Codechange: Remove optional MakeCargo() parameters that are never changed.
...
Default values are always used, so don't need to be parameters.
2024-04-01 18:46:29 +01:00
Peter Nelson and Peter Nelson
e4fc8ef595
Codechange: Use std::span for industry cargo window instead of pointer + length.
2024-04-01 18:46:29 +01:00
Peter Nelson and GitHub
d683ec0183
Codechange: Move dropdown and slider out of widgets directory. ( #12403 )
...
Also shuffle headers to place widget includes near end.
This leaves the widgets directory solely for defining Widget IDs.
2024-03-31 19:37:16 +01:00
Peter Nelson and Michael Lutz
e16b982b6a
Codechange: Use iteration when dealing with all HouseSpecs.
2024-03-28 23:23:00 +01:00
Peter Nelson and GitHub
4751179dc5
Codefix: Remove unused class member and extraneous spaces. ( #12378 )
2024-03-25 21:35:31 +00:00
Peter Nelson and GitHub
97c1738541
Fix #12368 : Incorrect offset for click position within industry chain window. ( #12370 )
2024-03-24 18:35:33 +00:00
Patric Stout and GitHub
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Rubidium and rubidium42
86cb184eb4
Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc
2024-03-10 10:14:20 +01:00
Rubidium and rubidium42
bab5a8a787
Codechange: use std::source_location over __FILE__ and __LINE__ for Backup
2024-03-10 10:14:20 +01:00
Peter Nelson and GitHub
d4f0f0e2c5
Codechange: Use GetVisibleRangeIterators() in more places. ( #12190 )
...
This replaces more first/last index calculation, along with indexed array/vector access, with iterator access instead.
2024-02-27 20:10:06 +00:00
Peter Nelson and GitHub
481fa7dbb5
Change: Show cargo icons on Industry View window. ( #12071 )
2024-02-12 00:50:58 +00:00
Peter Nelson and GitHub
d6f34a21e8
Codefix: Incorrect storage type in cargo field of industry cargo chains window. ( #12051 )
...
`supp_cargoes` and `cust_cargoes` actually contains a column index, however this index is always stored at the indexed position...
Replace with a bitmask instead, which stores if the column indices are linked.
2024-02-11 23:05:29 +00:00
frosch and frosch
b1718478c8
Codechange: Replace old non-standard attributes with C++17/20 standard attributes.
2024-02-02 22:29:28 +01:00
Peter Nelson and Peter Nelson
2e6c6b719f
Change: Link houses production on industry chain graph by TPE_PASSENGERS or TPE_MAIL cargo.
2024-02-02 20:37:49 +00:00
Tyler Trahan and GitHub
41f2eed425
Feature: Settings to scale cargo production of towns and industries ( #10606 )
2024-01-30 15:11:46 -05:00
frosch and frosch
68c64d2511
Codechange: Remove TKM string codes by duplicating strings.
2024-01-28 14:44:24 +01:00
Peter Nelson and 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 and Peter Nelson
400ae65ff2
Codechange: Redefine some cargo-related values in terms of CargoID instead of CargoType.
...
Values used as special filter types are now defined as offsets from NUM_CARGO instead of confusingly reusing CARGO_NO_REFIT/CARGO_AUTO_REFIT types.
2024-01-09 18:56:05 +00:00
Peter Nelson and Peter Nelson
952d111b94
Codechange: Split CT_INVALID into CT_INVALID and INVALID_CARGO.
...
INVALID_CARGO is a CargoID and should be used for most purposes in game.
CT_INVALID is a CargoType used for defining default properties.
2024-01-09 18:56:05 +00:00