… | |
… | |
62 | #else |
62 | #else |
63 | return dx + dy - min (dx, dy) * 5 / 8; |
63 | return dx + dy - min (dx, dy) * 5 / 8; |
64 | #endif |
64 | #endif |
65 | } |
65 | } |
66 | |
66 | |
|
|
67 | /* |
|
|
68 | * absdir(int): Returns a number between 1 and 8, which represent |
|
|
69 | * the "absolute" direction of a number (it actually takes care of |
|
|
70 | * "overflow" in previous calculations of a direction). |
|
|
71 | */ |
|
|
72 | inline int |
|
|
73 | absdir (int d) |
|
|
74 | { |
|
|
75 | return ((d - 1) & 7) + 1; |
|
|
76 | } |
67 | |
77 | |
68 | // makes dynamically allocated objects zero-initialised |
78 | // makes dynamically allocated objects zero-initialised |
69 | struct zero_initialised |
79 | struct zero_initialised |
70 | { |
80 | { |
71 | void *operator new (size_t s, void *p) |
81 | void *operator new (size_t s, void *p) |