mirror of https://github.com/OpenTTD/OpenTTD
Codefix: add move operators to SQObjectPtr
parent
35ef197be4
commit
2b88f58384
|
@ -161,6 +161,14 @@ struct SQObjectPtr : public SQObject
|
|||
_unVal=o._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)
|
||||
{
|
||||
SQ_OBJECT_RAWINIT()
|
||||
|
@ -330,6 +338,12 @@ struct SQObjectPtr : public SQObject
|
|||
__Release(tOldType,unOldVal);
|
||||
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)
|
||||
{
|
||||
SQObjectType tOldType;
|
||||
|
|
Loading…
Reference in New Issue