… | |
… | |
1116 | |
1116 | |
1117 | if (destroyed ()) |
1117 | if (destroyed ()) |
1118 | LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ()); |
1118 | LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ()); |
1119 | } |
1119 | } |
1120 | |
1120 | |
1121 | /* Eneq(@csd.uu.se): Fixed this to skip tmp->above=tmp */ |
|
|
1122 | //TODO: why is this horrible hacka fix? get rid of this code=bug! (schmorp) |
|
|
1123 | if (tmp->above == tmp) |
|
|
1124 | tmp->above = 0; |
|
|
1125 | |
|
|
1126 | last = tmp; |
1121 | last = tmp; |
1127 | } |
1122 | } |
1128 | |
1123 | |
1129 | /* last == NULL if there are no objects on this space */ |
1124 | /* last == NULL if there are no objects on this space */ |
1130 | //TODO: this makes little sense, why only update the topmost object? |
1125 | //TODO: this makes little sense, why only update the topmost object? |
… | |
… | |
1181 | if (more) |
1176 | if (more) |
1182 | return; |
1177 | return; |
1183 | |
1178 | |
1184 | object *prev = this; |
1179 | object *prev = this; |
1185 | |
1180 | |
1186 | for (archetype *at = arch->more; at; at = at->more) |
1181 | for (archetype *at = (archetype *)arch->more; at; at = (archetype *)at->more) |
1187 | { |
1182 | { |
1188 | object *op = arch_to_object (at); |
1183 | object *op = arch_to_object (at); |
1189 | |
1184 | |
1190 | op->name = name; |
1185 | op->name = name; |
1191 | op->name_pl = name_pl; |
1186 | op->name_pl = name_pl; |
… | |
… | |
1205 | object * |
1200 | object * |
1206 | insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y) |
1201 | insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y) |
1207 | { |
1202 | { |
1208 | for (object *tmp = op->head_ (); tmp; tmp = tmp->more) |
1203 | for (object *tmp = op->head_ (); tmp; tmp = tmp->more) |
1209 | { |
1204 | { |
1210 | tmp->x = x + tmp->arch->clone.x; |
1205 | tmp->x = x + tmp->arch->x; |
1211 | tmp->y = y + tmp->arch->clone.y; |
1206 | tmp->y = y + tmp->arch->y; |
1212 | } |
1207 | } |
1213 | |
1208 | |
1214 | return insert_ob_in_map (op, m, originator, flag); |
1209 | return insert_ob_in_map (op, m, originator, flag); |
1215 | } |
1210 | } |
1216 | |
1211 | |
… | |
… | |
1488 | object *tmp, *tmp1; |
1483 | object *tmp, *tmp1; |
1489 | |
1484 | |
1490 | /* first search for itself and remove any old instances */ |
1485 | /* first search for itself and remove any old instances */ |
1491 | |
1486 | |
1492 | for (tmp = op->ms ().bot; tmp; tmp = tmp->above) |
1487 | for (tmp = op->ms ().bot; tmp; tmp = tmp->above) |
1493 | if (!strcmp (tmp->arch->name, arch_string)) /* same archetype */ |
1488 | if (!strcmp (tmp->arch->archname, arch_string)) /* same archetype */ |
1494 | tmp->destroy (); |
1489 | tmp->destroy (); |
1495 | |
1490 | |
1496 | tmp1 = arch_to_object (archetype::find (arch_string)); |
1491 | tmp1 = arch_to_object (archetype::find (arch_string)); |
1497 | |
1492 | |
1498 | tmp1->x = op->x; |
1493 | tmp1->x = op->x; |
… | |
… | |
2495 | /* Basically, if the archetype has this key set, |
2490 | /* Basically, if the archetype has this key set, |
2496 | * we need to store the null value so when we save |
2491 | * we need to store the null value so when we save |
2497 | * it, we save the empty value so that when we load, |
2492 | * it, we save the empty value so that when we load, |
2498 | * we get this value back again. |
2493 | * we get this value back again. |
2499 | */ |
2494 | */ |
2500 | if (get_ob_key_link (&op->arch->clone, canonical_key)) |
2495 | if (get_ob_key_link (op->arch, canonical_key)) |
2501 | field->value = 0; |
2496 | field->value = 0; |
2502 | else |
2497 | else |
2503 | { |
2498 | { |
2504 | if (last) |
2499 | if (last) |
2505 | last->next = field->next; |
2500 | last->next = field->next; |