Add missing getters in SObjectTag and migrate to them

Former-commit-id: 80edcb3749d3f5733e0040d320a6ed6ac5425790
This commit is contained in:
Phillip Stephens 2023-11-10 15:16:36 -08:00
parent 1fa508ac99
commit 9843c3b263
5 changed files with 15 additions and 11 deletions

View File

@ -24,7 +24,7 @@ public:
CToken& operator=(const CToken&); CToken& operator=(const CToken&);
bool HasReference() const { return x0_objRef != nullptr; } bool HasReference() const { return x0_objRef != nullptr; }
const SObjectTag& GetTag() const { return x0_objRef->GetTag(); } const SObjectTag& GetTag() const { return x0_objRef->GetTag(); }
FourCC GetReferenceType() { return GetTag().type; } FourCC GetReferenceType() { return GetTag().GetType(); }
bool HasLock() { return x4_lockHeld; } bool HasLock() { return x4_lockHeld; }

View File

@ -8,15 +8,19 @@
typedef uint CAssetId; typedef uint CAssetId;
typedef uint FourCC; typedef uint FourCC;
struct SObjectTag { class SObjectTag {
FourCC type; public:
CAssetId id;
SObjectTag() {} SObjectTag() {}
SObjectTag(FourCC type, CAssetId id) : type(type), id(id) {} SObjectTag(const FourCC type, const CAssetId id) : mType(type), mId(id) {}
SObjectTag(const SObjectTag& other) : type(other.type), id(other.id) {} SObjectTag(const SObjectTag& other) : mType(other.mType), mId(other.mId) {}
const CAssetId GetId() const { return mId; }
const FourCC GetType() const { return mType; }
static const char* Type2Text(FourCC type); static const char* Type2Text(FourCC type);
public:
FourCC mType;
CAssetId mId;
}; };
#endif // _SOBJECTTAG #endif // _SOBJECTTAG

View File

@ -19,7 +19,7 @@ int CDependencyGroup::GetCountForResType(FourCC type) const {
int ret = 0; int ret = 0;
for (rstl::vector< SObjectTag >::const_iterator it = x0_objectTags.begin(); for (rstl::vector< SObjectTag >::const_iterator it = x0_objectTags.begin();
it != x0_objectTags.end(); ++it) { it != x0_objectTags.end(); ++it) {
if (it->type == type) { if (it->GetType() == type) {
++ret; ++ret;
} }
} }

View File

@ -19,7 +19,7 @@ CExplosion::CExplosion(const TLockedToken< CGenDescription >& particle, TUniqueI
, xe8_particleGen(rs_new CElementGen(TToken< CGenDescription >(particle), CElementGen::kMOT_Normal, , xe8_particleGen(rs_new CElementGen(TToken< CGenDescription >(particle), CElementGen::kMOT_Normal,
flags & 0x2 ? CElementGen::kOSF_Two : CElementGen::kOSF_One)) flags & 0x2 ? CElementGen::kOSF_Two : CElementGen::kOSF_One))
, xec_explosionLight(kInvalidUniqueId) , xec_explosionLight(kInvalidUniqueId)
, xf0_sourceId(CToken(particle).GetTag().id) , xf0_sourceId(CToken(particle).GetTag().GetId())
, xf4_24_renderThermalHot(flags & 0x4) , xf4_24_renderThermalHot(flags & 0x4)
, xf4_25_hasRenderBounds(true) , xf4_25_hasRenderBounds(true)
, xf4_26_renderXray(flags & 0x8) , xf4_26_renderXray(flags & 0x8)
@ -38,7 +38,7 @@ CExplosion::CExplosion(const TLockedToken< CElectricDescription >& electric, TUn
: CEffect(uid, info, active, name, xf) : CEffect(uid, info, active, name, xf)
, xe8_particleGen(rs_new CParticleElectric(electric)) , xe8_particleGen(rs_new CParticleElectric(electric))
, xec_explosionLight(kInvalidUniqueId) , xec_explosionLight(kInvalidUniqueId)
, xf0_sourceId(CToken(electric).GetTag().id) , xf0_sourceId(CToken(electric).GetTag().GetId())
, xf4_24_renderThermalHot(flags & 0x4) , xf4_24_renderThermalHot(flags & 0x4)
, xf4_25_hasRenderBounds(true) , xf4_25_hasRenderBounds(true)
, xf4_26_renderXray(flags & 0x8) , xf4_26_renderXray(flags & 0x8)

View File

@ -176,7 +176,7 @@ void CScriptPickup::Touch(CActor& act, CStateManager& mgr) {
gpResourceFactory gpResourceFactory
->GetResourceIdByName(opts.GetAllItemsCollected() ? "STRG_AllPickupsFound_2" ->GetResourceIdByName(opts.GetAllItemsCollected() ? "STRG_AllPickupsFound_2"
: "STRG_AllPickupsFound_1") : "STRG_AllPickupsFound_1")
->id; ->GetId();
mgr.QueueMessage(mgr.GetHUDMessageFrameCount() + 1, id, 0.f); mgr.QueueMessage(mgr.GetHUDMessageFrameCount() + 1, id, 0.f);
opts.SetAllItemsCollected(true); opts.SetAllItemsCollected(true);
} }