From 3b9b3cfe5e4e473e7656ec97387c4611aecbf9d4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 May 2024 06:56:32 +0200 Subject: aa --- src/critter-script-walk.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/critter-script-walk.cpp b/src/critter-script-walk.cpp index bd2b00ca..51d098cd 100644 --- a/src/critter-script-walk.cpp +++ b/src/critter-script-walk.cpp @@ -49,6 +49,9 @@ private: walk_mode mode = failwith("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& c, script_destroy_reason) { c->clear_auto_movement(); } @@ -65,6 +68,7 @@ void walk_script::on_init(const std::shared_ptr& c) break; case walk_mode::path: fm_assert(!path.empty()); + dest = path.path().back(); break; default: std::unreachable(); @@ -101,9 +105,6 @@ done: c->script.do_clear(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()); } - } // namespace ScriptPtr critter_script::make_walk_script(point dest) { return ScriptPtr(new walk_script{dest}); } -- cgit v1.2.3