annotate engine/core/pathfinder/linearpather/linearpather.cpp @ 272:b04a2faf7d86

* Reverted the latest pathfinding module changes as they broke building trunk * Please compile the engine and run all unittests via trunk/test_fife.py before commiting any changes to trunk!
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 16 Jun 2009 11:28:35 +0000
parents
children
rev   line source
272
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
1 /***************************************************************************
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
2 * Copyright (C) 2005-2008 by the FIFE team *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
3 * http://www.fifengine.de *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
4 * This file is part of FIFE. *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
5 * *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
6 * FIFE is free software; you can redistribute it and/or *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
8 * License as published by the Free Software Foundation; either *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version. *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
10 * *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
11 * This library is distributed in the hope that it will be useful, *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
14 * Lesser General Public License for more details. *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
15 * *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
17 * License along with this library; if not, write to the *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
18 * Free Software Foundation, Inc., *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
20 ***************************************************************************/
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
21
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
22 // Standard C++ library includes
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
23
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
24 // 3rd party library includes
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
25
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
26 // FIFE includes
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
27 // These includes are split up in two parts, separated by one empty line
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
28 // First block: files included from the FIFE root src directory
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
29 // Second block: files included from the same folder
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
30 #include "util/log/logger.h"
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
31 #include "model/metamodel/grids/cellgrid.h"
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
32 #include "model/structures/instance.h"
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
33 #include "model/structures/layer.h"
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
34
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
35 #include "linearpather.h"
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
36
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
37 namespace FIFE {
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
38 static Logger _log(LM_PATHFINDER);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
39
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
40 int LinearPather::getNextLocation(const Instance* instance, const Location& target,
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
41 double distance_to_travel, Location& nextLocation,
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
42 Location& facingLocation, int session_id, int priority) {
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
43 Location curloc = instance->getLocation();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
44 assert(curloc.getMap() == target.getMap());
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
45 Layer* layer = curloc.getLayer();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
46 assert(layer == target.getLayer());
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
47 CellGrid* cg = layer->getCellGrid();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
48 assert(layer == target.getLayer());
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
49
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
50 assert(curloc.getLayer() == target.getLayer());
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
51 m_map = curloc.getMap();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
52
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
53 int cur_session_id = session_id;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
54 if (cur_session_id < 0) {
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
55 cur_session_id = m_session_counter++;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
56
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
57 // extrapolate facing location for this session
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
58 ExactModelCoordinate cur_pos = curloc.getMapCoordinates();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
59 ExactModelCoordinate fac_pos = target.getMapCoordinates();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
60 fac_pos.x = fac_pos.x + (fac_pos.x - cur_pos.x);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
61 fac_pos.y = fac_pos.y + (fac_pos.y - cur_pos.y);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
62 facingLocation = target;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
63 facingLocation.setMapCoordinates(fac_pos);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
64 m_session2face[cur_session_id] = facingLocation;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
65 FL_DBG(_log, LMsg("storing new facing loc ") << facingLocation);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
66 } else {
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
67 FL_DBG(_log, LMsg("getting old facing loc ") << facingLocation);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
68 facingLocation = m_session2face[cur_session_id];
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
69 }
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
70 FL_DBG(_log, LMsg("curloc ") << curloc << ", target " << target << ", dist2travel " << distance_to_travel);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
71 ExactModelCoordinate cur_pos = curloc.getMapCoordinates();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
72 ExactModelCoordinate target_pos = target.getMapCoordinates();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
73 double dx = (target_pos.x - cur_pos.x) * cg->getXScale();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
74 double dy = (target_pos.y - cur_pos.y) * cg->getYScale();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
75 double dist = sqrt(dx*dx + dy*dy);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
76 FL_DBG(_log, LMsg("distance from cur to target = ") << dist);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
77
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
78 // calculate where current position evolves with movement
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
79 if (distance_to_travel > dist) {
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
80 distance_to_travel = dist;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
81 }
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
82 cur_pos.x += dx * (distance_to_travel / dist);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
83 cur_pos.y += dy * (distance_to_travel / dist);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
84 nextLocation.setMapCoordinates(cur_pos);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
85 FL_DBG(_log, LMsg("in case not blocking, could move to ") << nextLocation);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
86
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
87 // check if we have collisions and if we do, keep instance on current location
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
88 ModelCoordinate nextCellcoord = nextLocation.getLayerCoordinates();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
89 const std::vector<Instance*>& instances = target.getLayer()->getInstances();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
90 std::vector<Instance*>::const_iterator instance_it = instances.begin();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
91 for (;instance_it != instances.end(); ++instance_it) {
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
92 Instance* i = (*instance_it);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
93 if ((i == instance) || (!i->getObject()->isBlocking())) {
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
94 continue;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
95 }
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
96 ModelCoordinate c = i->getLocationRef().getLayerCoordinates();
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
97 if ((c.x == nextCellcoord.x) && (c.y == nextCellcoord.y)) {
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
98 FL_DBG(_log, LMsg("Found blocking instance from planned cell ") << nextLocation);
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
99 nextLocation = curloc;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
100 break;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
101 }
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
102 }
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
103 //We're there
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
104 if((ABS(cur_pos.x - target_pos.x) < 0.1) && (ABS(cur_pos.y - target_pos.y) < 0.1)) {
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
105 return -1;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
106 }
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
107 return cur_session_id;
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
108 }
b04a2faf7d86 * Reverted the latest pathfinding module changes as they broke building trunk
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
109 }