Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [RFC] square_dxy_iterate
Home

[Freeciv-Dev] Re: [RFC] square_dxy_iterate

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [RFC] square_dxy_iterate
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 23 Feb 2002 20:00:37 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sat, Feb 23, 2002 at 06:34:49PM +0000, Gregory Berkolaiko wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > On Sat, Feb 23, 2002 at 04:56:45PM +0000, Gregory Berkolaiko wrote:
> 
> > > flag isn't the most explanatory of names.
> > > how about willing_to_attack
> > > or 
> > > will_fight_if_needed
> > 
> > Choose one.
> 
> The choice is yours

I don't want ;)

> > > situation).  how about using is_enemy_city_tile instead of map_get_city
> > above?
> > > (here is_enemy_city_pos(x,y) would be useful)
> > 
> > It is more expensive. It will only be usefull if diplomacy is
> > implemented. And if diplomacy gets implemented you have to audit the
> > whole code (and take the runtime hit). So no.
> 
> an extra call to pplayers_at_war is that expensive?
> you are not so shy about extra calls to win_chance...

The whole issue was about speed gain.

> leave a comment then.

And what about the others?

./ai/aicity.c:1026:    if(acity && acity!=pcity && acity->owner==pcity->owner)  
{
./ai/aiunit.c:516:  if (pcity->owner != punit->owner) return FALSE;
./ai/aiunit.c:612:    if (pcity && pcity->owner != punit->owner)
./ai/aiunit.c:647:      if (aunit == punit || aunit->owner != punit->owner) 
continue;
./ai/aiunit.c:665:      if (aunit == punit || aunit->owner != punit->owner)
./ai/aiunit.c:690:      if (aunit == punit || aunit->owner != punit->owner)
./ai/aiunit.c:714:      if (aunit == punit || aunit->owner != punit->owner)
./ai/aiunit.c:847:  if (aunit && aunit->owner == punit->owner) { x = aunit->x; 
y = aunit->y; }
./ai/aiunit.c:848:  else if (acity && acity->owner == punit->owner) { x = 
acity->x; y = acity->y; }
./ai/aiunit.c:1216:         (acity && acity->owner == punit->owner && 
acity->ai.urgency &&
./ai/aiunit.c:1578:      pcity->owner != punit->owner && pcity->ai.invasion == 
2 &&
./client/packhand.c:341:  if (pcity && (pcity->owner != packet->owner)) {
./client/packhand.c:574:  if (pcity && (pcity->owner != packet->owner)) {
./common/city.c:838:      || (pc1->owner == pc2->owner
./common/city.c:875:    if (pc1->owner==pc2->owner)
./common/city.c:1929:     && punit->owner == pcity->owner)
./common/combat.c:231:    if (pcity && (city_owner(pcity) != owner)
./common/game.c:312:      if (owner != no_owner) {
./common/unit.c:109:    if(pcity->owner!=pdiplomat->owner &&
./common/unit.c:169:  if(city1->owner != pcity->owner)
./common/unit.c:189:    && punit->owner==pcity->owner
./common/unit.c:452:  if (pcity->owner != punit->owner)
./common/unit.c:471:  return pcity && pcity->owner==punit->owner;
./server/unithand.c:363:    if (new_pcity && new_pcity->owner == punit->owner) {
./server/unithand.c:883:      && pcity->owner != punit->owner
./server/unittools.c:250:    if (punit2->owner == punit->owner) {
./server/unittools.c:1363:  if (pcity && pcity->owner == punit->owner)
./server/unittools.c:1415:  if (pcity->owner == punit->owner){
./server/unittools.c:1525:        if (is_ground_unit(wunit) && wunit->owner == 
vunit->owner) {
./server/unittools.c:2806:      if (tocity->owner == punit->owner) {
./server/unittools.c:2825:      if (fromcity != homecity && fromcity->owner == 
punit->owner) {

Also add a comment? No this is IMHO unnecessary since the person who
implements diplomacy has to audit all the code anyway.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Your mail could not be delivered to the following Address:
  VTCMC.VTLPR@xxxxxxxxxxxxx        ** Unassigned error message **"


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