INNER CODE UNIT · C++
color_dr
symphony-of-empires/symphony-of-empires · eng3d/eng3d/borders.cpp:88
const auto color_dr = pixels[new_index + width + 1];
// Different neighbor, ie its a border
if(color_ul != color_ur || color_ur != color_dr || color_dr != color_dl || color_dl != color_ul)
return true;
return false;
}
void add_neighbor(int prev_x, int prev_y, int new_x, int new_y, int& connections) {
if(check_neighbor(new_x, new_y)) {
int old_index = prev_x + prev_y * width;
int new_index = new_x + new_y * width;
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);