<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40395 >
Goto accepts move from city to any tile from city for amphibious units. Fix attached. - ML
diff -Nurd -X.diff_ignore freeciv/common/aicore/pf_tools.c freeciv/common/aicore/pf_tools.c --- freeciv/common/aicore/pf_tools.c 2008-03-29 07:01:59.000000000 +0200 +++ freeciv/common/aicore/pf_tools.c 2008-07-22 23:01:50.000000000 +0300 @@ -71,16 +71,19 @@ } /************************************************************* - SINGLE_MOVE cost function for AIR_MOVING + Cost function for AIR_MOVING and amphibious units *************************************************************/ -static int single_airmove(const struct tile *ptile, enum direction8 dir, - const struct tile *ptile1, - struct pf_parameter *param) +static int airmove(const struct tile *ptile, enum direction8 dir, + const struct tile *ptile1, + struct pf_parameter *param) { - if (!tile_city(ptile) && !is_native_tile_to_class(param->uclass, ptile1)) { - return PF_IMPOSSIBLE_MC; - } else if (!is_native_tile_to_class(param->uclass, ptile1)) { - return SINGLE_MOVE; + if (!is_native_tile_to_class(param->uclass, ptile1)) { + if (tile_city(ptile1)) { + /* Entering city */ + return SINGLE_MOVE; + } else { + return PF_IMPOSSIBLE_MC; + } } return single_move_cost(param, ptile, ptile1); } @@ -645,11 +648,11 @@ } break; case AIR_MOVING: - parameter->get_MC = single_airmove; + parameter->get_MC = airmove; break; case HELI_MOVING: /* Helicoptors are treated similarly to airplanes. */ - parameter->get_MC = single_airmove; + parameter->get_MC = airmove; break; default: freelog(LOG_ERROR, "pft_fill_unit_parameter() impossible move type!"); @@ -690,7 +693,7 @@ break; case AIR_MOVING: case HELI_MOVING: - parameter->get_MC = single_airmove; /* very crude */ + parameter->get_MC = airmove; /* very crude */ break; default: freelog(LOG_ERROR, "pft_fill_unit_overlap_param() impossible move type!"); @@ -721,7 +724,7 @@ break; case AIR_MOVING: case HELI_MOVING: - parameter->get_MC = single_airmove; /* very crude */ + parameter->get_MC = airmove; /* very crude */ break; default: freelog(LOG_ERROR, "pft_fill_unit_attack_param() impossible move type!");
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev