Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: Safe paths for triremes etc. (PR#1007)
Home

[Freeciv-Dev] Re: Safe paths for triremes etc. (PR#1007)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Safe paths for triremes etc. (PR#1007)
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Fri, 16 Nov 2001 17:42:38 -0800 (PST)

--- Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> wrote:

<snip>

> this is in find_a_direction which is one hell of variable naming.
> when I understand it thoroughly, I will do something about the names.
> but not now.

Ok
 

> this is correct thinking.
> it should be done (as part of palyer_ai struct, for example)
> the only thing is that if not allowed to see under fog, AI will play even
> weaker...
> but this is a completely different project and if you want to do it I
> will give you all possible assistance (like checking and testing and
> discussing).
>

Not a chance! It's far too much work, of the most boring kind, tracking
down various places in the warmap where the AI ignores fog-of-war. I am 
currently on another project though where I could use some help. It's to
do with movement code, I'm going to replace movecosts of 3 with 30.
Same for all other movement costs, multiply by 10. 
 
> > if (punit) {
> >      if (is_sailing_unit(punit)) {
> > -      init_warmap(punit->x, punit->y, LAND_MOVING);
> >        really_generate_warmap(pcity, punit, SEA_MOVING);
> >      } else {
> > -      init_warmap(punit->x, punit->y, SEA_MOVING);
> >        really_generate_warmap(pcity, punit, LAND_MOVING);
> >      }
> > 
> > Is the above really true? Why the hell did we originally generate a
> > land moving
> > warmap for a sea unit?
> 
> this is not generating, it's cleaning up before generating.
> it should not be neccessary, if for some reason it causes weird
> behaviour, it is a bug.  I remember checking it by comparing savegames
> for autogames, they were identical. 
> 

No I am not disagreeing with the change. I was just wondering why it was there
in the first place. 

Nicely done. One small step for the AI, a giant leap for the warmap code. 

if (punit) {
+    /* Checking for warmap in existence.  
+     * If the previous warmap was for a city and our unit is 
+     * in that city, use city's warmap.
+     * That sounds quite wrong given that there are different 
+     * types of units and only one way to generate city's warmap. */
     if (pcity && pcity == warmap.warcity)
       return;
-    if (warmap.warunit == punit && !warmap.cost[punit->x][punit->y])
+    /* If the previous warmap was for the same unit and it's still 
+     * correct (warmap.cost[x][y] == 0), reuse it. */
+    if (warmap.warunit == punit && 
+       (is_sailing_unit(punit) ? !warmap.seacost[punit->x][punit->y] :
+        !warmap.cost[punit->x][punit->y]))
       return;
       
Air units are missing.  So far this code only seems to deal with
land and sea. I think that air units have no use for the city warmap.
In fact, I'm not sure that sea units have much use for it either.
The city warmap seems to be useful only for land units.

 if (ptile->special&S_ROAD) d[k] += 10; /* in case we change directions */
       if (ptile->special&S_RAILROAD) d[k] += 10; /* next turn, roads are nice
*/
 
 What do you think of instead
 
 if ((ptile->special&S_ROAD) || (ptile->special&S_RAILROAD)) d[k] += 10;
 
 Your code seems correct so far. Raimar, Ross?

__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com


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