From 5894a483b442f18aa83f3e6c6569b32827325c7c Mon Sep 17 00:00:00 2001 From: FlufflesTheMicrosaur Date: Wed, 6 May 2026 14:53:11 -0700 Subject: [PATCH] chore: 106590: move GetDataField calls to GetProperty in transdata so that public GetDataField can be deprecated in the future --- Transcendence/TransData/EncounterCount.cpp | 7 ++++--- Transcendence/TransData/EncounterFrequency.cpp | 12 +++++++----- Transcendence/TransData/EncounterTable.cpp | 6 ++++-- Transcendence/TransData/LootSim.cpp | 4 +++- Transcendence/TransData/ShieldStats.cpp | 16 ++++++++++------ Transcendence/TransData/SystemCount.cpp | 4 +++- Transcendence/TransData/SystemTest.cpp | 4 +++- Transcendence/TransData/TradeTable.cpp | 8 ++++++-- Transcendence/TransData/TypeTable.cpp | 4 +++- 9 files changed, 43 insertions(+), 22 deletions(-) diff --git a/Transcendence/TransData/EncounterCount.cpp b/Transcendence/TransData/EncounterCount.cpp index 34bf56b95..f9e7672ae 100644 --- a/Transcendence/TransData/EncounterCount.cpp +++ b/Transcendence/TransData/EncounterCount.cpp @@ -115,6 +115,8 @@ void GenerateEncounterCount (CUniverse &Universe, CXMLElement *pCmdLine) // Output all rows + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + for (i = 0; i < NodeTable.GetCount(); i++) { for (j = 0; j < NodeTable[i].Table.GetCount(); j++) @@ -131,12 +133,11 @@ void GenerateEncounterCount (CUniverse &Universe, CXMLElement *pCmdLine) CSovereign *pSovereign = pEncounterType->GetControllingSovereign(); CString sSovereign = (pSovereign ? pSovereign->GetNounPhrase() : CONSTLIT("(Unknown)")); - printf("%d\t%s\t0x%08x\t%s\t%s\t%s\t%d.%03d", NodeTable[i].iLevel, NodeTable[i].sNodeID.GetASCIIZPointer(), NodeTable[i].Table.GetKey(j), - pEncounterType->GetDataField(CONSTLIT("category")).GetASCIIZPointer(), + pEncounterType->GetProperty(CCCtx, CONSTLIT("category"))->GetStringValue().GetASCIIZPointer(), sSovereign.GetASCIIZPointer(), pEncounterType->GetNounPhrase().GetASCIIZPointer(), iCount, @@ -144,7 +145,7 @@ void GenerateEncounterCount (CUniverse &Universe, CXMLElement *pCmdLine) for (l = 0; l < Cols.GetCount(); l++) { - CString sValue = pEncounterType->GetDataField(Cols[l]); + CString sValue = pEncounterType->GetProperty(CCCtx, Cols[l])->GetStringValue(); printf("\t%s", sValue.GetASCIIZPointer()); } diff --git a/Transcendence/TransData/EncounterFrequency.cpp b/Transcendence/TransData/EncounterFrequency.cpp index 7ad28145b..b8ee39c53 100644 --- a/Transcendence/TransData/EncounterFrequency.cpp +++ b/Transcendence/TransData/EncounterFrequency.cpp @@ -224,25 +224,27 @@ void OutputFreq (const CSystemCreateStats &Stats, const SOptions &Options) printf("\t%s", Options.Cols[i].GetASCIIZPointer()); printf("\n"); + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + for (int i = 0; i < EncounterFreq.GetCount(); i++) { CStationType *pEncounterType = EncounterFreq.GetKey(i); int iAveWhole = EncounterFreq[i].iTotalChance / EncounterFreq[i].iCount; int iAveFrac = 1000 * (EncounterFreq[i].iTotalChance % EncounterFreq[i].iCount) / EncounterFreq[i].iCount; - - printf("%d\t%s\t%s\t%d\t%d.%03d\t%d\t%d", + + printf("%d\t%s\t%s\t%d\t%d.%03d\t%d\t%d", pEncounterType->GetLevel(), - pEncounterType->GetDataField(CONSTLIT("category")).GetASCIIZPointer(), + pEncounterType->GetProperty(CCCtx, CONSTLIT("category"))->GetStringValue().GetASCIIZPointer(), pEncounterType->GetNounPhrase().GetASCIIZPointer(), EncounterFreq[i].iCount, iAveWhole, iAveFrac, EncounterFreq[i].iMinChance, EncounterFreq[i].iMaxChance); - + for (int j = 0; j < Options.Cols.GetCount(); j++) { - CString sValue = pEncounterType->GetDataField(Options.Cols[j]); + CString sValue = pEncounterType->GetProperty(CCCtx, Options.Cols[j])->GetStringValue(); printf("\t%s", sValue.GetASCIIZPointer()); } diff --git a/Transcendence/TransData/EncounterTable.cpp b/Transcendence/TransData/EncounterTable.cpp index 2cb378516..194e2f478 100644 --- a/Transcendence/TransData/EncounterTable.cpp +++ b/Transcendence/TransData/EncounterTable.cpp @@ -86,8 +86,10 @@ void GenerateEncounterTable (CUniverse &Universe, CXMLElement *pCmdLine) // Get the category and name - CString sCategory = pType->GetDataField(FIELD_CATEGORY); - CString sName = pType->GetDataField(FIELD_NAME); + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + + CString sCategory = pType->GetProperty(CCCtx, FIELD_CATEGORY)->GetStringValue(); + CString sName = pType->GetProperty(CCCtx, FIELD_NAME)->GetStringValue(); if (*sName.GetASCIIZPointer() == '(') sName = strSubString(sName, 1, -1); diff --git a/Transcendence/TransData/LootSim.cpp b/Transcendence/TransData/LootSim.cpp index 9e1fae0fd..d614ff386 100644 --- a/Transcendence/TransData/LootSim.cpp +++ b/Transcendence/TransData/LootSim.cpp @@ -272,6 +272,8 @@ void GenerateLootSim (CUniverse &Universe, CXMLElement *pCmdLine) CItem NULL_ITEM; CItemCtx ItemCtx(NULL_ITEM); + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + for (int i = 0; i < Sorted.GetCount(); i++) { const SSystemInfo &SystemEntry = AllSystems[Sorted[i]]; @@ -284,7 +286,7 @@ void GenerateLootSim (CUniverse &Universe, CXMLElement *pCmdLine) printf("%d\t%s\t%s\t%.2f\t%.2f\n", SystemEntry.iLevel, SystemEntry.sName.GetASCIIZPointer(), - ItemType.GetDataField(FIELD_NAME).GetASCIIZPointer(), + ItemType.GetProperty(CCCtx, FIELD_NAME)->GetStringValue().GetASCIIZPointer(), (double)iItemCount / (double)iSystemSample, (double)ItemType.GetValue(ItemCtx, true) * iItemCount / (double)iSystemSample); } diff --git a/Transcendence/TransData/ShieldStats.cpp b/Transcendence/TransData/ShieldStats.cpp index f24d0e01d..4c82f8a77 100644 --- a/Transcendence/TransData/ShieldStats.cpp +++ b/Transcendence/TransData/ShieldStats.cpp @@ -39,11 +39,13 @@ void GenerateShieldStats (CUniverse &Universe, CXMLElement *pCmdLine) // Get the stats for the shield - Metric rHP = (Metric)pItem->GetDataFieldInteger(FIELD_HP); - Metric rHPRegenPerTick = pItem->GetDataFieldInteger(FIELD_REGEN) / 1000.0; + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + + Metric rHP = pItem->GetProperty(CCCtx, FIELD_HP)->GetDoubleValue(); + Metric rHPRegenPerTick = pItem->GetProperty(CCCtx, FIELD_REGEN)->GetDoubleValue() / 1000.0; int iDamageAdj[damageCount]; - CString sDamageAdj = pItem->GetDataField(CONSTLIT("damageAdj")); + CString sDamageAdj = pItem->GetProperty(CCCtx, CONSTLIT("damageAdj"))->GetStringValue(); const char *pPos = sDamageAdj.GetASCIIZPointer(); int iCount = 0; while (iCount < damageCount) @@ -80,9 +82,11 @@ void GenerateShieldStats (CUniverse &Universe, CXMLElement *pCmdLine) // Get the data for the weapon - int iFireDelay = pWeapon->GetDataFieldInteger(CONSTLIT("fireDelay")); - Metric rAverageDamage = pWeapon->GetDataFieldInteger(CONSTLIT("averageDamage")) / 1000.0; - int iDamageType = pWeapon->GetDataFieldInteger(CONSTLIT("damageType")); + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + + int iFireDelay = pWeapon->GetProperty(CCCtx, CONSTLIT("fireDelay"))->GetIntegerValue(); + Metric rAverageDamage = pWeapon->GetProperty(CCCtx, CONSTLIT("averageDamage"))->GetDoubleValue() / 1000.0; + int iDamageType = pWeapon->GetProperty(CCCtx, CONSTLIT("damageType"))->GetIntegerValue(); if (iDamageType < 0 || iDamageType >= damageCount) iDamageType = 0; diff --git a/Transcendence/TransData/SystemCount.cpp b/Transcendence/TransData/SystemCount.cpp index a967b81db..19774f5c6 100644 --- a/Transcendence/TransData/SystemCount.cpp +++ b/Transcendence/TransData/SystemCount.cpp @@ -130,6 +130,8 @@ void GenerateSystemCount (CUniverse &Universe, CXMLElement *pCmdLine) // Output all rows + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + for (i = 0; i < NodeTable.GetCount(); i++) { for (j = 0; j < NodeTable[i].Table.GetCount(); j++) @@ -156,7 +158,7 @@ void GenerateSystemCount (CUniverse &Universe, CXMLElement *pCmdLine) } else { - CString sValue = pSystemType->GetDataField(Cols[k]); + CString sValue = pSystemType->GetProperty(CCCtx, Cols[k])->GetStringValue(); printf("\t%s", sValue.GetASCIIZPointer()); } } diff --git a/Transcendence/TransData/SystemTest.cpp b/Transcendence/TransData/SystemTest.cpp index 1d9c5624a..674ca79f1 100644 --- a/Transcendence/TransData/SystemTest.cpp +++ b/Transcendence/TransData/SystemTest.cpp @@ -346,6 +346,8 @@ void CSystemTestGenerator::PrintSystemItemStats (const TSortMapGetDataField(FIELD_NAME).GetASCIIZPointer(), + Entry.pType->GetProperty(CCCtx, FIELD_NAME)->GetStringValue().GetASCIIZPointer(), (double)Entry.iTotalCount / (double)iSampleCount); } } diff --git a/Transcendence/TransData/TradeTable.cpp b/Transcendence/TransData/TradeTable.cpp index 7620380f2..74977e43e 100644 --- a/Transcendence/TransData/TradeTable.cpp +++ b/Transcendence/TransData/TradeTable.cpp @@ -53,7 +53,9 @@ void GenerateTradeTable (CUniverse &Universe, CXMLElement *pCmdLine) // Get the name - CString sName = pType->GetDataField(FIELD_NAME); + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + + CString sName = pType->GetProperty(CCCtx, FIELD_NAME)->GetStringValue(); if (*sName.GetASCIIZPointer() == '(') sName = strSubString(sName, 1, -1); @@ -103,9 +105,11 @@ void PrintTradeDesc (CDesignType *pType, CTradingDesc *pTrade) // Print line + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + printf("%d\t%s\t%s\t%s\t%d\n", pType->GetLevel(), - (LPSTR)pType->GetDataField(FIELD_NAME), + (LPSTR)pType->GetProperty(CCCtx, FIELD_NAME)->GetStringValue(), (LPSTR)CTradingDesc::ServiceToString(Info.iService), (LPSTR)sCriteria, Info.iPriceAdj diff --git a/Transcendence/TransData/TypeTable.cpp b/Transcendence/TransData/TypeTable.cpp index 2fe83e7d2..e35a09131 100644 --- a/Transcendence/TransData/TypeTable.cpp +++ b/Transcendence/TransData/TypeTable.cpp @@ -46,7 +46,9 @@ void GenerateTypeTable (CUniverse &Universe, CXMLElement *pCmdLine) // Get the name - CString sName = pType->GetDataField(FIELD_NAME); + CCodeChainCtx CCCtx = CCodeChainCtx(*g_pUniverse); + + CString sName = pType->GetProperty(CCCtx, FIELD_NAME)->GetStringValue(); if (*sName.GetASCIIZPointer() == '(') sName = strSubString(sName, 1, -1);