Page 1 of 1

pointer to a eq2packet ?

Posted: Fri Mar 29, 2019 3:58 am
by Ememjr
i have a pointer to masterPacket that contains a eq2packet
for a test
i would like to work with a copy of the eq2packet above so that while i am manipulating it i dont screw up the orginal data

but i am unsure of the proper coding


EQ2Packet *masterPacket2; creates the new temp var

now i want that pointer to point to a copy of the orginal masterPacket

QueuePacket(master_achievement_list.GetAchievementPacket()); this is orginal
i want QueuePacket(masterPacket2); that points to the copy

then i want to delete all references of the copy till needed

i wnated to add the reason for this is we are queue the packet masterPacket to the client, during the process of sneding out that packet the EQstream deletes the packet at delete p; once deleted future logins by any client can no longer use it
if i can create a copy at login, then send the pointer to the copy then getting deleted is no problem since we only need it once per log in

Code: Select all

#ifdef LE_DEBUG
		LogWrite(PACKET__DEBUG, 0, "Packet", "Chunk: ");
		DumpPacket(out);
		cerr << "1: Deleting 0x" << hex << (uint32)(p) << dec << endl;
#endif

		delete p;
	} else {
		SequencedPush(p);
	}
}

Re: pointer to a eq2packet ?

Posted: Fri Mar 29, 2019 6:38 am
by Ememjr
This has been resolved, thanks to theFoof and tyrbo

by changing this

Code: Select all

QueuePacket(master_achievement_list.GetAchievementPacket())
to this

Code: Select all

QueuePacket(master_achievement_list.GetAchievementPacket()->copy())