Refactor missiles.cpp to use Direction enum instead of magic Point/Displacement constants
#2.260 geöffnet am 28.06.2021
Repository-Metriken
- Stars
- (7.255 Sterne)
- PR-Merge-Metriken
- (Durchschn. Merge 2T 12h) (15 gemergte PRs in 30 T)
Beschreibung
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.