AndrewBGS
Member
|
Dynamic Duplicate Object
how would I go about this? The Item NO COPY CONSTRUCTOR forbids me to do it the simple way, but I really need to duplicate an object inside the application. I'm sure I'm not asking for the impossible here, what if my character is a mage and can multiply an object or something?
The best I got so far was saving among all the other Item parameters the actual ObjParamsPtr parameters pointer which was used to create the item in the first place and use that to create the item again. But I'm fairly sure this is inefficient. Isn't there a better way?
|
|
07-01-2013 09:36 AM |
|
Rofar
Member
|
RE: Dynamic Duplicate Object
Just save the UID of the element used to create the item.
|
|
07-01-2013 01:06 PM |
|
AndrewBGS
Member
|
RE: Dynamic Duplicate Object
Is that any different than saving the params pointer?
Sure I'll try it, it will probably work, but is it any better?
|
|
07-01-2013 01:21 PM |
|
Rubeus
Member
|
RE: Dynamic Duplicate Object
There's a few ways you could go about this. You could implement a CopyTo( item &dest ) function and just do Item b; existing.CopyTo( b ); Items.add( b ); or something similar. Copying like that is not inefficient-less so than accidentally making copies of your items via bugs from using =.
|
|
07-01-2013 07:13 PM |
|