ent->spawn_id must not overflow

This commit is contained in:
Andrei Alexeyev 2020-04-01 02:15:13 +03:00
parent 40a604a6a5
commit 7b445fbc77
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4

View file

@ -84,12 +84,7 @@ void ent_register(EntityInterface *ent, EntityType type) {
ent->index = entities.num++;
ent->spawn_id = ++entities.total_spawns;
if(ent->spawn_id == 0) {
// This is not really an error, but it may result in weird draw order
// in some corner cases. If this overflow ever actually occurs, though,
// then you've probably got much bigger problems.
log_warn("spawn_id just overflowed. You might be spawning stuff waaaay too often");
}
assert(ent->spawn_id > 0);
if(entities.capacity < entities.num) {
entities.capacity *= 2;