|
COPY_DEF defines the
copy_common method, which is called during execution of
api_copy_entity to transfer information from the "from" entity to "this" entity. The list is used to map entity pointers to an index in the copy array.
|
|
|
Signature
|
|
|
void MY_ENTITY::copy_common( ENTITY_LIST &list, MY_ENTITY const *from )
|
|
|
Implementation
|
|
|
Most data can be copied by a simple assignment. For example:
|
|
|
my_data = from->my_data;
|
|
|
Pointers to
ENTITYs are handled specially, as they need to be re-mapped to point to the copy of the original data. For example, to copy a pointer to
MY_ENTITY use:
|
|
|
my_entity_ptr = (MY_ENTITY *)list.lookup( from->my_entity_ptr );
|