| 410 | |
| 411 | template <typename LiquidId> |
| 412 | void LiquidCellEngine<LiquidId>::levelMove() { |
| 413 | for (auto const& selfCell : m_currentActiveCells) { |
| 414 | if (!selfCell->liquid) |
| 415 | continue; |
| 416 | |
| 417 | auto belowCell = adjacentCell(selfCell, Adjacency::Bottom); |
| 418 | if (belowCell) |
| 419 | transferLevel(min(1.0f - belowCell->level, selfCell->level), *selfCell, *belowCell, false); |
| 420 | |
| 421 | setLevel(selfCell->level * (1.0f - m_cellWorld->drainLevel(selfCell->position)), *selfCell); |
| 422 | |
| 423 | auto lateralMove = [&](Adjacency adjacency) { |
| 424 | auto targetCell = adjacentCell(selfCell, adjacency); |
| 425 | if (targetCell) |
| 426 | transferLevel((selfCell->level - targetCell->level) * m_engineParameters.lateralMoveFactor, *selfCell, *targetCell, false); |
| 427 | }; |
| 428 | |
| 429 | if (m_random.randb()) { |
| 430 | lateralMove(Adjacency::Left); |
| 431 | lateralMove(Adjacency::Right); |
| 432 | } else { |
| 433 | lateralMove(Adjacency::Right); |
| 434 | lateralMove(Adjacency::Left); |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | template <typename LiquidId> |
| 440 | void LiquidCellEngine<LiquidId>::findInteractions() { |
nothing calls this directly
no test coverage detected