keyraven / ClanGen-CSharp

Clangen, rewritten in C#
Other
1 stars 2 forks source link

IDs potentially getting re-used? #1

Closed archanyhm closed 10 months ago

archanyhm commented 11 months ago

https://github.com/keyraven/ClanGen-CSharp/blob/f155ae5f56ee7b8cec15dd9b49b8d7d0bfccd882/Clangen/Models/CatGroups/Group.cs#L23C4-L45C1

This is going to cause some trouble down the line. You usually never want to reassign identifiers in any case + this approach is "slow". I'd suggest the very same approach that most RDBMS use when assigning sequential identifiers by storing the last ID somewhere persistently (on a per-clan basis) and just incrementing it each time a new ID is needed. Hitting any tangible limits that way is incredibly unlikely + it's slightly faster + it's safer.

keyraven commented 10 months ago

The lastID is now stored on the world-level, and simply incremented whenever a new ID is generated.