Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#12677) CVS: Spies get built foul, so cannot make e
Home

[Freeciv-Dev] Re: (PR#12677) CVS: Spies get built foul, so cannot make e

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: yautja@xxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#12677) CVS: Spies get built foul, so cannot make embassy
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Mar 2005 08:39:17 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12677 >

Brendon wrote:

> Should they be made foul in diplomats.c - diplomat_escape now ? Makes 
> more sense than keeping it in generic unit functions.
> 
> Only tested it by commenting out that line in unittools.c, just updated 
> my CVS and now it won't compile (plrhand.c:1462: error: structure has no 
> member named `science_cost').

Good report.  The problem is setting 'foul' in create_unit_full is quite 
a hack.  It assumes any newly-created unit will have -1 (default = full) 
movement while a recreated unit will have the same MP as the unit it is 
being copied from.  The problem with this is that after the 
alternating-movement patch newly-created units always have 0 MP so it is 
impossible to distinguish based on this.

Simply removing the line will improve behavior but not fix it. 
Sometimes create_unit is called to create a unit that isn't newly built. 
  This happens when transferring units (generally through bribery). 
It's ugly but doing it any other way is hard.

So, I see two possible fixes:

* Add a new parameter to create_unit_full, specifying whether the unit 
is "foul".  Probably create_unit() can default to FALSE here.

* Change -1 MP in create_unit_full to mean 0 MP.  This would require 
great care not to break other things, and would leave the ugliness of 
punit->foul in create_unit.

-jason





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