diff options
Diffstat (limited to 'src/objdef.cpp')
-rw-r--r-- | src/objdef.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/objdef.cpp b/src/objdef.cpp index 08d6844fc..482544d37 100644 --- a/src/objdef.cpp +++ b/src/objdef.cpp @@ -182,3 +182,22 @@ bool ObjDefManager::decodeHandle(ObjDefHandle handle, u32 *index, *uid = get_bits(handle, 24, 7); return true; } + +// Cloning + +void ObjDef::cloneTo(ObjDef *def) const +{ + def->index = index; + def->uid = uid; + def->handle = handle; + def->name = name; +} + +void ObjDefManager::cloneTo(ObjDefManager *mgr) const +{ + mgr->m_ndef = m_ndef; + mgr->m_objects.reserve(m_objects.size()); + for (const auto &obj : m_objects) + mgr->m_objects.push_back(obj->clone()); + mgr->m_objtype = m_objtype; +} |