From 1180e1f4860d62bccd64bfa2a29eaeebd2c4b019 Mon Sep 17 00:00:00 2001 From: robojumper Date: Thu, 12 Sep 2024 22:36:34 +0200 Subject: m3d (#13) * Initial M3d Pass * `m_bmdl` and `m_bline` left --------- Co-authored-by: elijah-thomas774 Co-authored-by: Elijah Thomas <42302100+elijah-thomas774@users.noreply.github.com> --- include/s/README.txt | 6 ++++++ include/s/s_StateID.hpp | 4 ++-- include/s/s_StateInterfaces.hpp | 4 ++-- include/s/s_StateMgr.hpp | 5 +++++ 4 files changed, 15 insertions(+), 4 deletions(-) (limited to 'include/s') diff --git a/include/s/README.txt b/include/s/README.txt index 00e8279e..53c6cb63 100644 --- a/include/s/README.txt +++ b/include/s/README.txt @@ -16,3 +16,9 @@ In order for vtable ordering to match, some classes had to be extracted to a new S_StateMethod_c's destructors calls back into another destructors. sStateMethodIf_c follows the example of the other abstract interface classes and provides this dtor. + +## operator== / != return BOOL instead of bool + +We're observing a lot of word-to-bool casts in code after these +operators are invoked, and while there are ways to force the conversion, +this seems the most reasonable. diff --git a/include/s/s_StateID.hpp b/include/s/s_StateID.hpp index 422d9143..4c2ee84f 100644 --- a/include/s/s_StateID.hpp +++ b/include/s/s_StateID.hpp @@ -27,8 +27,8 @@ public: virtual bool isNull() const; virtual bool isEqual(const sStateIDIf_c &other) const; - virtual bool operator==(const sStateIDIf_c &other) const; - virtual bool operator!=(const sStateIDIf_c &other) const; + virtual BOOL operator==(const sStateIDIf_c &other) const; + virtual BOOL operator!=(const sStateIDIf_c &other) const; virtual bool isSameName(const char *name) const; virtual const char *name() const; diff --git a/include/s/s_StateInterfaces.hpp b/include/s/s_StateInterfaces.hpp index 8e28f44c..92101b2c 100644 --- a/include/s/s_StateInterfaces.hpp +++ b/include/s/s_StateInterfaces.hpp @@ -23,8 +23,8 @@ public: virtual bool isNull() const = 0; ///< Returns whether this is a null state. virtual bool isEqual(const sStateIDIf_c &other) const = 0; ///< Returns whether both states have the same number. - virtual bool operator==(const sStateIDIf_c &other) const = 0; ///< Overloaded equality operator, using ::isEqual. - virtual bool operator!=(const sStateIDIf_c &other) const = 0; ///< Overloaded inequality operator, using ::isEqual. + virtual BOOL operator==(const sStateIDIf_c &other) const = 0; ///< Overloaded equality operator, using ::isEqual. + virtual BOOL operator!=(const sStateIDIf_c &other) const = 0; ///< Overloaded inequality operator, using ::isEqual. virtual bool isSameName(const char *name) const = 0; ///< Returns whether this state ID is called @p name. virtual const char *name() const = 0; ///< Returns the name of this state ID. diff --git a/include/s/s_StateMgr.hpp b/include/s/s_StateMgr.hpp index c043eb71..09f5f217 100644 --- a/include/s/s_StateMgr.hpp +++ b/include/s/s_StateMgr.hpp @@ -35,6 +35,11 @@ public: virtual const sStateIDIf_c *getStateID() const { return mMethod.getStateID(); } virtual const sStateIDIf_c *getOldStateID() const { return mMethod.getOldStateID(); } + // SS addition + bool isState(const sStateIDIf_c& other) { + return *getStateID() == other; + } + private: Check mCheck; Factory mFactory; -- cgit v1.2.3