[freeciv-ai] Findjob
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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?
- [freeciv-ai] Findjob,
Jordi Negrevernis i Font <=
|
|