--- path_finding9.h Sat Apr 27 10:51:15 2002 +++ path_finding10.h Thu May 30 10:57:07 2002 @@ -30,23 +30,12 @@ * step is 0 if the target is unknown. * - extra cost of (EC) (of a tile): sum of various extra costs * (which all have to be >=0) - * - final cost (FC) (of a step): FC = BMC * PF_BMC_FACTOR + ECTT - * Where ECTT is the EC of the target tile. - * - turn cost (TC): TC = turn_cost_factor * turns_needed + - * move_cost_factor * (move_rate - moves_left) - * How turns_needed and moves_left are calculated depend on turn_mode. - * - cost of a path (COP): COP = sum of FC for all steps + TCF - * Where TCF is the TC of the final position. + * - cost of a path (COP) as returns by get_cop. * - best path: a path which has the minimal COP. If two paths have * equal COP the behavior is undefined. */ /* - * Scaling factor for the BMC. - */ -#define PF_BMC_FACTOR 100 - -/* * The step is ignored completely if any extra cost or the sum EC is * larger or equal PF_IGNORE_COST. */ @@ -103,10 +92,9 @@ bool move_backward; /* - * Determines how the TC is calculated. + * Determines how turns and moves_left are calculated. */ enum turn_mode turn_mode; - int turn_cost_factor, move_cost_factor; /* * Callback to query the known state of a tile for the given @@ -140,12 +128,22 @@ /* * If this callback is non-NULL and returns TRUE this position is - * safe. A safe position splits the simulated path of the - * simulated unit: it will move on as normal and it will wait a - * turn to get full move points. Can be NULL. Parameter are x, y, - * known and user_data2. + * dangerous. The unit will never end a turn at a dangerous + * position. Can be NULL. Parameter are x, y, known and user_data2. + */ + int (*is_position_dangerous) (int, int, enum known_type, void *); + + /* + * Passed as last parameter to get_cop. + */ + void *user_data3; + + /* + * Returns the cost of a path (COP). Can't be NULL. Parameter are + * sum over all BMC of the path, sum over all EC of the path, turns + * at the end of the path, moves_left at the end of the path. */ - int (*is_position_safe) (int, int, enum known_type, void *); + int (*get_cop) (int, int, int, int); }; struct pf_path {