Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create strongly-typed IDs #68

Open
ethanmoffat opened this issue Feb 13, 2017 · 0 comments
Open

Create strongly-typed IDs #68

ethanmoffat opened this issue Feb 13, 2017 · 0 comments

Comments

@ethanmoffat
Copy link
Owner

Currently, character/player IDs and npc indexes are ints. It would be nice if they were strongly typed Id objects that represented a legal range of IDs.

public struct CharacterId
{
   int ID { get; }

   public CharacterId(int id)
      : this()
   {
      if(id <= 0 || id > short.MaxValue)
         throw new ArgumentException($"ID must be between 1 and {short.MaxValue}");

      ID = id;
   }
}
@ethanmoffat ethanmoffat added this to the vNext milestone May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant