PDA

Click to See Complete Forum and Search --> : CopyMemory for types


Fox
Feb 14th, 2000, 08:07 PM
Is there a way to copy a Type? I have a player type and wanted to copy it around, but I don't know which size it is. Look what I mean:

-
Type tPlayer
X as Long
Y as Long
DC as Long
End Type

Dim SrcPlayer(3) as Long 'Here are the original players stored
Dim Player(10) as tPlayer 'And these are used in the game

CopyMemory Player(0), SrcPlayer(1), SizeOf(tPlayer)

'As you can see I try to add a new player and want to copy the whole values but I don't know the size of tPlayer.
-

Any help will be great!

------------------
fox_mccloud@gmx.net
...
Every program can be reduced to one instruction which doesn't work.

KENNNY
Feb 15th, 2000, 04:13 AM
er.. cant you just do:

Player(0) = Player(1)
u can just do that as long as the two variables are of the same type.
im using that in my game with types - and it works :)
im not sure if thats waht you wnat though..

------------------
cintel rules :p
www.cintelsoftware.co.uk

Fox
Feb 15th, 2000, 04:52 AM
Oh yes, thanks alot!

As I remember it didn't work last time I tried this... maybe my mistake ;)

-Thanks again (You'll get my game for free ;) ).

------------------
fox_mccloud@gmx.net
...
Every program can be reduced to one instruction which doesn't work.