Re: [Freeciv-Dev] spaceship buglet
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
David Pfitzner <dwp@xxxxxxxxxxxxxx> writes:
> Correct. There was once (long ago) a patch to introduce
> functions to get/put signed ints, but it wasn't included
> (maybe it wasn't good, I don't know). A consistent/safe
> way of doing this would be nice.
>
> Currently individual entries do things like:
> if(packet->shield_surplus > 32767) packet->shield_surplus-=65536;
Shouldn't this be consolidated? I mean, replace all instances of
cptr=get_int16(cptr, &packet->shield_surplus);
if(packet->shield_surplus > 32767) packet->shield_surplus-=65536;
with
cptr=get_signed_int16(cptr, &packet->shield_surplus);
where get_signed_int16 takes care of subtracting 65536 when needed.
Similarly for get_signed_int8 and get_signed_int32 (important to
support 64-bit machines).
Massimo
|
|