Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spacing for 100M+ XP #7688

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Source/panels/charpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ constexpr int RightColumnLabelWidth = 68;
constexpr unsigned AttributeHeaderEntryIndices[2] = { 5, 6 };
constexpr unsigned GoldHeaderEntryIndex = 16;

int GetXPSpacing(int xp)
{
if (xp < 100000000)
return 1;
if (xp < 1000000000)
return 0;
return -1;
}

PanelEntry panelEntries[] = {
{ "", { 9, 14 }, 150, 0,
[]() { return StyledText { UiFlags::ColorWhite, InspectPlayer->_pName }; } },
Expand All @@ -134,7 +143,7 @@ PanelEntry panelEntries[] = {
[]() { return StyledText { UiFlags::ColorWhite, StrCat(InspectPlayer->getCharacterLevel()) }; } },
{ N_("Experience"), { TopRightLabelX, 52 }, 99, 91,
[]() {
int spacing = ((InspectPlayer->_pExperience >= 1000000000) ? 0 : 1);
int spacing = GetXPSpacing(InspectPlayer->_pExperience);
return StyledText { UiFlags::ColorWhite, FormatInteger(InspectPlayer->_pExperience), spacing };
} },
{ N_("Next level"), { TopRightLabelX, 80 }, 99, 198,
Expand All @@ -143,7 +152,7 @@ PanelEntry panelEntries[] = {
return StyledText { UiFlags::ColorWhitegold, std::string(_("None")) };
}
uint32_t nextExperienceThreshold = InspectPlayer->getNextExperienceThreshold();
int spacing = ((nextExperienceThreshold >= 1000000000) ? 0 : 1);
int spacing = GetXPSpacing(nextExperienceThreshold);
return StyledText { UiFlags::ColorWhite, FormatInteger(nextExperienceThreshold), spacing };
} },

Expand Down
Loading