diff --git a/source/EngineGpuKernels/ReconnectorProcessor.cuh b/source/EngineGpuKernels/ReconnectorProcessor.cuh index 43b09085e..5ac34758c 100644 --- a/source/EngineGpuKernels/ReconnectorProcessor.cuh +++ b/source/EngineGpuKernels/ReconnectorProcessor.cuh @@ -56,10 +56,13 @@ ReconnectorProcessor::tryEstablishConnection(SimulationData& data, SimulationSta if (cell->creatureId != 0 && otherCell->creatureId == cell->creatureId) { return; } - if (CellConnectionProcessor::isConnectedConnected(cell, otherCell)) { + if (otherCell->barrier) { return; } - if (otherCell->barrier) { + if (otherCell->color != cell->cellFunctionData.reconnector.color) { + return; + } + if (CellConnectionProcessor::isConnectedConnected(cell, otherCell)) { return; } auto distance = data.cellMap.getDistance(cell->pos, otherCell->pos); diff --git a/source/EngineInterface/Descriptions.h b/source/EngineInterface/Descriptions.h index cf14b5df1..2d6fc4946 100644 --- a/source/EngineInterface/Descriptions.h +++ b/source/EngineInterface/Descriptions.h @@ -284,6 +284,12 @@ struct ReconnectorDescription int color = 0; auto operator<=>(ReconnectorDescription const&) const = default; + + ReconnectorDescription& setColor(int value) + { + color = value; + return *this; + } }; using CellFunctionDescription = std::optionalsetSimulationData(data); + _simController->calcTimesteps(1); + + auto actualData = _simController->getSimulationData(); + ASSERT_EQ(3, actualData.cells.size()); + + auto actualReconnectorCell = getCell(actualData, 1); + + auto actualTargetCell = getCell(actualData, 3); + + EXPECT_TRUE(std::abs(actualReconnectorCell.activity.channels[0]) < NEAR_ZERO); + EXPECT_EQ(1, actualReconnectorCell.connections.size()); + EXPECT_EQ(0, actualTargetCell.connections.size()); + EXPECT_TRUE(approxCompare(getEnergy(data), getEnergy(actualData))); } TEST_F(ReconnectorTests, establishConnection_success)