Rubidium
6e0378f7c1
Codechange: use IndustryID instead of int
2025-02-07 19:26:34 +01:00
Peter Nelson
c3643e3ee0
Codechange: Pass raw string to editable query window. ( #13481 )
...
This avoids separating string id and parameters. EncodedString is not needed as it is the raw text that is editable.
2025-02-07 17:03:53 +00:00
Peter Nelson
2bb3f368e3
Codechange: Use EnumBitSet for IndustryBehaviours.
2025-02-07 12:30:06 +00:00
Peter Nelson
59354576d4
Codechange: Use EnumBitSet for LandscapeTypes and remove LandscapeID. ( #13436 )
2025-02-01 23:09:18 +00:00
Peter Nelson
40aeedeade
Codechange: Use EnumBitSet for callback masks.
2025-01-31 17:08:24 +00:00
Peter Nelson
d30e8dd1c1
Codechange: Use EnumBitSet for WindowDefaultFlags.
2025-01-30 08:40:42 +00:00
Peter Nelson
efb05396a7
Codechange: Use EnumBitSet for WindowFlags.
2025-01-30 08:40:42 +00:00
Peter Nelson
afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. ( #13383 )
2025-01-28 22:17:34 +00:00
Rubidium
e894a5880c
Codechange: rename CargoID to CargoType and amend related variables/comments
2025-01-26 18:07:10 +01:00
Rubidium
4b2051a1c1
Codechange: use Textbuf::GetText() to access the buffer / hide Textbuf::buf
2025-01-19 23:01:35 +01:00
Loïc Guilloux
46f181c8a6
Fix #13299 : Merge IT_INVALID and INVALID_INDUSTRYTYPE ( #13300 )
...
* Fix #13299 : Merge IT_INVALID and INVALID_INDUSTRYTYPE
* Codefix: Use NUM_INDUSTRYTILES where it's intended
2025-01-10 01:17:11 +01:00
Peter Nelson
f404f3154e
Fix #13293 : Incorrect GRFStringID used for industry cargo suffix text. ( #13294 )
...
Industry cargo suffix string should be mapped to 0xD000-0xD400 when the callback result is between 0x800-0xC00,
2025-01-08 19:37:38 +00:00
Rubidium
ef87acc1ff
Codechange: make STR_NULL the default for all widget construction functions
2025-01-03 23:25:27 +01:00
Rubidium
b60101853c
Codechange: add and use SetString over directly accessing widget_data
2025-01-03 12:14:55 +01:00
Rubidium
9ac1bad480
Codechange: add and use GetString over directly accessing widget_data
2025-01-03 11:11:01 +01:00
Rubidium
7c2668d10f
Codechange: replace SetDataTip(0x0, with SetTooltip(
2025-01-02 23:28:43 +01:00
Rubidium
d8d03212b8
Codechange: replace SetDataTip(SPR_ with SetSpriteTip(STR_
2025-01-02 23:28:43 +01:00
Rubidium
4bf36e3fa6
Codechange: replace SetDataTip(STR_ with SetStringTip(STR_
2025-01-02 23:28:43 +01:00
Peter Nelson
2d372fa516
Codechange: NewGRF strings are not StringIDs.
...
Add GRFStringID type and use it when dealing with GRF-local string IDs.
2025-01-02 20:03:40 +00:00
Rubidium
fd5f6caed4
Codechange: use explicit TileIndex constructor for tile 0
2025-01-01 08:26:54 +01:00
Peter Nelson
74087e6a2e
Codechange: Use _TOOLTIP suffix for other tooltip StringIDs.
2025-01-01 02:28:08 +00:00
SamuXarick
10e2d1ca36
Codechange: Use Map::Iterate() to iterate tiles
2024-12-06 10:33:11 +10:00
Peter Nelson
e73d6fcaac
Codechange: Store grfid with entity grfprops.
...
This allows using the grfid without having to dereference the grffile pointer.
Uses no extra storage as it fits within otherwise wasted padding space.
2024-12-05 18:17:58 +00:00
Peter Nelson
059a4b22f7
Codechange: Use projection-based std::range::find where possible.
...
This simplifies matching by class members and avoids wordy lambdas.
2024-11-24 10:36:03 +00:00
Peter Nelson
876d53282e
Codechange: Use std::ranges::count(_if).
2024-11-24 10:36:03 +00:00
Peter Nelson
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
59c399c795
Codefix: Documentation comment in IndustryDirectoryWindow ( #13059 )
2024-11-06 18:52:30 +00:00
Anatoly Eltsov
3fca0cf3ee
Feature: Industry production graph ( #10541 )
2024-10-31 22:35:04 +00:00
Peter Nelson
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
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
8ef3a3d463
Codefix: "maybe uninitialized" warnings for linux generic release build ( #12838 )
2024-07-02 11:04:07 +02:00
Rubidium
14200212b7
Codechange: use std::optional<std::string> over char * for text query results
2024-06-29 16:33:16 +02:00
Steve Goldman
a23ff227e7
Add: Industry window zoom with mouse wheel
2024-06-25 20:48:07 +02:00
Peter Nelson
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
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
55314513ce
Codechange: Pass NWidgetParts as span instead of begin/end pointers. ( #12779 )
2024-06-12 23:08:35 +01:00
Peter Nelson
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
d183d8e587
Codechange: remove INVALID_STRING_ID now drop down uses spans
2024-04-28 18:47:31 +02:00
Rubidium
37a03b513f
Codechange: refactor string list dimension finding into a separate function
2024-04-28 18:47:31 +02:00
Rubidium
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
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
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
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
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
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
c377c4740d
Codechange: replace cpp_lengthof with safe alternatives
2024-04-20 13:36:19 +02:00
Rubidium
e441033d68
Codechange: use std::array instead of C-style array for produced/accepts cargo
2024-04-20 11:29:55 +02:00
Peter Nelson
16eb17418b
Change: Use aspect ratios for some common widgets.
2024-04-19 22:11:16 +01:00
Peter Nelson
e83e2df023
Fix: Build industry window did not take width of count into account. ( #12476 )
2024-04-12 23:07:31 +01:00
Rubidium
ff27b9e76a
Codechange: use std::any_of instead of custom loop
2024-04-11 07:05:04 +02:00