diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-03 13:34:26 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-04 06:58:14 +0100 |
commit | e18740b132b10604f7f76f67d92eaff81453436e (patch) | |
tree | 79b9024b5bbd639de6cdb5d758e446a636ad1d18 /test/critter.cpp | |
parent | 363d7a69497aac9031e1635152a26c203095fb6e (diff) |
a
Diffstat (limited to 'test/critter.cpp')
-rw-r--r-- | test/critter.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/test/critter.cpp b/test/critter.cpp index c6845fd1..db974eb7 100644 --- a/test/critter.cpp +++ b/test/critter.cpp @@ -18,6 +18,19 @@ constexpr auto constantly(const auto& x) noexcept { return [x]<typename... Ts> (const Ts&...) constexpr -> const auto& { return x; }; } +critter_proto make_proto(int accel) +{ + critter_proto proto; + proto.atlas = loader.anim_atlas("npc-walk", loader.ANIM_PATH); + proto.name = "Player"_s; + proto.speed = accel; + proto.playable = true; + proto.offset = {}; + proto.bbox_offset = {}; + proto.bbox_size = Vector2ub(tile_size_xy/2); + return proto; +} + template<typename F> void run(StringView name, const F& make_dt, critter& npc, const point start, const rotation r, @@ -26,7 +39,7 @@ void run(StringView name, const F& make_dt, critter& npc, const Ns max_time = Second*300, bool no_crash = false) { constexpr uint32_t max_steps = 10'000; - fm_assert(max_time < Second*300); + fm_assert(max_time <= Second*300); auto index = npc.index(); npc.teleport_to(index, start, rotation_COUNT); @@ -100,19 +113,6 @@ void run(StringView name, const F& make_dt, critter& npc, * time=6800ms */ -critter_proto make_proto(int accel) -{ - critter_proto proto; - proto.atlas = loader.anim_atlas("npc-walk", loader.ANIM_PATH); - proto.name = "Player"_s; - proto.speed = accel; - proto.playable = true; - proto.offset = {}; - proto.bbox_offset = {}; - proto.bbox_size = Vector2ub(tile_size_xy/2); - return proto; -} - using enum rotation; template<typename F> void test1(const F& make_dt, int accel) @@ -152,6 +152,8 @@ void test_app::test_critter() Debug{} << "--"; Debug{} << ""; test1(constantly(Millisecond * 100), 1); + test1(constantly(Millisecond * 10), 1); + test1(constantly(Millisecond * 1), 1); Debug{} << ""; } |