PDA

View Full Version : Question about player struct init



Shakar
06-13-2003, 11:34 PM
I've been trying to read and follow through the code for a few hours now, and was wondering off hand if someone can save me the time and give me an idea of where the inital player struct is read into the SEQ interface at? IE when you first log into EQ, and maybe when you zone if that triggers it as well, all the stats and everything.. I tried to follow the path, from main but it got confusing fast. I know there is some kind of a signal that triggers something but I couldnt figure out what that something is =)
Thanks in advance

fester
06-14-2003, 12:20 AM
case CharProfileCode: // Character Profile server to client

Shakar
06-14-2003, 07:49 AM
Thanks fester, now here is where I get lost



void EQPacket::dispatchDecodedCharProfile(const uint8_t* decodedData, uint32_t decodedDataLen)
{
ValidateDecodedPayload(CharProfileCode, charProfileStruct);
//logData ("/tmp/charprofile.log", decodedDataLen, decodedData);
emit backfillPlayer((const charProfileStruct*)decodedData, decodedDataLen, DIR_SERVER);
}


I assume that the validate function just checks to make sure the contents are what the claim to be, but what does the next line do? Does it trigger a Signal? (I've never programmed in linux, just winblows). And I assume a signal is similar to a timer, and there are things waiting for timers to be tripped. I found the declaration for the signal in packet.h and another instance of it in interface.h (associated with a different class). But what I can't figure out is there doesn't appear to be an implementation of those functions anywhere, so what exactly runs when that signal is triggered?
Thanks!

Shakar
06-14-2003, 08:30 AM
Ok I think i figured it out, I was hung up on the fact that these signals were being declared but never implemented, but it appears thats exactly what they are, functions without implementations, and when they are triggered or called they simply pass data? Gotta love API docs from QT =)

suseuser7341
06-14-2003, 11:41 AM
Please read first:

http://doc.trolltech.com/3.0/signalsandslots.html

Then grep for backfillPlayer brings up:

connect(m_packet, SIGNAL(backfillPlayer(const charProfileStruct*, uint32_t, uint8_t)),
m_player, SLOT(backfill(const charProfileStruct*)));
and
connect (m_packet, SIGNAL(backfillPlayer(const charProfileStruct *, uint32_t, uint8_t)),
m_pktLogger, SLOT(logCharProfile(const charProfileStruct *, uint32_t, uint8_t)));

both in interface.cpp.
First one is the one you are looking for: whenever backfillPlayer is emitted in Object m_packet then Slot (or method if you like more) backfill of object m_player (which is instance of Player) is called.

Please correct me if I am wrong, but that is it how I understood this signal stuff.