About Store Forum Documentation Contact
Donations:
225$/mo



Post Reply 
Dynamic Duplicate Object
Author Message
AndrewBGS Offline
Member

Post: #1
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
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #2
RE: Dynamic Duplicate Object
Just save the UID of the element used to create the item.
07-01-2013 01:06 PM
Find all posts by this user Quote this message in a reply
AndrewBGS Offline
Member

Post: #3
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
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #4
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
Find all posts by this user Quote this message in a reply
Post Reply