The 2nd section isn't doing any work whatsoever, as you said it's just a pointer. The "magic" happens in the first section. See, a lot of the data behaves like what you might know better as a "union", with the same memory being handled in different ways depending on how it's accessed. The first part (a "typecast") tells the compiler something like "whatever data happens to be here, treat it as though it were in the format specified by PCHARINFO"
Looking through the source, PCHARINFO is defined (in EQData.h) as a pointer to a struct of type _CHARINFO. The beginning of this struct looks something like this
Code: Select all
typedef struct _CHARINFO {
/*0x0000*/ BYTE Unknown0x0[0x4];
/*0x0004*/ BYTE field_4;
/*0x0005*/ BYTE Padding0x5;
/*0x0006*/ CHAR Name[0x40];
/*0x0046*/ CHAR Lastname[0x20];
so let's suppose I have a pointer, pJoebob which, for argument's sake, points to a character string that looks like this "I am the mighty Joebob! All your base are belong to us!" Now, suppose for some reason, I were to do ((PCHARINFO)pJoebob)->Name, in a strcpy() or whatever...this would point to "he mighty Joebob..." and so on, eventually hitting a null-character and returning a "meaningful" (although somewhat odd) string. If, however, I did ((PCHARINFO)pJoebob)->Lastname I'd be pointing at data well beyond the end of my "real" Joebob string, and frog-knows what might happen. In practice, we only use the typecast when we expect pCharData (whatever "type" of pointer the compiler thinks it is at the moment) to point to something in the _CHARINFO layout, and everything works out peachy.
I hope that makes some sort of sense. I'm relatively new myself, and perhaps not the best instructor. :)