From 353c1c2dcde2a89399b137f730093c89b42fd372 Mon Sep 17 00:00:00 2001 From: disinvite Date: Fri, 22 Sep 2023 17:04:01 -0400 Subject: [PATCH] Use reference for PresenterNameDispatch param - fix or add const markers so we can use a const reference --- LEGO1/mxdsaction.h | 2 +- LEGO1/mxdsmediaaction.h | 2 +- LEGO1/mxdsobject.h | 4 ++-- LEGO1/mxpresenter.cpp | 16 ++++++++-------- LEGO1/mxpresenter.h | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/LEGO1/mxdsaction.h b/LEGO1/mxdsaction.h index 070bbdb9..265f0a6f 100644 --- a/LEGO1/mxdsaction.h +++ b/LEGO1/mxdsaction.h @@ -56,7 +56,7 @@ class MxDSAction : public MxDSObject inline const MxVector3Data &GetLocation() const { return m_location; } inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; } - inline MxBool const IsLooping() { return this->m_flags & Flag_Looping; } + inline MxBool IsLooping() const { return this->m_flags & Flag_Looping; } private: MxU32 m_sizeOnDisk; diff --git a/LEGO1/mxdsmediaaction.h b/LEGO1/mxdsmediaaction.h index 4fd70604..f3c03839 100644 --- a/LEGO1/mxdsmediaaction.h +++ b/LEGO1/mxdsmediaaction.h @@ -33,7 +33,7 @@ class MxDSMediaAction : public MxDSAction void CopyMediaSrcPath(const char *p_mediaSrcPath); - inline MxS32 const GetMediaFormat() { return this->m_mediaFormat; } + inline MxS32 GetMediaFormat() const { return this->m_mediaFormat; } private: MxU32 m_sizeOnDisk; char *m_mediaSrcPath; diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index 95aee26f..1ca3d98a 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -40,10 +40,10 @@ class MxDSObject : public MxCore inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; } inline void SetUnknown24(MxS16 p_unk24) { this->m_unk24 = p_unk24; } - inline char *GetSourceName() { return this->m_sourceName; } + inline char *GetSourceName() const { return this->m_sourceName; } inline void SetType(MxDSType p_type) { this->m_type = p_type; } - inline MxDSType GetType() { return (MxDSType) this->m_type; } + inline MxDSType GetType() const { return (MxDSType) this->m_type; } private: MxU32 m_sizeOnDisk; diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index b6c0f4df..940248a0 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -158,23 +158,23 @@ void MxPresenter::Enable(MxBool p_enable) } // OFFSET: LEGO1 0x100b5310 -char *PresenterNameDispatch(MxDSAction *p_action) +char *PresenterNameDispatch(const MxDSAction &p_action) { - char *name = p_action->GetSourceName(); + char *name = p_action.GetSourceName(); MxS32 format; if (!name || strlen(name) == 0) { - switch (p_action->GetType()) { + switch (p_action.GetType()) { case MxDSType_Anim: - format = ((MxDSAnim*)p_action)->GetMediaFormat(); + format = ((MxDSAnim&)p_action).GetMediaFormat(); switch (format) { case FOURCC(' ', 'F', 'L', 'C'): - name = !p_action->IsLooping() ? + name = !p_action.IsLooping() ? "MxFlcPresenter" : "MxLoopingFlcPresenter"; break; case FOURCC(' ', 'S', 'M', 'K'): - name = !p_action->IsLooping() ? + name = !p_action.IsLooping() ? "MxSmkPresenter" : "MxLoopingSmkPresenter"; break; @@ -182,10 +182,10 @@ char *PresenterNameDispatch(MxDSAction *p_action) break; case MxDSType_Sound: - format = ((MxDSSound*)p_action)->GetMediaFormat(); + format = ((MxDSSound&)p_action).GetMediaFormat(); switch(format) { case FOURCC(' ', 'M', 'I', 'D'): - name = !p_action->IsLooping() ? + name = !p_action.IsLooping() ? "MxMIDIPresenter" : "MxLoopingMIDIPresenter"; break; diff --git a/LEGO1/mxpresenter.h b/LEGO1/mxpresenter.h index 06ef2f54..1537d2d3 100644 --- a/LEGO1/mxpresenter.h +++ b/LEGO1/mxpresenter.h @@ -84,6 +84,6 @@ class MxPresenter : public MxCore MxPresenter *m_unkPresenter; // 0x3c }; -char *PresenterNameDispatch(MxDSAction *); +char *PresenterNameDispatch(const MxDSAction &); #endif // MXPRESENTER_H