Swap definitions of left and right textbox padding

Spaces on the left and right would end up on the other side in RTL,
which made the "You have rescued a crewmate!" text overlap with the
crewmate sprite, and makes the [C[C[C[C[Captain!] dialogs have spaces
on the left instead of on the right. So, best thing is to just swap
the directions so that they match.
This commit is contained in:
Dav999 2024-01-07 04:42:53 +01:00
parent 40935d20e2
commit 3dbec3c91e
1 changed files with 8 additions and 0 deletions

View File

@ -148,6 +148,14 @@ void textboxclass::addline(const std::string& t)
void textboxclass::pad(size_t left_pad, size_t right_pad)
{
// Pad the current text with a certain number of spaces on the left and right
if (font::is_rtl(print_flags))
{
// Swap left and right, because left will end up on the right and vice versa...
size_t old_left_pad = left_pad;
left_pad = right_pad;
right_pad = old_left_pad;
}
for (size_t iter = 0; iter < lines.size(); iter++)
{
lines[iter] = std::string(left_pad, ' ') + lines[iter] + std::string(right_pad, ' ');