mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-07-04 19:39:42 +01:00
Codefix: add move operators to SQObjectPtr
This commit is contained in:
parent
35ef197be4
commit
2b88f58384
14
src/3rdparty/squirrel/squirrel/sqobject.h
vendored
14
src/3rdparty/squirrel/squirrel/sqobject.h
vendored
@ -161,6 +161,14 @@ struct SQObjectPtr : public SQObject
|
|||||||
_unVal=o._unVal;
|
_unVal=o._unVal;
|
||||||
__AddRef(_type,_unVal);
|
__AddRef(_type,_unVal);
|
||||||
}
|
}
|
||||||
|
SQObjectPtr(SQObjectPtr &&o)
|
||||||
|
{
|
||||||
|
SQ_OBJECT_RAWINIT()
|
||||||
|
this->_type = OT_NULL;
|
||||||
|
this->_unVal.pUserPointer = nullptr;
|
||||||
|
std::swap(this->_type, o._type);
|
||||||
|
std::swap(this->_unVal, o._unVal);
|
||||||
|
}
|
||||||
SQObjectPtr(const SQObject &o)
|
SQObjectPtr(const SQObject &o)
|
||||||
{
|
{
|
||||||
SQ_OBJECT_RAWINIT()
|
SQ_OBJECT_RAWINIT()
|
||||||
@ -330,6 +338,12 @@ struct SQObjectPtr : public SQObject
|
|||||||
__Release(tOldType,unOldVal);
|
__Release(tOldType,unOldVal);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
inline SQObjectPtr& operator=(SQObjectPtr &&obj)
|
||||||
|
{
|
||||||
|
std::swap(this->_type, obj._type);
|
||||||
|
std::swap(this->_unVal, obj._unVal);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
inline SQObjectPtr& operator=(const SQObject& obj)
|
inline SQObjectPtr& operator=(const SQObject& obj)
|
||||||
{
|
{
|
||||||
SQObjectType tOldType;
|
SQObjectType tOldType;
|
||||||
|
Loading…
Reference in New Issue
Block a user