Follow-up Comment #1, bug #17958 (project freeciv):

Found the reason why Helicopters, Aircrafts and Triremes cannot autoexplore.
The reason is that "move_type" is not "Sea" nor "Land" but "Both", for these
unit classes.

If you look the following code, you can see that AutoExplore is only
available for "Land" or "Sea" units.


[client/control.c]
void key_unit_auto_explore(void)
{
  unit_list_iterate(get_units_in_focus(), punit) {
    if (can_unit_do_activity(punit, ACTIVITY_EXPLORE)) {
      request_new_unit_activity(punit, ACTIVITY_EXPLORE);
    }
  } unit_list_iterate_end;
}

[common/client.c]

bool can_unit_do_activity(const struct unit *punit,
                          enum unit_activity activity)
{
  return can_unit_do_activity_targeted(punit, activity, S_LAST, BASE_NONE);
}

bool can_unit_do_activity_targeted(const struct unit *punit,
                                   enum unit_activity activity,
                                   enum tile_special_type target,
                                   Base_type_id base)
{
  return can_unit_do_activity_targeted_at(punit, activity, target,
                                          punit->tile, base);
}

bool can_unit_do_activity_targeted_at(const struct unit *punit,
                                      enum unit_activity activity,
                                      enum tile_special_type target,
                                      const struct tile *ptile,
                                      Base_type_id base)
{
[...]
 case ACTIVITY_EXPLORE:
    return (is_ground_unit(punit) || is_sailing_unit(punit));
[...]
}

[common/movement.c]

bool is_sailing_unittype(const struct unit_type *punittype)
{
  return (utype_move_type(punittype) == SEA_MOVING);
}


bool is_ground_unittype(const struct unit_type *punittype)
{
  return (utype_move_type(punittype) == LAND_MOVING);
}




On the other end, in order to be able to enter rivers, Trireme must have
move_type = "Both"

May a new "cannot_explore" flag be added in order to manage this?


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?17958>

_______________________________________________
  Messaggio inviato con/da Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to