diff options
Diffstat (limited to 'scene/resources/polygon_path_finder.h')
-rw-r--r-- | scene/resources/polygon_path_finder.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/scene/resources/polygon_path_finder.h b/scene/resources/polygon_path_finder.h index 2ef5c89e2a..2f3cb634fb 100644 --- a/scene/resources/polygon_path_finder.h +++ b/scene/resources/polygon_path_finder.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,34 +31,31 @@ #ifndef POLYGON_PATH_FINDER_H #define POLYGON_PATH_FINDER_H -#include "core/resource.h" +#include "core/io/resource.h" class PolygonPathFinder : public Resource { - GDCLASS(PolygonPathFinder, Resource); struct Point { Vector2 pos; Set<int> connections; - float distance; - float penalty; - int prev; + float distance = 0.0; + float penalty = 0.0; + int prev = 0; }; struct Edge { - - int points[2]; + int points[2] = {}; _FORCE_INLINE_ bool operator<(const Edge &p_edge) const { - - if (points[0] == p_edge.points[0]) + if (points[0] == p_edge.points[0]) { return points[1] < p_edge.points[1]; - else + } else { return points[0] < p_edge.points[0]; + } } Edge(int a = 0, int b = 0) { - if (a > b) { SWAP(a, b); } |