mirror of
https://github.com/ZDoom/Raze.git
synced 2024-12-16 15:41:16 +00:00
a0dd0c85a5
arrays; any write access to them will run the corresponding hook and write to the [sector/wall/sprite/tsprite]clean array. Note: tsprite and sprite use the same hook and require running a few more instructions per access in order to disambiguiate; this could be made more optimal (like the other arrays) by clearly separating the types in the game code. Note #2: taking a member's address currently marks it dirty because of tons of helper functions across the editor code. I don't know how many read-only accesses we have after taking a member address, but it could also be fixed with some finessing of the code. git-svn-id: https://svn.eduke32.com/eduke32@3138 1a8010ca-5511-0410-912e-c29ae57300e0
100 lines
2.9 KiB
C++
100 lines
2.9 KiB
C++
|
|
|
|
template<typename TrackedType>
|
|
class __TRACKER_NAME
|
|
{
|
|
TrackedType TrackedValue;
|
|
|
|
public:
|
|
inline TrackedType* operator & ()
|
|
{
|
|
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
|
|
return &this->TrackedValue;
|
|
}
|
|
|
|
inline TrackedType operator ++ ()
|
|
{
|
|
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
|
|
return ++this->TrackedValue;
|
|
}
|
|
|
|
inline TrackedType operator ++ (int)
|
|
{
|
|
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
|
|
return this->TrackedValue++;
|
|
}
|
|
|
|
inline TrackedType operator -- ()
|
|
{
|
|
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
|
|
return --this->TrackedValue;
|
|
}
|
|
|
|
inline TrackedType operator -- (int)
|
|
{
|
|
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
|
|
return this->TrackedValue--;
|
|
}
|
|
|
|
inline TrackedType operator = (TrackedType);
|
|
inline TrackedType operator = (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline TrackedType operator += (TrackedType);
|
|
inline TrackedType operator += (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline TrackedType operator -= (TrackedType);
|
|
inline TrackedType operator -= (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline TrackedType operator *= (TrackedType);
|
|
inline TrackedType operator *= (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline TrackedType operator /= (TrackedType);
|
|
inline TrackedType operator /= (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline TrackedType operator |= (TrackedType);
|
|
inline TrackedType operator |= (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline TrackedType operator &= (TrackedType);
|
|
inline TrackedType operator &= (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline TrackedType operator ^= (TrackedType);
|
|
inline TrackedType operator ^= (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline TrackedType operator <<= (TrackedType);
|
|
inline TrackedType operator <<= (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline TrackedType operator >>= (TrackedType);
|
|
inline TrackedType operator >>= (__TRACKER_NAME<TrackedType>);
|
|
|
|
inline operator TrackedType() const;
|
|
};
|
|
|
|
#ifndef __tracker_hpp
|
|
#define __tracker_hpp
|
|
|
|
enum {
|
|
__TRACKER_NOOP_RIGHTHAND_EQUAL = 0,
|
|
__TRACKER_NOOP_RIGHTHAND_ZERO,
|
|
__TRACKER_NOOP_RIGHTHAND_ONE,
|
|
__TRACKER_NEVER,
|
|
};
|
|
|
|
#endif
|
|
|
|
#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() const
|
|
{
|
|
return this->TrackedValue;
|
|
}
|