Finds entity IDs that are used more than once, and replaces repeats with -1 so they will be automatically reassigned
| 267 | |
| 268 | // Finds entity IDs that are used more than once, and replaces repeats with -1 so they will be automatically reassigned |
| 269 | static void ExtractFlatList(EntityDescriptionList* desc_list, std::vector<IDAndType>& id_used) { |
| 270 | uint32_t counter = 1; // Zero is assigned to the terrain |
| 271 | // bool print_results = false; |
| 272 | for (auto& it : *desc_list) { |
| 273 | id_used.resize(id_used.size() + 1); |
| 274 | IDAndType* id_and_type = &id_used.back(); |
| 275 | id_and_type->desc = ⁢ |
| 276 | id_and_type->desc->GetEditableField(EDF_ENTITY_TYPE)->ReadInt((int*)&id_and_type->type); |
| 277 | id_and_type->desc->GetEditableField(EDF_ID)->ReadInt(&id_and_type->id); |
| 278 | id_and_type->counter = counter++; |
| 279 | if (!id_and_type->desc->children.empty()) { |
| 280 | ExtractFlatList(&id_and_type->desc->children, id_used); |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | static void SetDescID(EntityDescription* desc, int id) { |
| 286 | EntityDescriptionField* edf = desc->GetEditableField(EDF_ID); |
no test coverage detected