chingu-pathfinding 1.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e8cd2e0c5b9c4e076e821f8671207013a3dbf55
4
- data.tar.gz: 4935ad855d64830a333886885a1045eda83a7b8c
3
+ metadata.gz: 0e40cf76e8b0907e849089d8e76da75a54e25843
4
+ data.tar.gz: 616929d9dcf559c235cc0b7c9f7efa57a3dcf015
5
5
  SHA512:
6
- metadata.gz: cba97a18f7017d06a47f1a6e3687dc60fefe24ccc720ceb21630ac65c5336746ee244d275ed2591f7afa0d95e6cd2fed51ef52d7bfbb870ef564934bebf991e2
7
- data.tar.gz: 7ec84c3902cefa5b7313e289777ccb73bfc42646750e26d4ef7011bbcf3831a9f77d47803b420c80691ef371f5ff2b56647ef67789a28f925a730c87b92272b7
6
+ metadata.gz: a2d9d6bb0c64c695809d717ecdb7b7a525a88da92506650379dd6102058ae39b2723beaf9d31d8c13034a8316d1bde981253e2db997bf65492a39e7a67d701e4
7
+ data.tar.gz: 96c63f137ddfb6327da4dee754dd7b04a59f1aa79e55373f2b27303cbebb70f0d7f713c48a72a7a526294a97b07cba05751bfe59d80e6c7e7d98706df6bdb20c
@@ -161,20 +161,21 @@ class pathfinder_t {
161
161
  }
162
162
 
163
163
  path_t find_path_update(long int x1, long int y1, long int x2, long int y2, std::vector<location_t> current) {
164
- location_t current_location(x1,y1);
164
+ location_t start(x1,y1);
165
165
  location_t goal(x2,y2);
166
- path_t x;
166
+ path_t init_path;
167
167
  by_estimated_cost estimator(goal);
168
168
  queue_t queue(estimator);
169
+ init_path.add_loc(start, goal);
169
170
  // Cut out the part of the path already visited
170
171
  bool drop = true;
171
172
  for (location_t l : current) {
172
- if (dist(l, current_location) < 2) {
173
+ if (dist(l, start) < block_size) {
173
174
  drop = false;
174
175
  }
175
- if (!drop) {
176
- x.add_loc(l, goal);
177
- queue.push(x);
176
+ if (!drop && start != l) {
177
+ init_path.add_loc(l, goal);
178
+ queue.push(init_path);
178
179
  }
179
180
  }
180
181
  // Add every prefix of current to initial guess and converge to new location.
@@ -1,5 +1,5 @@
1
1
  class Pathfinding
2
- VERSION = '1.1'
2
+ VERSION = '1.1.1'
3
3
  def find_path(x1, y1, x2, y2)
4
4
  throw "Require points to be numeric, got #{[x1, y1, x2, y2]}." unless [x1,y1,x2,y2].all? {|x| x.kind_of?(Numeric)}
5
5
  _find_path(x1, y1, x2, y2)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chingu-pathfinding
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - zombiecalypse