Skip to content

Commit

Permalink
[HaRepacker] Fix - truncation of negative numbers in WzIntProperty field
Browse files Browse the repository at this point in the history
  • Loading branch information
lastbattle committed Jan 31, 2021
1 parent 16e4b25 commit 5057b71
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions HaRepacker/GUI/Panels/MainPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,37 +1496,47 @@ private void ShowObjectValue(WzObject obj)
textPropBox.AcceptsReturn = false;
textPropBox.ApplyButtonEnabled = false; // reset to disabled mode when changed

ulong value_ = 0;
if (bIsWzLongProperty)
{
value_ = (ulong)((WzLongProperty)obj).GetLong();
}
else if (bIsWzIntProperty)
{
value_ = (ulong)((WzIntProperty)obj).GetLong();
} else if (bIsWzShortProperty)
{
value_ = (ulong)((WzShortProperty)obj).GetLong();
}

// field limit UI
if (obj.Name == FIELD_LIMIT_OBJ_NAME) // fieldLimit
{
isSelectingWzMapFieldLimit = true;

ulong value_ = 0;
if (bIsWzLongProperty) // use uLong for field limit
{
value_ = (ulong)((WzLongProperty)obj).GetLong();
}
else if (bIsWzIntProperty)
{
value_ = (ulong)((WzIntProperty)obj).GetLong();
}
else if (bIsWzShortProperty)
{
value_ = (ulong)((WzShortProperty)obj).GetLong();
}

fieldLimitPanel1.UpdateFieldLimitCheckboxes(value_);

// Set visibility
fieldLimitPanelHost.Visibility = Visibility.Visible;
}
else if (obj.Name == FIELD_TYPE_OBJ_NAME) // fieldType
}
else
{
fieldTypePanel.SetFieldTypeIndex(value_);

// Set visibility
fieldTypePanel.Visibility = Visibility.Visible;
long value_ = 0; // long for others, in the case of negative value
if (bIsWzLongProperty)
{
value_ = ((WzLongProperty)obj).GetLong();
}
else if (bIsWzIntProperty)
{
value_ = ((WzIntProperty)obj).GetLong();
}
else if (bIsWzShortProperty)
{
value_ = ((WzShortProperty)obj).GetLong();
}
textPropBox.Text = value_.ToString();
}
textPropBox.Text = value_.ToString();
}
else if (bIsWzDoubleProperty || bIsWzFloatProperty)
{
Expand Down

0 comments on commit 5057b71

Please sign in to comment.