| 216 | } |
| 217 | |
| 218 | int FindClosest(int sx, int sy, int rad) |
| 219 | { |
| 220 | int j, i, mid, tx, ty, cr; |
| 221 | int CrawlNum[19] = { 0, 3, 12, 45, 94, 159, 240, 337, 450, 579, 724, 885, 1062, 1255, 1464, 1689, 1930, 2187, 2460 }; |
| 222 | |
| 223 | if (rad > 19) |
| 224 | rad = 19; |
| 225 | |
| 226 | for (i = 1; i < rad; i++) { |
| 227 | cr = CrawlNum[i] + 2; |
| 228 | for (j = (BYTE)CrawlTable[CrawlNum[i]]; j > 0; j--) { |
| 229 | tx = sx + CrawlTable[cr - 1]; |
| 230 | ty = sy + CrawlTable[cr]; |
| 231 | if (tx > 0 && tx < MAXDUNX && ty > 0 && ty < MAXDUNY) { |
| 232 | mid = dMonster[tx][ty]; |
| 233 | if (mid > 0 && !CheckBlock(sx, sy, tx, ty)) |
| 234 | return mid - 1; |
| 235 | } |
| 236 | cr += 2; |
| 237 | } |
| 238 | } |
| 239 | return -1; |
| 240 | } |
| 241 | |
| 242 | int GetSpellLevel(int id, int sn) |
| 243 | { |
no test coverage detected