Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarEntityMap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/game/StarEntityMap.cpp')
-rw-r--r--source/game/StarEntityMap.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/game/StarEntityMap.cpp b/source/game/StarEntityMap.cpp
index 2232099..6a22a67 100644
--- a/source/game/StarEntityMap.cpp
+++ b/source/game/StarEntityMap.cpp
@@ -31,13 +31,15 @@ Maybe<EntityId> EntityMap::maybeReserveEntityId(EntityId entityId) {
if (m_spatialMap.size() >= (size_t)(m_endIdSpace - m_beginIdSpace))
throw EntityMapException("No more entity id space in EntityMap::reserveEntityId");
- if (m_spatialMap.contains(entityId))
+ if (entityId == NullEntityId || m_spatialMap.contains(entityId))
return {};
else
return entityId;
}
EntityId EntityMap::reserveEntityId(EntityId entityId) {
+ if (entityId == NullEntityId)
+ return reserveEntityId();
if (auto reserved = maybeReserveEntityId(entityId))
return *reserved;