// find all elements used in current level
for (y = 0; y < lev_fieldy; y++)
+ {
for (x = 0; x < lev_fieldx; x++)
- if (Tile[x][y] < NUM_FILE_ELEMENTS) // should always be true
+ {
+ if (Tile[x][y] >= NUM_FILE_ELEMENTS) // should never happen
+ continue;
+
+ if (IS_MM_WALL(Tile[x][y]))
+ element_found[map_mm_wall_element(Tile[x][y])] = TRUE;
+ else
element_found[Tile[x][y]] = TRUE;
+ }
+ }
*num_elements = 0;
*num_elements = 0;
- // add all elements used in current level (non-custom/group elements)
+ // add all elements used in current level (non-custom/group/empty elements)
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
- if (element_found[i] && !(IS_CUSTOM_ELEMENT(i) || IS_GROUP_ELEMENT(i)))
+ if (element_found[i] && !(IS_CUSTOM_ELEMENT(i) ||
+ IS_GROUP_ELEMENT(i) ||
+ IS_EMPTY_ELEMENT(i)))
(*elements)[(*num_elements)++] = i;
- // add all elements used in current level (custom/group elements)
+ // add all elements used in current level (custom/group/empty elements)
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
- if (element_found[i] && (IS_CUSTOM_ELEMENT(i) || IS_GROUP_ELEMENT(i)))
+ if (element_found[i] && (IS_CUSTOM_ELEMENT(i) ||
+ IS_GROUP_ELEMENT(i) ||
+ IS_EMPTY_ELEMENT(i)))
(*elements)[(*num_elements)++] = i;
while (*num_elements % 4) // pad with empty elements, if needed