~ubuntu-branches/debian/squeeze/freeciv/squeeze

« back to all changes in this revision

Viewing changes to common/aicore/path_finding.h

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach
  • Date: 2008-07-08 18:34:23 UTC
  • mfrom: (5.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080708183423-c80u1h25xmj6h9s0
Tags: 2.1.5-2
Export datarootdir=/usr/share in debian/rules, so make calls can
have a correct value for LOCALEDIR (closes: #489455). Thanks Loïc Minier
for the help to solve this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#define FC__PATH_FINDING_H
15
15
 
16
16
#include "map.h"
17
 
#include "terrain.h"
 
17
#include "tile.h"
18
18
#include "unit.h"
19
19
#include "unittype.h"
20
20
 
126
126
 * through an additional tile_behaviour callback,  which would return
127
127
 * TB_IGNORE for tiles we don't want to visit and TB_DONT_LEAVE for tiles
128
128
 * we won't be able to leave (at least alive).
 
129
 *
 
130
 * Dangerous tiles are those on which we don't want to end a turn.  If
 
131
 * the danger callback is specified it is used to determine which tiles are
 
132
 * dangerous; no path that ends a turn on such a tile will ever be
 
133
 * considered.
 
134
 *
 
135
 * There is also support for fuel, and thus indirectly for air units.  If
 
136
 * the fuel parameters are provided then the unit is considered to have
 
137
 * that much fuel.  The net effect is that if a unit has N fuel then only
 
138
 * every Nth turn will be considered a stopping point.  To support air
 
139
 * units, then, all tiles that don't have airfields (or cities/carriers)
 
140
 * should be returned as dangerous (see danger, above).  Note: fuel support
 
141
 * will only work if all moves have equal MC.  Support for fuel is
 
142
 * experimental at this time (Jun 2005) and should not be used in the
 
143
 * server.  Setting fuel==1 in the pf_parameter disables fuel support.
129
144
 * 
130
145
 * There are few other options in the path-finding, including "omniscience" 
131
146
 * (if true, all tiles are assumed to be KNOWN) and "get_zoc" callback (if 
273
288
/* Full specification of a position and time to reach it. */
274
289
struct pf_position {
275
290
  struct tile *tile;
276
 
  int turn, moves_left;         /* See definitions above */
 
291
  int turn, moves_left, fuel_left;      /* See definitions above */
277
292
 
278
293
  int total_MC;                 /* Total MC to reach this point */
279
294
  int total_EC;                 /* Total EC to reach this point */
297
312
 * Examples of callbacks can be found in pf_tools.c*/
298
313
struct pf_parameter {
299
314
  struct tile *start_tile;      /* Initial position */
 
315
 
300
316
  int moves_left_initially;
 
317
  int fuel_left_initially;      /* Ignored for non-air units. */
 
318
 
301
319
  int move_rate;                /* Move rate of the virtual unit */
 
320
  int fuel;                     /* Should be 1 for units without fuel. */
302
321
 
303
322
  struct player *owner;
304
323
 
336
355
   * ZoC for strategic planning purposes (take into account enemy cities 
337
356
   * but not units for example).
338
357
   * If this callback is NULL, ZoC are ignored.*/
339
 
  bool (*get_zoc) (struct player *pplayer, const struct tile *ptile);
 
358
  bool (*get_zoc) (const struct player *pplayer, const struct tile *ptile);
340
359
 
341
360
  /* If this callback is non-NULL and returns TRUE this position is
342
361
   * dangerous. The unit will never end a turn at a dangerous
378
397
/* The map itself.  Opaque type. */
379
398
struct pf_map;
380
399
 
381
 
/* ==================== Functions =================================== */
 
400
/* ==================== Map/Path Functions ========================== */
382
401
 
383
402
/* Returns a map which can be used to query for paths or to iterate
384
403
 * over all paths. Does not perform any computations itself, just sets
430
449
/* Return the current parameters for the given map. */
431
450
struct pf_parameter *pf_get_parameter(struct pf_map *map);
432
451
 
 
452
/* ==================== Parameter Functions ========================= */
 
453
 
 
454
int get_moves_left_initially(const struct pf_parameter *param);
 
455
 
433
456
#endif