* @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 */
| 145 | * @return true if step is allowed |
| 146 | */ |
| 147 | BOOL 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 |
no outgoing calls
no test coverage detected