summaryrefslogtreecommitdiffhomepage
path: root/src/search.hpp
blob: 1fdaf3e2b2c61b76c81d7a8d9e5a4fa1bbf872fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "tile-constants.hpp"
#include "global-coords.hpp"
#include "object-id.hpp"
#include "search-pred.hpp"
#include <array>

namespace floormat::Search {
template<typename T> struct bbox;
struct cache;
} // namespace floormat::Search

namespace floormat {

class world;
struct object;
class chunk;

class path_search final
{
    template<typename T> using bbox = Search::bbox<T>;
    using pred = Search::pred;

public:
    static bool is_passable_1(chunk& c, Vector2 min, Vector2 max, object_id own_id, const pred& p = Search::never_continue());
    static bool is_passable_(chunk* c0, const std::array<chunk*, 8>& neighbors,
                             Vector2 min, Vector2 max, object_id own_id, const pred& p = Search::never_continue());
    static bool is_passable(world& w, global_coords coord, Vector2b offset, Vector2ui size, object_id own_id, const pred& p = Search::never_continue());
    static bool is_passable(world& w, struct Search::cache& cache, global_coords coord, Vector2b offset, Vector2ui size, object_id own_id, const pred& p = Search::never_continue());
    static bool is_passable(world& w, chunk_coords_ ch0, const bbox<float>& bb, object_id own_id, const pred& p = Search::never_continue());
    static bool is_passable(world& w, struct Search::cache& cache, chunk_coords_ ch0, const bbox<float>& bb, object_id own_id, const pred& p = Search::never_continue());
};

} // namespace floormat