Add missing getters in SObjectTag and migrate to them

This commit is contained in:
Phillip Stephens 2023-11-10 15:16:36 -08:00
parent 97a18228a0
commit 80edcb3749
5 changed files with 15 additions and 11 deletions

View File

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

View File

@ -8,15 +8,19 @@
typedef uint CAssetId;
typedef uint FourCC;
struct SObjectTag {
FourCC type;
CAssetId id;
class SObjectTag {
public:
SObjectTag() {}
SObjectTag(FourCC type, CAssetId id) : type(type), id(id) {}
SObjectTag(const SObjectTag& other) : type(other.type), id(other.id) {}
SObjectTag(const FourCC type, const CAssetId id) : mType(type), mId(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);
public:
FourCC mType;
CAssetId mId;
};
#endif // _SOBJECTTAG

View File

@ -19,7 +19,7 @@ int CDependencyGroup::GetCountForResType(FourCC type) const {
int ret = 0;
for (rstl::vector< SObjectTag >::const_iterator it = x0_objectTags.begin();
it != x0_objectTags.end(); ++it) {
if (it->type == type) {
if (it->GetType() == type) {
++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,
flags & 0x2 ? CElementGen::kOSF_Two : CElementGen::kOSF_One))
, xec_explosionLight(kInvalidUniqueId)
, xf0_sourceId(CToken(particle).GetTag().id)
, xf0_sourceId(CToken(particle).GetTag().GetId())
, xf4_24_renderThermalHot(flags & 0x4)
, xf4_25_hasRenderBounds(true)
, xf4_26_renderXray(flags & 0x8)
@ -38,7 +38,7 @@ CExplosion::CExplosion(const TLockedToken< CElectricDescription >& electric, TUn
: CEffect(uid, info, active, name, xf)
, xe8_particleGen(rs_new CParticleElectric(electric))
, xec_explosionLight(kInvalidUniqueId)
, xf0_sourceId(CToken(electric).GetTag().id)
, xf0_sourceId(CToken(electric).GetTag().GetId())
, xf4_24_renderThermalHot(flags & 0x4)
, xf4_25_hasRenderBounds(true)
, xf4_26_renderXray(flags & 0x8)

View File

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