diff --git a/LEGO1/compat.h b/LEGO1/compat.h index c682dc0e..a182b0fc 100644 --- a/LEGO1/compat.h +++ b/LEGO1/compat.h @@ -18,13 +18,11 @@ // STL compatibility. #if defined(_MSC_VER) && _MSC_VER <= MSVC420_VERSION -#include +#include "mxstl.h" #else #include #include using namespace std; -template -using List = list; #endif // We use `override` so newer compilers can tell us our vtables are valid, diff --git a/LEGO1/mxnotificationmanager.h b/LEGO1/mxnotificationmanager.h index e313510b..1c2aee7c 100644 --- a/LEGO1/mxnotificationmanager.h +++ b/LEGO1/mxnotificationmanager.h @@ -28,10 +28,10 @@ class MxNotification MxParam *m_param; // 0x4 }; -class MxIdList : public List +class MxIdList : public list {}; -class MxNotificationPtrList : public List +class MxNotificationPtrList : public list {}; // VTABLE 0x100dc078 diff --git a/LEGO1/mxstl.h b/LEGO1/mxstl.h new file mode 100644 index 00000000..8ee3d1dd --- /dev/null +++ b/LEGO1/mxstl.h @@ -0,0 +1,218 @@ +#ifndef MXSTL_H +#define MXSTL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef _MSC_VER +/* + * Currently, all MS C compilers for Win32 platforms default to 8 byte + * alignment. + */ +#pragma pack(push,8) +#endif // _MSC_VER + +template +class Deque : public deque<_TYPE, allocator<_TYPE> > +{ +public: + typedef Deque<_TYPE> _Myt; + typedef allocator<_TYPE> _A; + + explicit Deque(const _A& _Al = _A()) : deque<_TYPE, _A>(_Al) + {} + + explicit Deque(size_type _N, const _TYPE& _V = _TYPE()) : deque<_TYPE, _A>(_N, _V) + {} + + void swap(_Myt& _X) + { + deque<_TYPE, _A>::swap((deque<_TYPE, _A>&)_X); + } + + friend void swap(_Myt& _X, _Myt& _Y) + { + _X.swap(_Y); + } +}; + +template +class List : public list<_TYPE, allocator<_TYPE> > +{ +public: + typedef List<_TYPE> _Myt; + typedef allocator<_TYPE> _A; + + explicit List() : list<_TYPE, _A>() + {} + + explicit List(size_type _N, const _TYPE& _V = _TYPE()) : list<_TYPE, _A>(_N, _V) + {} + + void swap(_Myt& _X) + { + list<_TYPE, _A>::swap((list<_TYPE, _A>&)_X); + } + + friend void swap(_Myt& _X, _Myt& _Y) + { + _X.swap(_Y); + } +}; + +template +class Map : public map<_K, _TYPE, _Pr, allocator<_TYPE> > +{ +public: + typedef Map<_K, _TYPE, _Pr> _Myt; + typedef allocator<_TYPE> _A; + + explicit Map(const _Pr& _Pred = _Pr()) + : map<_K, _TYPE, _Pr, _A>(_Pred) + {} + + void swap(_Myt& _X) + { + map<_K, _TYPE, _Pr, _A>::swap((map<_K, _TYPE, _Pr, _A>&)_X); + } + + friend void swap(_Myt& _X, _Myt& _Y) + { + _X.swap(_Y); + } +}; + +template +class Multimap : public multimap<_K, _TYPE, _Pr, allocator<_TYPE> > +{ +public: + typedef Multimap<_K, _TYPE, _Pr> _Myt; + typedef allocator<_TYPE> _A; + + explicit Multimap(const _Pr& _Pred = _Pr()) : multimap<_K, _TYPE, _Pr, _A>(_Pred) + {} + + void swap(_Myt& _X) + { + multimap<_K, _TYPE, _Pr, _A>::swap((multimap<_K, _TYPE, _Pr, _A>&)_X); + } + + friend void swap(_Myt& _X, _Myt& _Y) + { + _X.swap(_Y); + } +}; + +template +class Set : public set<_K, _Pr, allocator<_K> > +{ +public: + typedef Set<_K, _Pr> _Myt; + typedef allocator<_K> _A; + + explicit Set(const _Pr& _Pred = _Pr()) : set<_K, _Pr, _A>(_Pred) + {} + + void swap(_Myt& _X) + { + set<_K, _Pr, _A>::swap((set<_K, _Pr, _A>&)_X); + } + + friend void swap(_Myt& _X, _Myt& _Y) + { + _X.swap(_Y); + } +}; + +template +class Multiset : public multiset<_K, _Pr, allocator<_K> > +{ +public: + typedef Multiset<_K, _Pr> _Myt; + typedef allocator<_K> _A; + + explicit Multiset(const _Pr& _Pred = _Pr()) + : multiset<_K, _Pr, _A>(_Pred) + {} + + void swap(_Myt& _X) + { + multiset<_K, _Pr, _A>::swap((multiset<_K, _Pr, _A>&)_X); + } + + friend void swap(_Myt& _X, _Myt& _Y) + { + _X.swap(_Y); + } +}; + +template +class Vector : public vector<_TYPE, allocator<_TYPE> > +{ +public: + typedef Vector<_TYPE> _Myt; + typedef allocator<_TYPE> _A; + + explicit Vector(const _A& _Al = _A()) : vector<_TYPE, _A>(_Al) + {} + + void swap(_Myt& _X) + { + vector<_TYPE, _A>::swap((vector<_TYPE, _A>&)_X); + } + + friend void swap(_Myt& _X, _Myt& _Y) + { + _X.swap(_Y); + } +}; + +template +class Priority_queue : public priority_queue<_C::value_type, _C, _Pr, _C::allocator_type> +{ +public: + typedef _C::value_type _TYPE; + typedef _C::allocator_type _A; + typedef _C::allocator_type allocator_type; + + explicit Priority_queue(const _Pr& _X = _Pr(), const _C::allocator_type& _Al = _C::allocator_type()) : priority_queue<_C::value_type, _C, _Pr, _C::allocator_type>(_X, _Al) + {} +}; + +template +class Queue : public queue<_C::value_type, _C, _C::allocator_type> +{}; + +template +class Stack : public stack<_C::value_type, _C, _C::allocator_type> +{}; + +#define deque Deque +#define list List +#define map Map +#define multimap Multimap +#define set Set +#define multiset Multiset +#define vector Vector +#define priority_queue Priority_queue +#define queue Queue +#define stack Stack + +#ifdef _MSC_VER +#pragma pack(pop) +#endif + +#endif // MXSTL_H diff --git a/LEGO1/mxticklemanager.h b/LEGO1/mxticklemanager.h index 103d3721..cc7b6282 100644 --- a/LEGO1/mxticklemanager.h +++ b/LEGO1/mxticklemanager.h @@ -53,7 +53,7 @@ class MxTickleClient MxU16 m_flags; // 0xc }; -class MxTickleClientPtrList : public List +class MxTickleClientPtrList : public list {}; // VTABLE 0x100d86d8