INNER CODE UNIT · C++
index
symphony-of-empires/symphony-of-empires · eng3d/eng3d/borders.cpp:99
int index = 2 * glm::min<int>(old_index, new_index) + std::abs(prev_x - new_x);
if(walked_paths.count(index)) return;
walked_positions.insert(new_index);
if(connections++ > 1) {
unexplored_paths.push(old_index);
} else {
current_paths.push(new_index);
walked_paths.insert(index);
}
}
}
void get_border(int current_index, int connections) {
int x = current_index % width;
int y = current_index / width;
auto& current_river = borders.back();
current_river.push_back(glm::vec3(x + 1.f, y + 1.f, -0.05));