mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
chore: use std::optional value_or for iw5 leaderboard reading
This commit is contained in:
parent
1d9310fb9c
commit
e046089cbb
@ -53,15 +53,8 @@ namespace
|
|||||||
{
|
{
|
||||||
lbColumnDef.name = m_memory.Dup(jColumn.name.c_str());
|
lbColumnDef.name = m_memory.Dup(jColumn.name.c_str());
|
||||||
|
|
||||||
if (jColumn.propertyId)
|
lbColumnDef.propertyId = jColumn.propertyId.value_or(0);
|
||||||
lbColumnDef.propertyId = jColumn.propertyId.value();
|
lbColumnDef.hidden = jColumn.hidden.value_or(false);
|
||||||
else
|
|
||||||
lbColumnDef.propertyId = 0;
|
|
||||||
|
|
||||||
if (jColumn.hidden)
|
|
||||||
lbColumnDef.hidden = jColumn.hidden.value();
|
|
||||||
else
|
|
||||||
lbColumnDef.hidden = false;
|
|
||||||
|
|
||||||
if (jColumn.statName)
|
if (jColumn.statName)
|
||||||
lbColumnDef.statName = m_memory.Dup(jColumn.statName->c_str());
|
lbColumnDef.statName = m_memory.Dup(jColumn.statName->c_str());
|
||||||
@ -70,22 +63,12 @@ namespace
|
|||||||
|
|
||||||
lbColumnDef.type = jColumn.type;
|
lbColumnDef.type = jColumn.type;
|
||||||
|
|
||||||
if (jColumn.precision)
|
lbColumnDef.precision = jColumn.precision.value_or(0);
|
||||||
lbColumnDef.precision = jColumn.precision.value();
|
|
||||||
else
|
|
||||||
lbColumnDef.precision = 0;
|
|
||||||
|
|
||||||
lbColumnDef.agg = jColumn.aggregationFunction;
|
lbColumnDef.agg = jColumn.aggregationFunction;
|
||||||
|
|
||||||
if (jColumn.uiCalColX)
|
lbColumnDef.uiCalColX = jColumn.uiCalColX.value_or(0);
|
||||||
lbColumnDef.uiCalColX = jColumn.uiCalColX.value();
|
lbColumnDef.uiCalColY = jColumn.uiCalColY.value_or(0);
|
||||||
else
|
|
||||||
lbColumnDef.uiCalColX = 0;
|
|
||||||
|
|
||||||
if (jColumn.uiCalColY)
|
|
||||||
lbColumnDef.uiCalColY = jColumn.uiCalColY.value();
|
|
||||||
else
|
|
||||||
lbColumnDef.uiCalColY = 0;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -94,15 +77,8 @@ namespace
|
|||||||
{
|
{
|
||||||
leaderboardDef.id = jLeaderboardDef.id;
|
leaderboardDef.id = jLeaderboardDef.id;
|
||||||
|
|
||||||
if (jLeaderboardDef.xpColId)
|
leaderboardDef.xpColId = jLeaderboardDef.xpColId.value_or(-1);
|
||||||
leaderboardDef.xpColId = jLeaderboardDef.xpColId.value();
|
leaderboardDef.prestigeColId = jLeaderboardDef.prestigeColId.value_or(-1);
|
||||||
else
|
|
||||||
leaderboardDef.xpColId = -1;
|
|
||||||
|
|
||||||
if (jLeaderboardDef.prestigeColId)
|
|
||||||
leaderboardDef.prestigeColId = jLeaderboardDef.prestigeColId.value();
|
|
||||||
else
|
|
||||||
leaderboardDef.prestigeColId = -1;
|
|
||||||
|
|
||||||
if (!jLeaderboardDef.columns.empty())
|
if (!jLeaderboardDef.columns.empty())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user