… | |
… | |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <object.h> |
26 | #include <object.h> |
27 | #include <tod.h> |
27 | #include <tod.h> |
28 | |
|
|
29 | #ifdef HAVE_DES_H |
|
|
30 | # include <des.h> |
|
|
31 | #else |
|
|
32 | # ifdef HAVE_CRYPT_H |
|
|
33 | # include <crypt.h> |
|
|
34 | # endif |
|
|
35 | #endif |
|
|
36 | |
28 | |
37 | #include <sproto.h> |
29 | #include <sproto.h> |
38 | #include <time.h> |
30 | #include <time.h> |
39 | |
31 | |
40 | #include <../random_maps/random_map.h> |
32 | #include <../random_maps/random_map.h> |
… | |
… | |
213 | } |
205 | } |
214 | |
206 | |
215 | /* Update any golems */ |
207 | /* Update any golems */ |
216 | if (type == PLAYER && contr->ranges[range_golem]) |
208 | if (type == PLAYER && contr->ranges[range_golem]) |
217 | { |
209 | { |
218 | int i = find_free_spot (contr->ranges[range_golem], newmap, |
210 | int i = find_free_spot (contr->ranges[range_golem], newmap, x, y, 1, SIZEOFFREE); |
219 | x, y, 1, SIZEOFFREE); |
|
|
220 | |
211 | |
221 | if (i == -1) |
212 | if (i < 0) |
222 | { |
213 | { |
223 | contr->ranges[range_golem]->destroy (); |
214 | contr->ranges[range_golem]->destroy (); |
224 | contr->ranges[range_golem] = 0; |
215 | contr->ranges[range_golem] = 0; |
225 | } |
216 | } |
226 | else |
217 | else |
227 | { |
218 | { |
228 | for (object *tmp = contr->ranges[range_golem]; tmp; tmp = tmp->more) |
219 | newmap->insert (contr->ranges[range_golem], x + freearr_x[i], y + freearr_y[i]); |
229 | { |
|
|
230 | tmp->x = x + freearr_x[i] + (tmp->arch ? 0 : tmp->arch->clone.x); |
|
|
231 | tmp->y = y + freearr_y[i] + (tmp->arch ? 0 : tmp->arch->clone.y); |
|
|
232 | tmp->map = newmap; |
|
|
233 | } |
|
|
234 | |
220 | |
235 | insert_ob_in_map (contr->ranges[range_golem], newmap, NULL, 0); |
|
|
236 | contr->ranges[range_golem]->direction = |
221 | contr->ranges[range_golem]->direction = |
237 | find_dir_2 (x - contr->ranges[range_golem]->x, y - contr->ranges[range_golem]->y); |
222 | find_dir_2 (x - contr->ranges[range_golem]->x, y - contr->ranges[range_golem]->y); |
238 | } |
223 | } |
239 | } |
224 | } |
240 | |
225 | |
… | |
… | |
449 | cleanup_inform (const char *cause, bool make_core) |
434 | cleanup_inform (const char *cause, bool make_core) |
450 | { |
435 | { |
451 | int flags = NDI_UNIQUE | NDI_ALL | (make_core ? NDI_RED : NDI_GREEN); |
436 | int flags = NDI_UNIQUE | NDI_ALL | (make_core ? NDI_RED : NDI_GREEN); |
452 | |
437 | |
453 | new_draw_info_format (flags, 0, 0, "The server will now shutdown.\n"); |
438 | new_draw_info_format (flags, 0, 0, "The server will now shutdown.\n"); |
454 | new_draw_info_format (flags, 0, 0, "Cause for this shtudown: %s\n", cause); |
439 | new_draw_info_format (flags, 0, 0, "Cause for this shutdown: %s\n", cause); |
455 | |
440 | |
456 | if (make_core) |
441 | if (make_core) |
457 | new_draw_info_format (flags, 0, 0, "This is considered a crash.\n"); |
442 | new_draw_info_format (flags, 0, 0, "This is considered a crash, but all maps and players have been saved.\n"); |
458 | else |
443 | else |
459 | new_draw_info_format (flags, 0, 0, "This is considered to be a clean shutdown.\n"); |
444 | new_draw_info_format (flags, 0, 0, "This is considered to be a clean shutdown, and all maps and players have been saved.\n"); |
460 | |
445 | |
461 | new_draw_info_format (flags, 0, 0, "%s\n", CLEANUP_MESSAGE); |
446 | new_draw_info_format (flags, 0, 0, "%s\n", CLEANUP_MESSAGE); |
462 | |
447 | |
463 | flush_sockets (); |
448 | flush_sockets (); |
464 | } |
449 | } |