MeikelLP / quantum-core-x

Metin2 open source server implementation
https://meikellp.github.io/quantum-core-x/
Mozilla Public License 2.0
35 stars 9 forks source link

Implement strongly typed IDs to differentiate between database ID and instance ID #173

Open MeikelLP opened 1 week ago

MeikelLP commented 1 week ago

see https://andrewlock.net/using-strongly-typed-entity-ids-to-avoid-primitive-obsession-part-1/

Most of the IDs of any sort are uints in QCX. Sadly this type does cover multiple use cases:

It's not clear which use case the type uint represents in each case. Mistakes can be made easily. To prevent this we can implement custom ID types which are still uints but you have to explicitly cast them to change one to another - making transitions very clear - if ever needed.