Complete.Org: Mailing Lists: Archives: freeciv-ai: October 2002:
[freeciv-ai] Findjob
Home

[freeciv-ai] Findjob

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv ai <freeciv-ai@xxxxxxxxxxx>
Subject: [freeciv-ai] Findjob
From: Jordi Negrevernis i Font <jorneg@xxxxxxxxxxx>
Date: Sat, 26 Oct 2002 18:18:57 +0200

In aiunit.c:ai_military_findjob() there is this code...

 if (punit->ai.charge != BODYGUARD_NONE) { /* I am a bodyguard */
   aunit = player_find_unit_by_id(pplayer, punit->ai.charge);
   acity = find_city_by_id(punit->ai.charge);

   /* Check if city we are on our way to rescue is still in danger,
    * or unit we should protect is still alive */
   if ((acity && acity->owner == punit->owner && acity->ai.urgency != 0 &&
         acity->ai.danger > assess_defense_quadratic(acity))
       || aunit) {
     if (punit->ai.ai_role != AIUNIT_ESCORT) {
       /* We forgot what we were doing. Incredible! */
BODYGUARD_LOG(LOG_ERROR, punit, "lost role as bodyguard in findjob"); punit->ai.ai_role = AIUNIT_ESCORT; /* do not use ai_unit_new_role() */
     }
     return;
   } else {
     ai_unit_ready(punit);
   }
 }

The 3th line assigns an id of a unit to a city!!!!
Is this an error?





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