mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
548f939df5
separate tracker type by #defining __TRACKER_NAME and __TRACKER_GLOBAL_OFFSET. eg.: Then if you have a tracked value and a value of the same type at the given offset: Tracker_1<int32_t> trackedInt; int32_t trackedIntDirty = 0; // 4 bytes after trackedIntDirty will become 1 everytime trackedInt changes. git-svn-id: https://svn.eduke32.com/eduke32@3119 1a8010ca-5511-0410-912e-c29ae57300e0
39 lines
984 B
C++
39 lines
984 B
C++
|
|
|
|
template<typename TrackedType>
|
|
class __TRACKER_NAME
|
|
{
|
|
TrackedType TrackedValue;
|
|
|
|
public:
|
|
TrackedType operator = (TrackedType);
|
|
TrackedType operator = (__TRACKER_NAME<TrackedType>);
|
|
TrackedType operator += (TrackedType);
|
|
TrackedType operator += (__TRACKER_NAME<TrackedType>);
|
|
|
|
operator TrackedType();
|
|
};
|
|
|
|
enum {
|
|
__TRACKER_NOOP_RIGHTHAND_EQUAL = 0,
|
|
__TRACKER_NOOP_RIGHTHAND_ZERO,
|
|
__TRACKER_NEVER,
|
|
};
|
|
|
|
#define __TRACKER_RIGHTHAND_TYPE __TRACKER_NAME<TrackedType> rightHand
|
|
#define __TRACKER_RIGHTHAND rightHand.TrackedValue
|
|
#include "tracker_operators.hpp"
|
|
#undef __TRACKER_RIGHTHAND_TYPE
|
|
#undef __TRACKER_RIGHTHAND
|
|
|
|
#define __TRACKER_RIGHTHAND_TYPE TrackedType rightHand
|
|
#define __TRACKER_RIGHTHAND rightHand
|
|
#include "tracker_operators.hpp"
|
|
#undef __TRACKER_RIGHTHAND_TYPE
|
|
#undef __TRACKER_RIGHTHAND
|
|
|
|
template<typename TrackedType>
|
|
__TRACKER_NAME<TrackedType>::operator TrackedType()
|
|
{
|
|
return this->TrackedValue;
|
|
}
|