MCPcopy Create free account
hub / github.com/diasurgical/devilution / path_solid_pieces

Function path_solid_pieces

Source/path.cpp:147–165  ·  view source on GitHub ↗

* @brief check if stepping from pPath to (dx,dy) cuts a corner. * * If you step from A to B, both Xs need to be clear: * * AX * XB * * @return true if step is allowed */

Source from the content-addressed store, hash-verified

145 * @return true if step is allowed
146 */
147BOOL path_solid_pieces(PATHNODE *pPath, int dx, int dy)
148{
149 BOOL rv = TRUE;
150 switch (path_directions[3 * (dy - pPath->y) + 3 - pPath->x + 1 + dx]) {
151 case 5:
152 rv = !nSolidTable[dPiece[dx][dy + 1]] && !nSolidTable[dPiece[dx + 1][dy]];
153 break;
154 case 6:
155 rv = !nSolidTable[dPiece[dx][dy + 1]] && !nSolidTable[dPiece[dx - 1][dy]];
156 break;
157 case 7:
158 rv = !nSolidTable[dPiece[dx][dy - 1]] && !nSolidTable[dPiece[dx - 1][dy]];
159 break;
160 case 8:
161 rv = !nSolidTable[dPiece[dx + 1][dy]] && !nSolidTable[dPiece[dx][dy - 1]];
162 break;
163 }
164 return rv;
165}
166
167/**
168 * @brief perform a single step of A* bread-first search by trying to step in every possible direction from pPath with goal (x,y). Check each step with PosOk

Callers 4

FindMeleeTargetFunction · 0.85
path_get_pathFunction · 0.85
path_parent_pathFunction · 0.85
path_set_coordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected