Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: Pop cost patch (resending via bug system) (PR#897)
Home

[Freeciv-Dev] Re: Pop cost patch (resending via bug system) (PR#897)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Pop cost patch (resending via bug system) (PR#897)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Aug 2001 22:30:24 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sun, Aug 19, 2001 at 01:14:45PM -0700, Trent Piepho wrote:
> On Sun, 19 Aug 2001, Raimar Falke wrote:
> > On Sun, Aug 19, 2001 at 12:52:58PM -0700, Trent Piepho wrote:
> > > On Sun, 19 Aug 2001, Arien Malec wrote:
> > > > Thought I sent this, but didn't see it on list (user error, no doubt)
> > > > 
> > > > Corrected patch is attached. Note that I tried to play nicely with the
> > > > surrounding code, and didn't do a wholesale indent -kr -i2 in the areas 
> > > > I was
> > > > editing.
> > > 
> > > When you add a new field to a packet, you should add it at the end.
> > 
> > This isn't necessary. Since the reading and writing is guarded by
> > has_cap() calls there is no problem.
> 
> Are you saying the server and client know to skip the pop_cost field if the
> capability is missing?  Or that they won't be allowed to talk at all?

Yes if 

   cptr=put_uint8(cptr, packet->move_type);
   cptr=put_uint16(cptr, packet->build_cost);
+  cptr=put_uint8(cptr, packet->pop_cost);
   cptr=put_uint8(cptr, packet->attack_strength);
   cptr=put_uint8(cptr, packet->defense_strength);

is changed to

   cptr=put_uint8(cptr, packet->move_type);
   cptr=put_uint16(cptr, packet->build_cost);
   if (pc && has_capability("pop_cost", pc->capability))
       cptr=put_uint8(cptr, packet->pop_cost);
   cptr=put_uint8(cptr, packet->attack_strength);
   cptr=put_uint8(cptr, packet->defense_strength);

and

   iget_uint8(&iter, &packet->move_type);
   iget_uint16(&iter, &packet->build_cost);
+  iget_uint8(&iter, &packet->pop_cost);
   iget_uint8(&iter, &packet->attack_strength);
   iget_uint8(&iter, &packet->defense_strength);

to
   iget_uint8(&iter, &packet->move_type);
   iget_uint16(&iter, &packet->build_cost);
   if (pc && has_capability("pop_cost", pc->capability))
       iget_uint8(&iter, &packet->pop_cost);
   else
       packet->pop_cost=0; /* 0 should be a sensible default value */
   iget_uint8(&iter, &packet->attack_strength);
   iget_uint8(&iter, &packet->defense_strength);

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Microsoft DNS service terminates abnormally when it recieves a response
  to a DNS query that was never made.
  Fix Information: Run your DNS service on a different platform."
    -- MS service information on bugtraq


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