+ int xx = x + xy[i][0];
+ int yy = y + xy[i][1];
+
+ if (last_x == xx && last_y == yy && IN_LEV_FIELD(last_x, last_y) &&
+ IS_BELT(IntelliDrawBuffer[last_x][last_y]))
+ {
+ int dir = MV_DIR_FROM_BIT(i);
+ int dir_opposite = MV_DIR_OPPOSITE(dir);
+ int last_element_old = IntelliDrawBuffer[last_x][last_y];
+ int last_belt_nr = getBeltNrFromBeltElement(last_element_old);
+ int last_direction_old = getOpenDirectionFromBelt(last_element_old);
+ int last_direction_new = last_direction_old | dir_opposite;
+
+ last_element_new = getBeltFromNrAndOpenDirection(last_belt_nr,
+ last_direction_new);
+
+ direction |= dir;
+ }
+ }
+
+ new_element = getBeltFromNrAndOpenDirectionNotEmpty(belt_nr, direction,
+ new_element);
+
+#if 1
+ if (last_element_new != EL_UNDEFINED)
+ MergeAndCloseNeighbourElements(x, y, &new_element,
+ last_x, last_y, &last_element_new,
+ getClosedBelt, change_level);
+#else
+ /* reduce connections of neighbour belt elements to minimal connections */
+ if (last_element_new != EL_UNDEFINED)
+ {
+ /* set neighbour belt elements to newly determined belt connections */
+ SetElementSimple(x, y, new_element, change_level);
+ SetElementSimple(last_x, last_y, last_element_new, change_level);
+
+ /* remove all open belt connections of neighbour belt elements */
+ new_element = getClosedBelt(x, y);
+ last_element_new = getClosedBelt(last_x, last_y);
+
+ /* set neighbour belt elements to new, minimized belt connections */
+ SetElementSimple(x, y, new_element, change_level);
+ SetElementSimple(last_x, last_y, last_element_new, change_level);
+ }
+#endif
+ }
+ else if (IS_ACID_POOL_OR_ACID(new_element))
+ {