Fix #3403: Broken text input args#3543
Conversation
|
|
||
| FormatArguments args{}; | ||
| args.skip(4); | ||
| args.skip(8); |
There was a problem hiding this comment.
This must have been broken for quite few releases!
|
|
||
| auto commonArgs = FormatArguments::common(); | ||
| std::memcpy(_formatArgs.data(), commonArgs.getBufferStart(), commonArgs.getLength()); | ||
| std::memcpy(_formatArgs.data(), commonArgs.getBufferStart(), std::min(commonArgs.getCapacity(), _formatArgs.capacity())); |
There was a problem hiding this comment.
commonArgs.getLength() will always be zero as we just created it. Ideally we should be passing in the args then we would have a real length value. I broke this part in the refactoring.
| // copy the existing args | ||
| FormatArgumentsBuffer formatArgsBuffer2 = _formatArgs; | ||
| auto args2 = FormatArguments(formatArgsBuffer2); | ||
| // copy and shuffle the existing args |
There was a problem hiding this comment.
This was also broken in the refactoring as I didn't notice it was shuffling the args from 8 to 2.
| @@ -89,7 +89,7 @@ namespace OpenLoco::Ui::Windows::TextInput | |||
| window->initScrollWidgets(); | |||
There was a problem hiding this comment.
For future refactoring this function should really take messageArgs, titleArgs, valueArgs. At present valueArgs is passed in but message and title args is passed via the global common format arguments and then we do this horrible shuffling to split them into two.
aae6ab5 to
9012341
Compare
Co-authored-by: Aaron van Geffen <aaron@aaronweb.net>
No description provided.