From e88fd1dcef52d4375fef655918886fc14bb1f40c Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 15 Mar 2012 02:54:33 +0100 Subject: optimisations to reduce code size --- include/statelib.h | 45 +++++++-------------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) (limited to 'include') diff --git a/include/statelib.h b/include/statelib.h index e65f33a..22e1de9 100644 --- a/include/statelib.h +++ b/include/statelib.h @@ -1,3 +1,6 @@ +// This is no longer totally accurate to Nintendo's version. +// Should still work for Newer, though. + /******************************************************************************/ // dStateBase_c class /******************************************************************************/ @@ -14,6 +17,10 @@ public: virtual bool isSameStateName(const char *name); virtual const char *getName(); virtual int getID(); + virtual void doBegin(void *owner); + virtual void doExecute(void *owner); + virtual void doEnd(void *owner); + static dStateBase_c mNoState; @@ -40,13 +47,6 @@ public: mEnd = end; } - ~dState_c(); - bool isSameStateName(const char *name); - - virtual void doBegin(TOwner *owner); - virtual void doExecute(TOwner *owner); - virtual void doEnd(TOwner *owner); - funcPtr mBegin; funcPtr mExecute; funcPtr mEnd; @@ -54,37 +54,6 @@ public: void *mBaseState; }; -template -dState_c::~dState_c() { } - -template -bool dState_c::isSameStateName(const char *name) { - const char *p = strrchr(name, ':'); - if (p) - name = p + 1; - - int cmp = strcmp(strrchr(getName(), ':')+1, name); - if (cmp == 0) - return true; - else - return false; -} - -template -void dState_c::doBegin(TOwner *owner) { - (owner->*mBegin)(); -} - -template -void dState_c::doExecute(TOwner *owner) { - (owner->*mExecute)(); -} - -template -void dState_c::doEnd(TOwner *owner) { - (owner->*mEnd)(); -} - /******************************************************************************/ // A Very Useless Class /******************************************************************************/ -- cgit v1.2.3