FXV1: Meta Amount (#225)

ensure default-value amount fields are correctly recorded in metadata for created nodes (fixXahau1)
This commit is contained in:
Denis Angell
2023-12-03 10:27:06 +01:00
committed by GitHub
parent d2c45bf560
commit 3f7e15893e
3 changed files with 10 additions and 2 deletions

View File

@@ -130,6 +130,8 @@ ApplyStateTable::generateTxMeta(
if (!hookEmission.empty())
meta.setHookEmissions(STArray{hookEmission, sfHookEmissions});
bool const recordDefaultAmounts = to.rules().enabled(fixXahauV1);
Mods newMod;
for (auto& item : items_)
{
@@ -232,8 +234,12 @@ ApplyStateTable::generateTxMeta(
STObject news(sfNewFields);
for (auto const& obj : *curNode)
{
bool const shouldRecord =
(obj.getSType() == STI_AMOUNT && recordDefaultAmounts) ||
!obj.isDefault();
// save non-default values
if (!obj.isDefault() &&
if (shouldRecord &&
obj.getFName().shouldMeta(
SField::sMD_Create | SField::sMD_Always))
news.emplace_back(obj);