From 58ee1221d47fbcd3b86ad85f26f6eb65579999fa Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 12 May 2025 04:03:25 +0100 Subject: Update test link creation code to use new interface(s) --- application/main.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'application/main.cpp') diff --git a/application/main.cpp b/application/main.cpp index 3536cf7..2afe2cb 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -62,21 +62,10 @@ public: return terrain->positionAt(n); })); - Link::Ptr l3; - for (std::optional previousDir; const auto [fromPos, toPos] : std::views::pairwise(nodes)) { - const auto links = railLinks->create(gameState->terrain.get(), - { - .fromEnd = {.position = fromPos, .direction = previousDir}, - .toEnd = {.position = toPos, .direction = std::nullopt}, - }); - for (const auto & link : links) { - railLinks->add(terrain.get(), link); - } - l3 = links.back(); - previousDir = links.back()->endAt(toPos)->dir; - } + const auto chain = railLinks->createChain(gameState->terrain.get(), nodes); + railLinks->add(gameState->terrain.get(), chain); - const std::shared_ptr train = world.create(l3, 0); + const std::shared_ptr train = world.create(chain.front(), 0); auto b47 = assets.at("brush-47").dynamicCast(); for (int N = 0; N < 6; N++) { train->create(b47); -- cgit v1.2.3