I'm having trouble determining the laps done value from the IS_RES (results) packet. I'm reading of a short value (2 byte unsigned) at byte position 78 (to 79) and it is returning 1024 on 1-5 lap races consistently.
Am I reading the wrong value, the wrong datatype, or is this a bug in insim 4?
Just done quick 1 lap test on ogHosts #1 with a project I'm working on (I was yet to get to IS_RES), but I'm definately receiving the correct number of laps done (yes I've not finished teaching it about all the packets yet either - laps done is in that mess somewhere);
typedef struct // RESult (qualify or confirmed finish) { byte Size; // 84 byte Type; // ISP_RES byte ReqI; // 0 unless this is a reply to a TINY_RES request byte PLID; // player's unique id (0 = player left before result was sent)
char UName[24]; // username char PName[24]; // nickname char Plate[8]; // number plate - NO ZERO AT END! char CName[4]; // skin prefix
unsigned TTime; // race time (ms) unsigned BTime; // best lap (ms)
byte SpA; byte NumStops; // number of pit stops byte Confirm; // confirmation flags : disqualified etc - see below byte SpB;
word LapsDone; // laps completed word Flags; // player flags : help settings etc - see below
byte ResultNum; // finish or qualify pos (0 = win / 255 = not added to table) byte NumRes; // total number of results (qualify doesn't always add a new one) word PSeconds; // penalty time in seconds (already included in race time) } __attribute__ ((packed)) IS_RES;
I found the problem in my code, it was simply a case of tired eyes not being able to count the offset correctly. Fresh eyes fixed it
Thanks guys.
BTW Scawen: Could I please ask for a new insim command *ducks* ? Whilst programming i've found I have a need to know the currently loaded layout. I could keep track when I load it by writing the name to a file, but i'm concerned about loosing sync if the software has any downtime [and fiddling admins ] and I like to build things as robust as I can.
A crash bug preventable on host side forces me to release an X2 dedicated host very soon. So I'm considering this autocross request.
This is what I've come up with (three packets) :
Request : TINY_AXI - get autocross info
Info : TINY_AXC - autocross cleared
New packet : IS_AXI - autocross info - sent on loading layout or TINY_AXI request
byte Size; // 40
byte Type; // ISP_AXI
byte ReqI; // As received in TINY_AXI
byte Zero;
byte Flags; // autocross start / split1 / split2 / split3 / finish line
byte Spare;
word NumObjects;
char LayoutName[32];
LayoutName would be blank if the layout was loaded by an admin, from the admin's own computer, but it would be valid if the layout was loaded from the host's own layout folder. NumObjects would always be valid.
Is there any other info that would be useful? Maybe those flags are already useless - I was just trying to think of other relevant autocross info.
You have friends. People on the internet can be your friends. I have lots of people on the internet I'm friends with. Some of them are much cooler people then the guys / girls I do hang out with.