Commit graph

100 commits

Author SHA1 Message Date
ephphatha
a6630eacb6 Use helper when checking if object exists in path.cpp 2021-12-29 04:57:57 +01:00
ephphatha
0b3c162ea7 Use helper instead of explicit dObject lookup in IsTileWalkable 2021-12-28 16:01:37 +01:00
Gleb Mazovetskiy
076b0c0c05 Overhaul tests
1. Adds a `libdevilution_so` target when tests are enabled.
2. Each test file is now a separate binary target linked against `libdevilutionx_so` (can now run tests in parallel).
3. Tests are now defined in a separate `test/CMakeLists.txt` file.
4. Building the tests is now controlled by the standard `BUILD_TESTING` option (defined by CTest).
5. Tests are now built by default.
6. On CI, test errors are now reported.

Also:

* `.clang-format`: Enable SortIncludes in tests
* `path_test.cpp`: Fix -Wsign-compare
2021-12-16 20:26:51 +00:00
ephphatha
b5bda7dbeb Use FindClosestValidPosition when placing Hork Spawn 2021-11-07 20:13:31 +01:00
ephphatha
730f0e65d5 Introduce FindClosestValidPosition function
The pre-calculated crawl table is replaced with partially unrolled loops to handle the special cases covered by the table.

Arbitrary limit of 50 placed to allow using this function for searches where vanilla logic would check up to (±49, ±49).
2021-11-07 20:13:31 +01:00
qndel
0ccdf940f7
fix bounds checks (#3237) 2021-10-24 17:20:04 +02:00
Gleb Mazovetskiy
c23c69d131 Fix OOB in TEST(PathTest, Solid) 2021-09-18 06:44:48 +02:00
ephphatha
b12de6fe12 Use scoped enum for Direction
Identified and removed an instance of Direction being used as an argument for a bool parameter

Removed a single-use temporary variable being cast from sprite frame to direction to size_t

Co-authored-by: Anders Jenbo <anders@jenbo.dk>

Fix alignment of WalkSettings array
2021-09-12 02:27:47 +02:00
Anders Jenbo
f0a7a5c989 🎨 Apply code style 2021-07-19 05:44:20 +02:00
Anders Jenbo
069249f318 🚚 Move local function to anonymous namespace i-p 2021-07-19 05:44:20 +02:00
Anders Jenbo
f5406e7ce1 🚨 Fix warnings related to gdwCurPathStep signed ness 2021-07-18 21:39:38 +02:00
Anders Jenbo
a19e7b2a3b Remove some more use of miniwin 2021-07-17 23:54:13 +02:00
ephphatha
4f6255791a Be more consistent with parameter names 2021-07-17 17:35:58 +02:00
ephphatha
cecb5e5d2b Move private functions into anonymous namespace 2021-07-17 17:35:58 +02:00
ephphatha
a8ed1998d1 Use Point in path_ functions that reference position
In cases like path_get_h_cost this allows simplifying logic where Point provides functions for the intended behaviour in a much simpler to understand package.

This also makes it clearer which functions are const/don't modify the node and which potentially have side effects.
2021-07-17 17:35:58 +02:00
ephphatha
7de18d27cf Extract door object type test to ObjectStruct method
This removes the direct reference to _object_id values in path.cpp, that enum is now only used in objects.h/cpp
2021-07-17 17:35:58 +02:00
ephphatha
097a519bb7 Be more defensive when interacting with the path node stacks 2021-07-17 17:35:58 +02:00
Anders Jenbo
9264ad4b89 Use IsTileNotSolid() in place of !nSolidTable[dPiece[][]] 2021-07-17 03:57:26 +02:00
Anders Jenbo
2d4da488f0 Split path test functions 2021-07-17 03:57:26 +02:00
ephphatha
190025e79f Use bound parameters for pathfinding functions operating on entities 2021-07-16 20:19:39 +02:00
Anders Jenbo
903d4bd2e1 Scope all for loops
This caused 7 of the loops to be rewriteen using range by clang-tidy
2021-07-08 08:14:03 -07:00
Anders Jenbo
9ebdb6db69 General clean up 2021-07-08 03:30:25 -07:00
Anders Jenbo
56d3b5d710 clang-tidy/Android Stuidio cleanups 5 2021-07-05 13:14:47 -07:00
Anders Jenbo
a7c7fa0030 Fully apply clang-tidy/format to all files 2021-07-03 16:41:43 -07:00
Anders Jenbo
ecea12fc15 Clang-tidy: ParameterCase 2021-07-03 15:46:39 -07:00
Anders Jenbo
0f2ad469ea ♻️Clean up variable initialization 2021-06-27 14:58:51 -07:00
Anders Jenbo
22b632f04a ♻️Clean up implicit bool conversions 2021-06-26 08:57:59 -07:00
Juliano Leal Goncalves
dd9e05222d ♻️ Change 'PosOkPlayer' to take a 'Point' instead of 2 separate ints 2021-05-25 04:09:02 +02:00
Anders Jenbo
4a7ba94702 🎨 Run clang-format 2021-05-07 23:26:39 +02:00
Anders Jenbo
2bd13451a1 ♻️Apply point positioning to all remaning entities 2021-04-25 01:25:48 +02:00
Anders Jenbo
7912e510f0 🎨 Clean up overuse of SDL types 2021-04-24 17:07:07 +02:00
Anders Jenbo
a32ac83090 🎨 cleanup trivial trype comparisons 2021-04-23 02:48:25 +02:00
Anders Jenbo
bb4e1960e7 🎨 modernize-use-nullptr 2021-04-19 16:02:05 +02:00
Anders Jenbo
997c1dba55 🚚 Split up all.h in to proper header relations 2021-04-16 01:04:54 +02:00
Anders Jenbo
f450d6a125 🚚 Move defines to there proper files 2021-04-16 01:04:54 +02:00
Anders Jenbo
20186e0370 🎨 Replace TRUE/FALSE with true/false
fix


Fix


fix
2021-04-09 15:13:02 +02:00
Anders Jenbo
93d42b62b8 ♻️ Change BOOL to bool 2021-04-09 15:13:02 +02:00
Anders Jenbo
bfb3c11c2b 🎨 Change namespace to devilution 2021-04-06 15:21:25 +02:00
Anders Jenbo
630e507f63 🚚 Apply namespace 2021-04-06 15:21:25 +02:00
Anders Jenbo
ca2c2ba5e7 🚨 Handle a bunch of warnings from CLang 2021-03-29 06:26:31 +02:00
Anders Jenbo
17803d5923 ♻️ Apply proper types to PlayerStruct 2021-03-14 15:38:23 +01:00
pionere
f5c1079d6f eliminate unused code 2021-02-19 22:04:11 +01:00
Anders Jenbo
61b2d0de95 Merge branch 'master' of github.com:diasurgical/devilution 2020-12-16 02:24:39 +01:00
Anders Jenbo
cec9579186 Merge branch 'master' of github.com:diasurgical/devilution 2020-10-12 10:48:34 +02:00
qndel
83f8fc5a90 path_get_node2 cleanup 2020-10-12 03:21:37 +02:00
qndel
77c64b99d5 path_get_node1 cleanup 2020-10-12 03:21:18 +02:00
Anders Jenbo
776ab10476 Merge branch 'master' of github.com:diasurgical/devilution 2020-03-29 23:40:05 +02:00
Anders Jenbo
d6f70c56ce Format files 2020-03-01 22:48:17 +01:00
Anders Jenbo
3c276a3cd3 Add documentation
- Add file documentation to about 1/4 of the files in Source
- Copy over a lot of the documentation from the sanctuary/notes repo
- Standardise all the existing documentation
- Create a configuration for Doxygen
- Add more documentation (engine.cpp is now fully documented)
2020-03-01 22:18:00 +01:00
Anders Jenbo
25993b4043 Merge branch 'master' of github.com:diasurgical/devilution 2020-02-14 23:03:31 +01:00