Add filter text box to new ride selection window#19067
Conversation
2fe3c24 to
eaa2feb
Compare
|
@Gymnasiast if this last build completes successfully, I don't think I'm making any more changes without feedback and this can be taken out of draft state |
1c41b6d to
cd0a871
Compare
|
Don't forget about a changelog entry. I think this probably would fit best under "Improved". |
d986068 to
8fc11ae
Compare
|
|
||
| Filter.resize(MAX_PATH); | ||
| widgets[WIDX_FILTER_TEXT_BOX].string = Filter.data(); | ||
| Filter.clear(); |
There was a problem hiding this comment.
Could you explain this bit to me? You are resizing the empty string, assigning it to the widget and clearing it immediately. I might be missing something here, but I’m not sure why you would start with resizing it.
There was a problem hiding this comment.
I wanted to avoid the string getting resized after giving the textbox widget a pointer to its data. Having the string get resized after the widget assignment, either automatically as needed or with an explicit resize call, would leave the widget with a pointer to a memory address that was no longer valid.
There was a problem hiding this comment.
Doing some testing, I tried this code:
_filter.resize(4);
widgets[WIDX_FILTER_TEXT_BOX].string = _filter.data();
_filter.resize(600);
_filter.clear();And the new ride window opens up with some garbage data in the text box. Filtering still seems to work correctly although pressing the clear button will reset it to the garbage data.
If the resize calls are removed, typing in a long string, then pressing the clear button can get you some garbage in the text box as well. Here's an example:

When this happens, I think it just means that the pointer that the widget is using is no longer pointing to the same data that the std::string is using. Filtering is still working because it's based on the static std::string rather than the widget data pointer.
If you really wanted this behavior changed, the clear call could come before the widget string assignment, but it doesn't really make much difference. I think the only order that matters is that resize is called before the string data gets assigned to the widget, and that the string is resized large enough that it won't get resized and can fit any input the text box might have.
8fc11ae to
239f454
Compare
|
Hey, sorry for the feedback coming in very small chunks. I now left all my review bits, but since my knowledge of string handling is somewhat limited, I’m trying to see if I can get another team member to take a look at that. |
239f454 to
ed5cfc9
Compare
|
The PR seems to work, though I’m not 100% sure if should use the same criteria as the object selection. For example, authors and identifiers are not terribly relevant or even visible in the New Ride window. Conversely, it doesn’t search in the description, which is something I would expect in the New Ride window. Before you change anything, let’s first hear what other people think. |
|
I think @spacek531 was asking for identifier searching in Discord, but that may have been in reference to scenery rather than rides. I also considered searching the description, but I don't really have a strong feeling on it one way or another. It wouldn't be difficult to add at this point, so I agree we can wait and see if others have any input. |
|
I requested ID search because high level players know the IDs of objects thry want to use. Also, the JSON identifier can act as a rudimentary tagging system by tacking on namespaces. |
| InitScrollWidgets(); | ||
|
|
||
| _filter.resize(MAX_PATH); | ||
| widgets[WIDX_FILTER_TEXT_BOX].string = _filter.data(); |
There was a problem hiding this comment.
Instead of doing this set the widgets[WIDX_FILTER_TEXT_BOX].string in the OnPrepareDraw function. That is guaranteed to be called prior to drawing so the pointer will be valid at time of drawing. Previously we used to do dynamic strings via a similar method with the common format args but its also pretty messy.
| static constexpr const int32_t RideListItemsMax = 384; | ||
| static constexpr const int32_t RideTabCount = 6; | ||
| static constexpr const int32_t GroupByTrackTypeWidth = 172; | ||
| static std::string _filter; |
There was a problem hiding this comment.
This should become a member variable of the window. You are clearing it in OnOpen so its not like it needs to be a local global variable (unless I'm not understanding somthing)
There was a problem hiding this comment.
I think you're right. I first attempted this when I had no knowledge about openrct2 code and was primarily mirroring the ObjectSelection window. I can also switch to u8string as well.
duncanspumpkin
left a comment
There was a problem hiding this comment.
Good work. A few little tweaks still needed to make this just right.
|
I think this has all the tweaks you requested now @duncanspumpkin |
duncanspumpkin
left a comment
There was a problem hiding this comment.
All works quite well.
|
Looks like you'll need to rebase to fix the chanelog conflict. |
- Feature: [#11269] Add properties for speed and length of vehicle animations. - Feature: [#15849] Objectives can now be set for up to 50000 guests. - Feature: [#18537] Add shift/control modifiers to window close buttons, closing all but the given window or all windows of the same type, respectively. - Feature: [#18732] [Plugin] API to get the guests thoughts. - Feature: [#18744] Cheat to allow using a regular path as a queue path. - Feature: [#19023] Add Canadian French translation. - Feature: [#19341] Add “All Scenery” tab to scenery window. - Feature: [#19378] Add command to combine CSG1i.DAT and CSG1.DAT. - Feature: [objects#226] Port RCT1 Corkscrew Coaster train. - Feature: [objects#229] Port RCT1 go karts with helmets. - Feature: [OpenMusic#20, OpenMusic#21] Added Blizzard and Extraterresterial ride music styles. - Improved: [#11473] Hot reload for plug-ins now works on macOS. - Improved: [#12466] RCT1 parks now use RCT1’s interest calculation algorithm. - Improved: [#14635] Scenery window now shows up to 255 scenery groups. - Improved: [#17288] Reorganise the order of shortcut keys in the Shortcut Keys window. - Improved: [#18706] Ability to view the list of contributors in-game. - Improved: [#18749] Ability to have 4 active awards for more than one month in a row. - Improved: [#18826] [Plugin] Added all actions and their documentation to plugin API. - Improved: [#18945] Languages can now fall back to other languages than English. - Improved: [#18970] Trying to load a non-park save will now display a context error. - Improved: [#18975] Add lift sprites for steep hills on the wooden roller coaster. - Improved: [#19044] Added special thanks to RMC and Wiegand to the About page. - Improved: [#19131] Track missing objects when selecting scenery groups in console. - Improved: [#19253] Queue junctions drawn properly when using regular paths as queue. Note: Requires using tile inspector to indicate railings can be used at T or X junctions. - Improved: [#19067] New Ride window now allows filtering similarly to Object Selection. - Improved: [#19272] Scenery window now allows filtering similarly to Object Selection. - Improved: [#19447] The control key now enables word jumping in text input fields. - Improved: [#19463] Added ‘W’ and ‘Y’ with circumflex to sprite font (for Welsh). - Improved: [#19549] Enable large address awareness for 32 bit Windows builds allowing to use 4 GiB of virtual memory. - Improved: [#19668] Decreased the minimum map size from 13 to 3. - Improved: [#19683] The delays for ride ratings to appear has been reduced drastically. - Improved: [#19697] “Show guest purchases” will now work in multiplayer. - Change: [#19018] Renamed actions to fit the naming scheme. - Change: [#19091] [Plugin] Add game action information to callback arguments of custom actions. - Change: [#19233] Reduce lift speed minimum and maximum values for “Classic Wooden Coaster”. - Removed: [#19520] Support for Windows Vista systems. - Fix: [#474] Mini golf window shows more players than there actually are (original bug). - Fix: [#592] Window scrollbar not able to navigate to the end of large lists. - Fix: [#7210] Land tile smoothing occurs with edge tiles (original bug). - Fix: [#17996] Finances window not cleared when starting some .park scenarios. - Fix: [#18260] Crash opening parks that have multiple tiles referencing the same banner entry. - Fix: [#18467] “Selected only” Object Selection filter is active in Track Designs Manager, and cannot be toggled. - Fix: [#18904] OpenRCT2 audio object accidentally exported in saves. - Fix: [#18905] Ride Construction window theme is not applied correctly. - Fix: [#18911] Mini Golf station does not draw correctly from all angles. - Fix: [#18971] New Game does not prompt for save before quitting. - Fix: [#18986] [Plugin] Sending remote scripts larger than 63KiB crashing all clients. - Fix: [#18994] Title music doesn’t start after enabling master volume. - Fix: [#19025] Park loan behaves inconsistently with non-round and out-of-bounds values. - Fix: [#19026] Park loan is clamped to a 32-bit integer. - Fix: [#19068] Guests may not join queues correctly. - Fix: [#19091] [Plugin] Remote plugins in multiplayer servers do not unload properly. - Fix: [#19112] Clearing the last character in the Object Selection filter does not properly reset it. - Fix: [#19112] Text boxes not updated with empty strings in Track List, Server List, and Start Server windows. - Fix: [#19114] [Plugin] ‘GameActionResult’ does not comply to API specification. - Fix: [#19136] SV6 saves with experimental RCT1 paths not imported correctly. - Fix: [#19243] .park scenarios don’t complete properly. - Fix: [#19250] MusicObjects do not free their preview images. - Fix: [#19292] Overflow in ‘totalRideValue’. - Fix: [#19339] Incorrect import of crashed particles from SV4. - Fix: [#19379] “No platforms” station style shows platforms on the Junior Roller Coaster. - Fix: [#19380] Startup crash when no sequences are installed and random sequences are enabled. - Fix: [#19391] String corruption caused by an improper buffer handling in ‘GfxWrapString’. - Fix: [#19434, #19509] Object types added by OpenRCT2 do not get removed when executing ‘remove_unused_objects’. - Fix: [#19475] Cannot increase loan when more than £1000 in debt. - Fix: [#19493] SV4 saves not importing the correct vehicle colours. - Fix: [#19517] Crash when peeps try to exit or enter hacked rides that have no waypoints specified. - Fix: [#19524] Staff counter shows incorrect values if there are more than 32767 staff members. - Fix: [#19574] Handle exits in null locations. - Fix: [#19641, #19643] Missing water tile in Infernal Views’ and Six Flags Holland’s river.
- Feature: [OpenRCT2#11269] Add properties for speed and length of vehicle animations. - Feature: [OpenRCT2#15849] Objectives can now be set for up to 50000 guests. - Feature: [OpenRCT2#18537] Add shift/control modifiers to window close buttons, closing all but the given window or all windows of the same type, respectively. - Feature: [OpenRCT2#18732] [Plugin] API to get the guests thoughts. - Feature: [OpenRCT2#18744] Cheat to allow using a regular path as a queue path. - Feature: [OpenRCT2#19023] Add Canadian French translation. - Feature: [OpenRCT2#19341] Add “All Scenery” tab to scenery window. - Feature: [OpenRCT2#19378] Add command to combine CSG1i.DAT and CSG1.DAT. - Feature: [objects#226] Port RCT1 Corkscrew Coaster train. - Feature: [objects#229] Port RCT1 go karts with helmets. - Feature: [OpenMusic#20, OpenMusic#21] Added Blizzard and Extraterresterial ride music styles. - Improved: [OpenRCT2#11473] Hot reload for plug-ins now works on macOS. - Improved: [OpenRCT2#12466] RCT1 parks now use RCT1’s interest calculation algorithm. - Improved: [OpenRCT2#14635] Scenery window now shows up to 255 scenery groups. - Improved: [OpenRCT2#17288] Reorganise the order of shortcut keys in the Shortcut Keys window. - Improved: [OpenRCT2#18706] Ability to view the list of contributors in-game. - Improved: [OpenRCT2#18749] Ability to have 4 active awards for more than one month in a row. - Improved: [OpenRCT2#18826] [Plugin] Added all actions and their documentation to plugin API. - Improved: [OpenRCT2#18945] Languages can now fall back to other languages than English. - Improved: [OpenRCT2#18970] Trying to load a non-park save will now display a context error. - Improved: [OpenRCT2#18975] Add lift sprites for steep hills on the wooden roller coaster. - Improved: [OpenRCT2#19044] Added special thanks to RMC and Wiegand to the About page. - Improved: [OpenRCT2#19131] Track missing objects when selecting scenery groups in console. - Improved: [OpenRCT2#19253] Queue junctions drawn properly when using regular paths as queue. Note: Requires using tile inspector to indicate railings can be used at T or X junctions. - Improved: [OpenRCT2#19067] New Ride window now allows filtering similarly to Object Selection. - Improved: [OpenRCT2#19272] Scenery window now allows filtering similarly to Object Selection. - Improved: [OpenRCT2#19447] The control key now enables word jumping in text input fields. - Improved: [OpenRCT2#19463] Added ‘W’ and ‘Y’ with circumflex to sprite font (for Welsh). - Improved: [OpenRCT2#19549] Enable large address awareness for 32 bit Windows builds allowing to use 4 GiB of virtual memory. - Improved: [OpenRCT2#19668] Decreased the minimum map size from 13 to 3. - Improved: [OpenRCT2#19683] The delays for ride ratings to appear has been reduced drastically. - Improved: [OpenRCT2#19697] “Show guest purchases” will now work in multiplayer. - Change: [OpenRCT2#19018] Renamed actions to fit the naming scheme. - Change: [OpenRCT2#19091] [Plugin] Add game action information to callback arguments of custom actions. - Change: [OpenRCT2#19233] Reduce lift speed minimum and maximum values for “Classic Wooden Coaster”. - Removed: [OpenRCT2#19520] Support for Windows Vista systems. - Fix: [OpenRCT2#474] Mini golf window shows more players than there actually are (original bug). - Fix: [OpenRCT2#592] Window scrollbar not able to navigate to the end of large lists. - Fix: [OpenRCT2#7210] Land tile smoothing occurs with edge tiles (original bug). - Fix: [OpenRCT2#17996] Finances window not cleared when starting some .park scenarios. - Fix: [OpenRCT2#18260] Crash opening parks that have multiple tiles referencing the same banner entry. - Fix: [OpenRCT2#18467] “Selected only” Object Selection filter is active in Track Designs Manager, and cannot be toggled. - Fix: [OpenRCT2#18904] OpenRCT2 audio object accidentally exported in saves. - Fix: [OpenRCT2#18905] Ride Construction window theme is not applied correctly. - Fix: [OpenRCT2#18911] Mini Golf station does not draw correctly from all angles. - Fix: [OpenRCT2#18971] New Game does not prompt for save before quitting. - Fix: [OpenRCT2#18986] [Plugin] Sending remote scripts larger than 63KiB crashing all clients. - Fix: [OpenRCT2#18994] Title music doesn’t start after enabling master volume. - Fix: [OpenRCT2#19025] Park loan behaves inconsistently with non-round and out-of-bounds values. - Fix: [OpenRCT2#19026] Park loan is clamped to a 32-bit integer. - Fix: [OpenRCT2#19068] Guests may not join queues correctly. - Fix: [OpenRCT2#19091] [Plugin] Remote plugins in multiplayer servers do not unload properly. - Fix: [OpenRCT2#19112] Clearing the last character in the Object Selection filter does not properly reset it. - Fix: [OpenRCT2#19112] Text boxes not updated with empty strings in Track List, Server List, and Start Server windows. - Fix: [OpenRCT2#19114] [Plugin] ‘GameActionResult’ does not comply to API specification. - Fix: [OpenRCT2#19136] SV6 saves with experimental RCT1 paths not imported correctly. - Fix: [OpenRCT2#19243] .park scenarios don’t complete properly. - Fix: [OpenRCT2#19250] MusicObjects do not free their preview images. - Fix: [OpenRCT2#19292] Overflow in ‘totalRideValue’. - Fix: [OpenRCT2#19339] Incorrect import of crashed particles from SV4. - Fix: [OpenRCT2#19379] “No platforms” station style shows platforms on the Junior Roller Coaster. - Fix: [OpenRCT2#19380] Startup crash when no sequences are installed and random sequences are enabled. - Fix: [OpenRCT2#19391] String corruption caused by an improper buffer handling in ‘GfxWrapString’. - Fix: [OpenRCT2#19434, OpenRCT2#19509] Object types added by OpenRCT2 do not get removed when executing ‘remove_unused_objects’. - Fix: [OpenRCT2#19475] Cannot increase loan when more than £1000 in debt. - Fix: [OpenRCT2#19493] SV4 saves not importing the correct vehicle colours. - Fix: [OpenRCT2#19517] Crash when peeps try to exit or enter hacked rides that have no waypoints specified. - Fix: [OpenRCT2#19524] Staff counter shows incorrect values if there are more than 32767 staff members. - Fix: [OpenRCT2#19574] Handle exits in null locations. - Fix: [OpenRCT2#19641, OpenRCT2#19643] Missing water tile in Infernal Views’ and Six Flags Holland’s river.
Adds a text box and clear button to the new ride window allowing users to filter based on the following:
Also fixes a bug in the Object Selection window where backspacing over your filter string will not update the search string if you remove all characters.
Examples:



