sent in updateSelf. As for the packet order, I am pretty sure that
sndPStatus (which is called from updateShips) is sent before sndSelf
(which is called from updateSelf), as I could monitor client-side that
your status is changed 1 update before your whydead is updated. However,
I cannot find the exact line(s) of code where this order is determined.
It might be in the fatten packet part of the UDP code. I know the packets
are ordered by type via packets.h, but then the flushsockbuf function
starts stuffing packets in that fit, so I really am lost as to packet
order.
I do know that in the sndSelf function, when whydead changes, it is sent
high priority by TCP rather than UDP. And I tested this patch to see that
indeed, whydead is sent for observers on geno.
>
> 1. if the code is meant to do the same thing, add a new static
> function, such as sp_s_you_criticality() or something, and call that
> function from both places that do this same thing ... this is called
> factoring,
>
Yes it is meant to do the same thing, I can factorize it, however there is
one line I am not sure of. In the updateSelf function, the way it
determines whether to use sndSelf or sndSSelf is by the following:
if(send_short && me->p_fuel < 61000 ) { /* A little margin ... */
I am not sure why it looks at fuel, whereas for other places in the code
it just checks send_short.
> It might also be time to make 0x40 and 0x80 more formally declared.
> Interesting that it causes server packets to be restricted to 0-63 type
> codes, wasting bits in the type char. Perhaps some day we should change
> sendClientPacket to remove this prioritisation overload.
>
Regarding the semicritical packets (0x40), I can't figure out how the
sendSC function works either :). Specifically, what line checks to send
the packet only if sequence number is 0x40?