Originally Posted By: EvilSOB
If you're still interested Aku, here is an ALMOST elegant way of doing it...
Complete duplication, including "prime" action, and its fully tested too.
Code:
action MyAction()
{
	my.skill99 = (void*)MyAction;
	...
}

action YourAction()
{
	my.skill99 = (void*)YourAction;
	...
}

ENTITY* ent_duplicate(ENTITY* source_ent)
{
	ENTITY* target_ent = ent_create(source_ent.type, 0, (void*)source_ent.skill99);
	memcpy(&target_ent.x, &source_ent.x, sizeof(ENTITY)-(sizeof(C_LINK)+sizeof(var)));
	//	ent_clone(target_ent);	//if required
	return(target_ent);
}



This seems not to be an good solution. 32 Bit Void Pointer are 32 Bits (4 bytes) big and 64 Bit Pointer are 64 Bits (8 Bytes) big.
The problem is, that the 32 Bit size of the skill variable won't increase when you use 64 Bit. So it is possible that you save a wrong pointer which can cause terrible bugs.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com