diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-07 06:58:27 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-07 06:58:33 +0200 |
commit | 220786f90da4b7e23727ef35eab5166fc23e6355 (patch) | |
tree | 3e7c87f7ff64f5c81090b69708f3f184ad6529df /src | |
parent | 3b9b3cfe5e4e473e7656ec97387c4611aecbf9d4 (diff) |
b
Diffstat (limited to 'src')
-rw-r--r-- | src/critter-script-walk.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/critter-script-walk.cpp b/src/critter-script-walk.cpp index 51d098cd..0b0b333e 100644 --- a/src/critter-script-walk.cpp +++ b/src/critter-script-walk.cpp @@ -12,17 +12,6 @@ namespace floormat { namespace { -bool walk_line(point dest, const std::shared_ptr<critter>& c, size_t& i, const Ns& dt) -{ - auto res = c->move_toward(i, dt, dest); - return res.blocked || c->position() == dest; -} - -bool walk_path(point dest, const path_search_result& path, const std::shared_ptr<critter>& c, size_t& i, const Ns& dt) -{ - return {}; -} - struct walk_script; constexpr StringView script_name = name_of<walk_script>; using ScriptPtr = Pointer<critter_script>; @@ -49,9 +38,6 @@ private: walk_mode mode = failwith<walk_mode>("walk_mode not set"); }; -walk_script::walk_script(point dest) : dest{dest}, mode{walk_mode::line} {} -walk_script::walk_script(psr path) : path{move(path)}, mode{walk_mode::path} { fm_assert(!path.empty()); } - StringView walk_script::name() const { return "walk"_s; } const void* walk_script::id() const { return &script_name; } void walk_script::on_destroy(const std::shared_ptr<critter>& c, script_destroy_reason) { c->clear_auto_movement(); } @@ -76,6 +62,20 @@ void walk_script::on_init(const std::shared_ptr<critter>& c) } } +walk_script::walk_script(point dest) : dest{dest}, mode{walk_mode::line} {} +walk_script::walk_script(psr path) : path{move(path)}, mode{walk_mode::path} { fm_assert(!path.empty()); } + +bool walk_line(point dest, const std::shared_ptr<critter>& c, size_t& i, const Ns& dt) +{ + auto res = c->move_toward(i, dt, dest); + return res.blocked || c->position() == dest; +} + +bool walk_path(point dest, const path_search_result& path, const std::shared_ptr<critter>& c, size_t& i, const Ns& dt) +{ + return {}; +} + void walk_script::on_update(const std::shared_ptr<critter>& c, size_t& i, const Ns& dt) { auto& m = c->moves; |