devilutionX/Source/engine
Andrew James ff145b422d
Refactor plrctrls functions to use Point and Direction types (#2155)
* Refactor GetRotaryDistance to use Point instead of int x/y params

* Refactor HSExists to use Point instead of int x/y params

* Refactor IsPathBlocked to take typed params (Point, Direction)

The caller was already passing in a Direction value so this matches usage better. I also pulled the Direction to Point helper function up so it is available as a static class member, this allows replacing the use of the Offset array in plrctrls.cpp.

When adding a Direction to a point (and not scaling it first) I avoid explicitly creating a Point object since the operator+ overload will do that conversion implicitly.

* Replace Offsets array with Point::fromDirection

* Refactor GetDistanceRanged to use Point

I've added ExactDistance as a member function of Point to match ApproxDistance instead of only having it defined in GetDistanceRanged, it seemed more appropriate to be part of the class. Also removed temporary variables from callers of GetDistanceRanged as they were mainly used as a convenience for avoiding repetition when passing values into this function.

* Refactor GetDistance to use Point
2021-06-26 17:56:06 +02:00
..
render 🔥 Remove unused code 2021-06-25 13:22:08 +02:00
actor_position.hpp 🚚 engine.h: Extract ActorPosition 2021-06-21 01:36:20 -07:00
animationinfo.cpp Introduce AnimationInfo.IsPetrified to handle Stone Curse Spell 2021-06-25 11:52:12 -07:00
animationinfo.h Introduce AnimationInfo.IsPetrified to handle Stone Curse Spell 2021-06-25 11:52:12 -07:00
cel_header.hpp ♻️ Clean up cel_header.hpp 2021-06-23 11:27:56 +01:00
cel_sprite.hpp 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
direction.hpp 🚚 engine.h: Extract Point, Direction, clamp 2021-06-21 01:36:20 -07:00
load_cel.cpp 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
load_cel.hpp 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
load_file.cpp 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
load_file.hpp ♻️ Apply clang-tidy to engine 2021-06-25 13:22:08 +02:00
point.hpp Refactor plrctrls functions to use Point and Direction types (#2155) 2021-06-26 17:56:06 +02:00
rectangle.hpp 🚚 engine.h: Extract Rectangle 2021-06-21 02:34:28 -07:00
size.hpp 🚚 engine.h: Extract Size 2021-06-21 01:36:20 -07:00