+static void copyConfigFromConfigList(struct ElementFileConfig *config)
+{
+ int i;
+
+ for (i = 0; config[i].data_type != -1; i++)
+ {
+ int data_type = config[i].data_type;
+ int conf_type = config[i].conf_type;
+ int byte_mask = conf_type & CONF_MASK_BYTES;
+
+ if (byte_mask == CONF_MASK_MULTI_BYTES)
+ {
+ int max_num_entities = config[i].max_num_entities;
+
+ if (data_type == TYPE_STRING)
+ {
+ char *string = (char *)(config[i].value);
+ char *string_copy = (char *)(config[i].value_copy);
+
+ strncpy(string_copy, string, max_num_entities);
+ }
+ else if (data_type == TYPE_ELEMENT_LIST)
+ {
+ int *element_array = (int *)(config[i].value);
+ int *element_array_copy = (int *)(config[i].value_copy);
+ int j;
+
+ for (j = 0; j < max_num_entities; j++)
+ element_array_copy[j] = element_array[j];
+ }
+ else if (data_type == TYPE_CONTENT_LIST)
+ {
+ struct Content *content = (struct Content *)(config[i].value);
+ struct Content *content_copy = (struct Content *)(config[i].value_copy);
+ int c, x, y;
+
+ for (c = 0; c < max_num_entities; c++)
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ content_copy[c].e[x][y] = content[c].e[x][y];
+ }
+ }
+ else /* constant size configuration data (1, 2 or 4 bytes) */
+ {
+ if (data_type == TYPE_BOOLEAN)
+ *(boolean *)(config[i].value_copy) = *(boolean *)(config[i].value);
+ else
+ *(int *) (config[i].value_copy) = *(int *) (config[i].value);
+ }
+ }
+}
+
+#if 1
+void copyElementInfo(struct ElementInfo *ei_from, struct ElementInfo *ei_to)
+{
+#if 1
+ int i;
+#else
+ int i, x, y;
+#endif
+
+#if 1
+ xx_ei = *ei_from; /* copy element data into temporary buffer */
+ yy_ei = *ei_to; /* copy element data into temporary buffer */
+
+ copyConfigFromConfigList(custom_element_conf);
+
+ *ei_from = xx_ei;
+ *ei_to = yy_ei;
+#endif
+
+#if 0
+ /* ---------- copy element description ---------- */
+ for (i = 0; i < MAX_ELEMENT_NAME_LEN + 1; i++)
+ ei_to->description[i] = ei_from->description[i];
+
+ /* ---------- copy element base properties ---------- */
+ ei_to->properties[EP_BITFIELD_BASE_NR] =
+ ei_from->properties[EP_BITFIELD_BASE_NR];
+
+ /* ---------- copy custom property values ---------- */
+
+ ei_to->use_gfx_element = ei_from->use_gfx_element;
+ ei_to->gfx_element = ei_from->gfx_element;
+
+ ei_to->access_direction = ei_from->access_direction;
+
+ ei_to->collect_score_initial = ei_from->collect_score_initial;
+ ei_to->collect_count_initial = ei_from->collect_count_initial;
+
+ ei_to->ce_value_fixed_initial = ei_from->ce_value_fixed_initial;
+ ei_to->ce_value_random_initial = ei_from->ce_value_random_initial;
+ ei_to->use_last_ce_value = ei_from->use_last_ce_value;
+
+ ei_to->push_delay_fixed = ei_from->push_delay_fixed;
+ ei_to->push_delay_random = ei_from->push_delay_random;
+ ei_to->drop_delay_fixed = ei_from->drop_delay_fixed;
+ ei_to->drop_delay_random = ei_from->drop_delay_random;
+ ei_to->move_delay_fixed = ei_from->move_delay_fixed;
+ ei_to->move_delay_random = ei_from->move_delay_random;
+
+ ei_to->move_pattern = ei_from->move_pattern;
+ ei_to->move_direction_initial = ei_from->move_direction_initial;
+ ei_to->move_stepsize = ei_from->move_stepsize;
+
+ ei_to->move_enter_element = ei_from->move_enter_element;
+ ei_to->move_leave_element = ei_from->move_leave_element;
+ ei_to->move_leave_type = ei_from->move_leave_type;
+
+ ei_to->slippery_type = ei_from->slippery_type;
+
+ ei_to->explosion_type = ei_from->explosion_type;
+ ei_to->explosion_delay = ei_from->explosion_delay;
+ ei_to->ignition_delay = ei_from->ignition_delay;
+
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ ei_to->content.e[x][y] = ei_from->content.e[x][y];
+#endif
+
+ /* ---------- reinitialize and copy change pages ---------- */
+
+ ei_to->num_change_pages = ei_from->num_change_pages;
+ ei_to->current_change_page = ei_from->current_change_page;
+
+ setElementChangePages(ei_to, ei_to->num_change_pages);
+
+ for (i = 0; i < ei_to->num_change_pages; i++)
+ ei_to->change_page[i] = ei_from->change_page[i];
+
+ /* ---------- copy group element info ---------- */
+ if (ei_from->group != NULL && ei_to->group != NULL) /* group or internal */
+ *ei_to->group = *ei_from->group;
+
+ /* mark this custom element as modified */
+ ei_to->modified_settings = TRUE;
+}
+#endif
+