0x0046FDFD
| 37 | |
| 38 | // 0x0046FDFD |
| 39 | void reset() |
| 40 | { |
| 41 | // Reset all entities to 0 |
| 42 | std::fill(std::begin(rawEntities()), std::end(rawEntities()), Entity{}); |
| 43 | // Reset all entity lists |
| 44 | std::fill(std::begin(rawListCounts()), std::end(rawListCounts()), 0); |
| 45 | std::fill(std::begin(rawListHeads()), std::end(rawListHeads()), EntityId::null); |
| 46 | |
| 47 | // Remake null entities (size maxNormalEntities) |
| 48 | EntityBase* previous = nullptr; |
| 49 | uint16_t id = 0; |
| 50 | for (; id < Limits::maxNormalEntities; ++id) |
| 51 | { |
| 52 | auto& ent = rawEntities()[id]; |
| 53 | ent.baseType = EntityBaseType::null; |
| 54 | ent.id = EntityId(id); |
| 55 | ent.nextEntityId = EntityId::null; |
| 56 | ent.linkedListOffset = getLinkedListOffset(EntityListType::null); |
| 57 | if (previous == nullptr) |
| 58 | { |
| 59 | ent.llPreviousId = EntityId::null; |
| 60 | rawListHeads()[enumValue(EntityListType::null)] = EntityId(id); |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | ent.llPreviousId = previous->id; |
| 65 | previous->nextEntityId = EntityId(id); |
| 66 | } |
| 67 | previous = &ent; |
| 68 | } |
| 69 | rawListCounts()[enumValue(EntityListType::null)] = Limits::maxNormalEntities; |
| 70 | |
| 71 | // Remake null money entities (size kMaxMoneyEntities) |
| 72 | previous = nullptr; |
| 73 | for (; id < Limits::kMaxEntities; ++id) |
| 74 | { |
| 75 | auto& ent = rawEntities()[id]; |
| 76 | ent.baseType = EntityBaseType::null; |
| 77 | ent.id = EntityId(id); |
| 78 | ent.nextEntityId = EntityId::null; |
| 79 | ent.linkedListOffset = getLinkedListOffset(EntityListType::nullMoney); |
| 80 | if (previous == nullptr) |
| 81 | { |
| 82 | ent.llPreviousId = EntityId::null; |
| 83 | rawListHeads()[enumValue(EntityListType::nullMoney)] = EntityId(id); |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | ent.llPreviousId = previous->id; |
| 88 | previous->nextEntityId = EntityId(id); |
| 89 | } |
| 90 | previous = &ent; |
| 91 | } |
| 92 | rawListCounts()[enumValue(EntityListType::nullMoney)] = Limits::kMaxMoneyEntities; |
| 93 | |
| 94 | resetSpatialIndex(); |
| 95 | EntityTweener::get().reset(); |
| 96 | } |
no test coverage detected