source: golgotha/src/golg/map_path.cc

Last change on this file was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.5 KB
RevLine 
[80]1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "map.hh"
10#include "visible.hh"
11#include "solvemap_astar.hh"
12
13i4_bool g1_map_class::find_path(i4_float start_x, i4_float start_y,
14                                i4_float destx, i4_float desty,
15                                i4_float *points, w16 &t_nodes)
16{
17  if (destx<0) destx=0; else if (destx>=w) destx = w-1;
18  if (desty<0) desty=0; else if (desty>=h) desty = h-1;
19
20  // jc: fixme
21  //  i4_float tt=get_block_map(grade)->line_of_sight(c->x,c->y,destx,desty, rad_x, rad_y);
22  //  i4_float tc=c->calculate_size(destx - c->x,desty - c->y)-0.001;
23  if (0) //tt>=tc)
24  {
25    // if the destination is visible, then path is just a line
26    points[0]=destx;
27    points[1]=desty;
28    //    points[2]=c->x;
29    //    points[3]=c->y;
30    t_nodes=2;
31  }
32  else
33  {
34    if (!solver->path_solve(start_x, start_y,
35                            destx, desty,
36                            points, t_nodes))
37    {
38      t_nodes=0;
39      return i4_F;
40    }
41  }
42  return i4_T;
43}
Note: See TracBrowser for help on using the repository browser.