pointer to a eq2packet ?

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

pointer to a eq2packet ?

Post by Ememjr » Fri Mar 29, 2019 3:58 am

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);
	}
}

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: pointer to a eq2packet ?

Post by Ememjr » Fri Mar 29, 2019 6:38 am

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())

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest