sourcehook/test/testevents.h
changeset 49 ec95d7681407
parent 48 a52dba4f8ed9
child 50 4b6bbaf375dc
     1.1 --- a/sourcehook/test/testevents.h	Sun May 01 12:36:48 2005 +0000
     1.2 +++ b/sourcehook/test/testevents.h	Sun May 01 14:30:52 2005 +0000
     1.3 @@ -72,5 +72,28 @@
     1.4  
     1.5  #define CHECK_STATES(mwah, myerr) if (!StatesOk mwah) { error=myerr; return false; }
     1.6  
     1.7 +#define MAKE_STATE(name) struct name : State {};
     1.8 +#define MAKE_STATE_1(name, p1_type) struct name : State { \
     1.9 +		p1_type m_Param1; \
    1.10 +		name(p1_type param1) : m_Param1(param1) {} \
    1.11 +		virtual bool IsEqual(State *other) { \
    1.12 +			name *other2 = dynamic_cast<name*>(other); \
    1.13 +			if (!other2) \
    1.14 +				return false; \
    1.15 +			return other2->m_Param1 == m_Param1;\
    1.16 +		} \
    1.17 +	}
    1.18 +
    1.19 +#define MAKE_STATE_2(name, p1_type, p2_type) struct name : State { \
    1.20 +		p1_type m_Param1; \
    1.21 +		p2_type m_Param2; \
    1.22 +		name(p1_type param1, p2_type param2) : m_Param1(param1), m_Param2(param2) {} \
    1.23 +		virtual bool IsEqual(State *other) { \
    1.24 +			name *other2 = dynamic_cast<name*>(other); \
    1.25 +			if (!other2) \
    1.26 +				return false; \
    1.27 +			return other2->m_Param1 == m_Param1 && other2->m_Param2 == m_Param2;\
    1.28 +		} \
    1.29 +	}
    1.30  #endif
    1.31