@@ -150,29 +150,29 @@ impl Map {
150
150
}
151
151
}
152
152
153
- return result;
153
+ result
154
154
}
155
155
156
156
/// Returns current influence value
157
157
fn current_influence ( & self , map_type : u8 , position : ( f32 , f32 ) ) -> f32 {
158
158
let map = self . get_map ( map_type) ;
159
159
let position_int = round_point2 ( position) ;
160
160
161
- return map. current_influence ( position_int) as f32 ;
161
+ map. current_influence ( position_int) as f32
162
162
}
163
163
164
164
/// Finds the first reachable position within specified walking distance from the center point with lowest value
165
165
fn lowest_influence_walk ( & self , map_type : u8 , center : ( f32 , f32 ) , distance : f32 ) -> ( ( usize , usize ) , f32 ) {
166
166
let map = self . get_map ( map_type) ;
167
167
let center_int = round_point2 ( center) ;
168
168
169
- return map. lowest_influence_walk ( center_int, distance) ;
169
+ map. lowest_influence_walk ( center_int, distance)
170
170
}
171
171
172
172
/// Finds the first reachable position within specified distance from the center point with lowest value
173
173
pub fn lowest_influence ( & self , map_type : u8 , center : ( f32 , f32 ) , distance : usize ) -> ( ( usize , usize ) , f32 ) {
174
174
let map = self . get_map ( map_type) ;
175
- return map. inline_lowest_value ( center, distance) ;
175
+ map. inline_lowest_value ( center, distance)
176
176
}
177
177
178
178
/// Find the shortest path values without considering influence and returns the path and distance
@@ -186,7 +186,7 @@ impl Map {
186
186
let end_int = ( end. 0 . round ( ) as usize , end. 1 . round ( ) as usize ) ;
187
187
188
188
let map = self . get_map ( map_type) ;
189
- return map. find_path ( start_int, end_int, possible_heuristic) ;
189
+ map. find_path ( start_int, end_int, possible_heuristic)
190
190
}
191
191
192
192
/// Find the shortest path values without considering influence and returns the path and distance
@@ -200,7 +200,7 @@ impl Map {
200
200
let end_int = ( end. 0 . round ( ) as usize , end. 1 . round ( ) as usize ) ;
201
201
202
202
let map = self . get_map ( map_type) ;
203
- return map. find_path_large ( start_int, end_int, possible_heuristic) ;
203
+ map. find_path_large ( start_int, end_int, possible_heuristic)
204
204
}
205
205
206
206
/// Find the path using influence values and returns the path and distance
@@ -213,7 +213,7 @@ impl Map {
213
213
let start_int = ( start. 0 . round ( ) as usize , start. 1 . round ( ) as usize ) ;
214
214
let end_int = ( end. 0 . round ( ) as usize , end. 1 . round ( ) as usize ) ;
215
215
let map = self . get_map ( map_type) ;
216
- return map. find_path_influence ( start_int, end_int, possible_heuristic) ;
216
+ map. find_path_influence ( start_int, end_int, possible_heuristic)
217
217
}
218
218
219
219
/// Find the path using influence values and returns the path and distance
@@ -226,7 +226,7 @@ impl Map {
226
226
let start_int = ( start. 0 . round ( ) as usize , start. 1 . round ( ) as usize ) ;
227
227
let end_int = ( end. 0 . round ( ) as usize , end. 1 . round ( ) as usize ) ;
228
228
let map = self . get_map ( map_type) ;
229
- return map. find_path_influence_large ( start_int, end_int, possible_heuristic) ;
229
+ map. find_path_influence_large ( start_int, end_int, possible_heuristic)
230
230
}
231
231
232
232
/// Find the shortest path values without considering influence and returns the path and distance
@@ -241,7 +241,7 @@ impl Map {
241
241
let end_int = ( end. 0 . round ( ) as usize , end. 1 . round ( ) as usize ) ;
242
242
243
243
let map = self . get_map ( map_type) ;
244
- return map. find_path_closer_than ( start_int, end_int, possible_heuristic, distance_from_target) ;
244
+ map. find_path_closer_than ( start_int, end_int, possible_heuristic, distance_from_target)
245
245
}
246
246
247
247
/// Find the shortest path values without considering influence and returns the path and distance
@@ -256,7 +256,7 @@ impl Map {
256
256
let end_int = ( end. 0 . round ( ) as usize , end. 1 . round ( ) as usize ) ;
257
257
258
258
let map = self . get_map ( map_type) ;
259
- return map. find_path_large_closer_than ( start_int, end_int, possible_heuristic, distance_from_target) ;
259
+ map. find_path_large_closer_than ( start_int, end_int, possible_heuristic, distance_from_target)
260
260
}
261
261
262
262
/// Find the path using influence values and returns the path and distance
@@ -270,7 +270,7 @@ impl Map {
270
270
let start_int = ( start. 0 . round ( ) as usize , start. 1 . round ( ) as usize ) ;
271
271
let end_int = ( end. 0 . round ( ) as usize , end. 1 . round ( ) as usize ) ;
272
272
let map = self . get_map ( map_type) ;
273
- return map. find_path_influence_closer_than ( start_int, end_int, possible_heuristic, distance_from_target) ;
273
+ map. find_path_influence_closer_than ( start_int, end_int, possible_heuristic, distance_from_target)
274
274
}
275
275
276
276
/// Find the path using influence values and returns the path and distance
@@ -284,7 +284,7 @@ impl Map {
284
284
let start_int = ( start. 0 . round ( ) as usize , start. 1 . round ( ) as usize ) ;
285
285
let end_int = ( end. 0 . round ( ) as usize , end. 1 . round ( ) as usize ) ;
286
286
let map = self . get_map ( map_type) ;
287
- return map. find_path_influence_large_closer_than ( start_int, end_int, possible_heuristic, distance_from_target) ;
287
+ map. find_path_influence_large_closer_than ( start_int, end_int, possible_heuristic, distance_from_target)
288
288
}
289
289
290
290
/// Finds a compromise where low influence matches with close position to the start position.
@@ -295,7 +295,7 @@ impl Map {
295
295
distance : f32 )
296
296
-> ( ( f32 , f32 ) , f32 ) {
297
297
let map = self . get_map ( map_type) ;
298
- return map. find_low_inside_walk ( start, target, distance) ;
298
+ map. find_low_inside_walk ( start, target, distance)
299
299
}
300
300
}
301
301
@@ -402,14 +402,13 @@ impl Map {
402
402
403
403
let c = points[ x] [ y] . cliff_type ;
404
404
405
- if c != Cliff :: None {
406
- if points[ x + 1 ] [ y] . cliff_type != c
407
- && points[ x - 1 ] [ y] . cliff_type != c
408
- && points[ x] [ y + 1 ] . cliff_type != c
409
- && points[ x] [ y - 1 ] . cliff_type != c
410
- {
411
- points[ x] [ y] . cliff_type = Cliff :: None ;
412
- }
405
+ if c != Cliff :: None
406
+ && points[ x + 1 ] [ y] . cliff_type != c
407
+ && points[ x - 1 ] [ y] . cliff_type != c
408
+ && points[ x] [ y + 1 ] . cliff_type != c
409
+ && points[ x] [ y - 1 ] . cliff_type != c
410
+ {
411
+ points[ x] [ y] . cliff_type = Cliff :: None ;
413
412
}
414
413
415
414
if !set_handled_overlord_spots. contains ( & point_hash) && points[ x] [ y] . overlord_spot {
@@ -515,7 +514,7 @@ fn flood_fill_overlord(points: &mut Vec<Vec<map_point::MapPoint>>,
515
514
516
515
let mut result = true ;
517
516
points[ x] [ y] . overlord_spot = replacement;
518
- // if points[x][y].overlord_spot == target {
517
+
519
518
if y > 0 {
520
519
result &= flood_fill_overlord ( points, x, ( ( y as u32 ) - 1 ) as usize , target_height, replacement, set) ;
521
520
}
@@ -528,7 +527,6 @@ fn flood_fill_overlord(points: &mut Vec<Vec<map_point::MapPoint>>,
528
527
if x < points. len ( ) - 1 {
529
528
result &= flood_fill_overlord ( points, x + 1 , y, target_height, replacement, set) ;
530
529
}
531
- // }
532
530
533
- return result;
531
+ result
534
532
}
0 commit comments