Skip to content

Commit a04ffd4

Browse files
committed
Add missing bool type to tcod.path.
1 parent d8aec76 commit a04ffd4

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ v2.0.0
88

99
Unreleased
1010
------------------
11+
Fixed
12+
- Pathfinders will now work with boolean arrays.
1113

1214
11.15.3 - 2020-07-30
1315
--------------------

tcod/path.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ def get_path(self, x: int, y: int) -> List[Tuple[int, int]]:
289289

290290

291291
_INT_TYPES = {
292+
np.bool_: lib.np_uint8,
292293
np.int8: lib.np_int8,
293294
np.int16: lib.np_int16,
294295
np.int32: lib.np_int32,
@@ -324,6 +325,11 @@ def maxarray(
324325

325326
def _export_dict(array: np.array) -> Dict[str, Any]:
326327
"""Convert a NumPy array into a format compatible with CFFI."""
328+
if array.dtype.type not in _INT_TYPES:
329+
raise TypeError(
330+
"dtype was %s, but must be one of %s."
331+
% (array.dtype.type, tuple(_INT_TYPES.keys()))
332+
)
327333
return {
328334
"type": _INT_TYPES[array.dtype.type],
329335
"ndim": array.ndim,

0 commit comments

Comments
 (0)