diasurgical/DevilutionX

Prefer scoped enums where possible

Aperta

#2300 aperta il 4 lug 2021

 (4 commenti) (1 reazione) (0 assegnatari)C++ (743 fork)batch import
help wanted

Metriche repository

Star
 (7255 stelle)
Metriche merge PR
 (Merge medio 2g 12h) (15 PR mergiate in 30 g)

Descrizione

Many of the unscoped enums used in devilutionX can use enum class instead. This gives stronger type safety for things like Direction and allows unambiguous constructors/conversion functions in related classes (e.g. Displacement).

This does make it more difficult to cast back to an integral type so the usage of some enums (such as _item_indexes) will need to be evaluated to see if it's worth changing those from unscoped to scoped.

Guida contributor