Complete.Org: Mailing Lists: Archives: freeciv-dev: February 1999:
Re: [Freeciv-Dev] spaceship buglet
Home

Re: [Freeciv-Dev] spaceship buglet

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] spaceship buglet
From: Massimo Campostrini <campo@xxxxxxxxxxxxxxxxxxxxx>
Date: 16 Feb 1999 14:01:56 +0100
Reply-to: freeciv-dev@xxxxxxxxxxx

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

[Prev in Thread] Current Thread [Next in Thread]