Refactor missiles.cpp to use Direction enum instead of magic Point/Displacement constants
#2260 aperta il 28 giu 2021
Metriche repository
- Star
- (7255 stelle)
- Metriche merge PR
- (Merge medio 2g 12h) (15 PR mergiate in 30 g)
Descrizione
There are multiple places in missiles.cpp which iterate through tiles adjacent to a given location.
https://github.com/diasurgical/devilutionX/blob/5537fe748e63b06ed2e474f7dea6ebd1216fa3d3/Source/missiles.cpp#L1634 https://github.com/diasurgical/devilutionX/blob/5537fe748e63b06ed2e474f7dea6ebd1216fa3d3/Source/missiles.cpp#L3417 https://github.com/diasurgical/devilutionX/blob/5537fe748e63b06ed2e474f7dea6ebd1216fa3d3/Source/missiles.cpp#L3995 https://github.com/diasurgical/devilutionX/blob/5537fe748e63b06ed2e474f7dea6ebd1216fa3d3/Source/missiles.cpp#L4017 https://github.com/diasurgical/devilutionX/blob/5537fe748e63b06ed2e474f7dea6ebd1216fa3d3/Source/missiles.cpp#L4772
These lists could be directly replaced with a list of the appropriate Direction enum constants. This would retain the same behaviour as existing code while making the intent clearer.