On 2012-10-24 06:56:25 +0000, James Cameron said:
> SP_PLANET_LOC pnum= 0 x= 20000 y= 80000 name= Earth
Getting closer.
Building game packet for SP_PLANET_LOC I'm getting some whacky values
for x and y
SP_PLANET_LOC pnum=0 x=541982720 y=2151153920 name=Earth
Looking at the raw data
1a type
00 pnum
00 pad2
00 pad3
00004e20 x
00013880 y
Putting that into a test program I get the right stuff
pnum=0 x=20000 y=80000 name=Earth
Here is the struct I'm using
typedef struct _serverPacketPlanetLocationStruct
{
int8_t type; /* SP_PLANET_LOC */
int8_t pnum;
int8_t pad2;
int8_t pad3;
int32_t x;
int32_t y;
int8_t name[16];
} serverPacketPlanetLocationStruct;
Making sure the sizes is right
ServerPacketPlanetLocation 28
SP_PLANET_LOC 28
NSLog is a lot like printf, it's what I use to debug
NSLog(@"%@ pnum=%d x=%d y=%d name=%s", self, gamePacket.pnum,
gamePacket.x, gamePacket.y, gamePacket.name);
Some reason it feels like an endian issue (don't ask me why)
Posting it here for comments. It's late. I'll look at it more tomorrow night.
--
Bob Tanner <basic at us.netrek.org>
Key fingerprint = 9906 320A 8BB6 64AD 96A7 7785 CBFB 10BF 568B F98C