In your last example, what is the trouble with sentinel values ? i can understand the perfs are not ok with boxing/unboxing of enum in a dictionary, but this is not related with sentinel. I guess the sentinel values are used higher to enumerate the whole inventory.
For me the cast is not ugly here.In this case, i prefer using an enum - which is structuring the code - and add a cast to gain perfs (this is to compare to the non sense which consist casting (byte)3 to match an enum where eRealm.Hibernia should be used).
What are your conclusion to changing all sentinels values ?
I think to be put it in DoL core, it should simply allow to add enum values in the more natural way, this is a real benefits, not having to care about sentinels, ie:
- Code: Select all
enum eRealm
{
hibernia,
midgard,
albion,
}
becomes
- Code: Select all
enum eRealm
{
hibernia,
midgard,
albion,
none,
}
(i prefer not assign corresponding values in enum, and when read from database, affect via switch or if statement: if (dolcharacter.realm==3) player.realm = eRealm.Hibernia; )
Having more methods is not a problem, w/e the solution you can meet.
Using IsDefined(), explose big enums to little ones, and make methods to target more little enums (ie globalinventory, carryedinventory, chestinventory,... the needed are all in the code, which is exhaustive on this point) can help
Yes, this is not prioritary dev, but leading to a simple and better structure is interesting, and if you are interested to do and if it matchs the above criterias, it sounds like an interesting improvment
