… | |
… | |
52 | 0, |
52 | 0, |
53 | -1, -1, 0, 1, 1, 1, 0, -1, |
53 | -1, -1, 0, 1, 1, 1, 0, -1, |
54 | -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, |
54 | -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, |
55 | -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3 |
55 | -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3 |
56 | }; |
56 | }; |
57 | int maxfree[SIZEOFFREE] = { |
|
|
58 | 0, |
|
|
59 | 9, 10, 13, 14, 17, 18, 21, 22, |
|
|
60 | 25, 26, 27, 30, 31, 32, 33, 36, 37, 39, 39, 42, 43, 44, 45, 48, |
|
|
61 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 |
|
|
62 | }; |
|
|
63 | int freedir[SIZEOFFREE] = { |
57 | int freedir[SIZEOFFREE] = { |
64 | 0, |
58 | 0, |
65 | 1, 2, 3, 4, 5, 6, 7, 8, |
59 | 1, 2, 3, 4, 5, 6, 7, 8, |
66 | 1, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 8, 8, |
60 | 1, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 8, 8, |
67 | 1, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 7, 8, 8, 8, 8, 8 |
61 | 1, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 7, 8, 8, 8, 8, 8 |
|
|
62 | }; |
|
|
63 | |
|
|
64 | static int maxfree[SIZEOFFREE] = { |
|
|
65 | 0, |
|
|
66 | 9, 10, 13, 14, 17, 18, 21, 22, |
|
|
67 | 25, 26, 27, 30, 31, 32, 33, 36, 37, 39, 39, 42, 43, 44, 45, 48, |
|
|
68 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 |
68 | }; |
69 | }; |
69 | |
70 | |
70 | static void |
71 | static void |
71 | write_uuid (uval64 skip, bool sync) |
72 | write_uuid (uval64 skip, bool sync) |
72 | { |
73 | { |
… | |
… | |
441 | { |
442 | { |
442 | return dump_object (this); |
443 | return dump_object (this); |
443 | } |
444 | } |
444 | |
445 | |
445 | /* |
446 | /* |
446 | * get_nearest_part(multi-object, object 2) returns the part of the |
|
|
447 | * multi-object 1 which is closest to the second object. |
|
|
448 | * If it's not a multi-object, it is returned. |
|
|
449 | */ |
|
|
450 | object * |
|
|
451 | get_nearest_part (object *op, const object *pl) |
|
|
452 | { |
|
|
453 | object *tmp, *closest; |
|
|
454 | int last_dist, i; |
|
|
455 | |
|
|
456 | if (!op->more) |
|
|
457 | return op; |
|
|
458 | |
|
|
459 | for (last_dist = distance (op, pl), closest = op, tmp = op->more; |
|
|
460 | tmp; |
|
|
461 | tmp = tmp->more) |
|
|
462 | if ((i = distance (tmp, pl)) < last_dist) |
|
|
463 | closest = tmp, last_dist = i; |
|
|
464 | |
|
|
465 | return closest; |
|
|
466 | } |
|
|
467 | |
|
|
468 | /* |
|
|
469 | * Returns the object which has the count-variable equal to the argument. |
447 | * Returns the object which has the count-variable equal to the argument. |
470 | * VERRRY slow. |
448 | * VERRRY slow. |
471 | */ |
449 | */ |
472 | object * |
450 | object * |
473 | find_object (tag_t i) |
451 | find_object (tag_t i) |
… | |
… | |
2173 | * This basically means that if direction is 15, then it could either go |
2151 | * This basically means that if direction is 15, then it could either go |
2174 | * direction 4, 14, or 16 to get back to where we are. |
2152 | * direction 4, 14, or 16 to get back to where we are. |
2175 | * Moved from spell_util.c to object.c with the other related direction |
2153 | * Moved from spell_util.c to object.c with the other related direction |
2176 | * functions. |
2154 | * functions. |
2177 | */ |
2155 | */ |
2178 | const int reduction_dir[SIZEOFFREE][3] = { |
2156 | static const int reduction_dir[SIZEOFFREE][3] = { |
2179 | {0, 0, 0}, /* 0 */ |
2157 | {0, 0, 0}, /* 0 */ |
2180 | {0, 0, 0}, /* 1 */ |
2158 | {0, 0, 0}, /* 1 */ |
2181 | {0, 0, 0}, /* 2 */ |
2159 | {0, 0, 0}, /* 2 */ |
2182 | {0, 0, 0}, /* 3 */ |
2160 | {0, 0, 0}, /* 3 */ |
2183 | {0, 0, 0}, /* 4 */ |
2161 | {0, 0, 0}, /* 4 */ |