1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game for X-windows |
3 | |
3 | * |
|
|
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | |
7 | * |
7 | This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. |
11 | * (at your option) any later version. |
11 | |
12 | * |
12 | This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
16 | |
17 | * |
17 | You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | |
21 | * |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | #include <global.h> |
25 | #include <global.h> |
25 | #ifndef __CEXTRACT__ |
|
|
26 | # include <sproto.h> |
26 | #include <sproto.h> |
27 | #endif |
|
|
28 | #include <spells.h> |
27 | #include <spells.h> |
29 | #include <treasure.h> |
28 | #include <treasure.h> |
30 | #include <skills.h> |
29 | #include <skills.h> |
31 | |
30 | |
32 | /** Defines for DM item stack **/ |
31 | /** Defines for DM item stack **/ |
… | |
… | |
271 | #endif |
270 | #endif |
272 | |
271 | |
273 | int |
272 | int |
274 | command_shutdown (object *op, char *params) |
273 | command_shutdown (object *op, char *params) |
275 | { |
274 | { |
276 | if (op != NULL && !QUERY_FLAG (op, FLAG_WIZ)) |
275 | if (op && !QUERY_FLAG (op, FLAG_WIZ)) |
277 | { |
276 | { |
278 | new_draw_info (NDI_UNIQUE, 0, op, "Sorry, you can't shutdown the server."); |
277 | new_draw_info (NDI_UNIQUE, 0, op, "Sorry, you can't shutdown the server."); |
279 | return 1; |
278 | return 1; |
280 | } |
279 | } |
281 | |
280 | |
282 | cleanup (0); |
281 | cleanup ("dm initiated shutdown", 0); |
283 | |
282 | |
284 | /* not reached */ |
283 | /* not reached */ |
285 | return 1; |
284 | return 1; |
286 | } |
285 | } |
287 | |
286 | |
… | |
… | |
390 | pl->ob->enter_exit (dummy); |
389 | pl->ob->enter_exit (dummy); |
391 | dummy->destroy (); |
390 | dummy->destroy (); |
392 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); |
391 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); |
393 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
392 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
394 | |
393 | |
395 | return 1; |
|
|
396 | } |
|
|
397 | |
|
|
398 | /** |
|
|
399 | * Teleport next to target player. |
|
|
400 | */ |
|
|
401 | |
|
|
402 | /* mids 01/16/2002 */ |
|
|
403 | int |
|
|
404 | command_teleport (object *op, char *params) |
|
|
405 | { |
|
|
406 | int i; |
|
|
407 | object *dummy; |
|
|
408 | player *pl; |
|
|
409 | |
|
|
410 | if (!op) |
|
|
411 | return 0; |
|
|
412 | |
|
|
413 | if (params == NULL) |
|
|
414 | { |
|
|
415 | new_draw_info (NDI_UNIQUE, 0, op, "Usage: teleport <player>."); |
|
|
416 | return 1; |
|
|
417 | } |
|
|
418 | |
|
|
419 | pl = get_other_player_from_name (op, params); |
|
|
420 | if (!pl) |
|
|
421 | return 1; |
|
|
422 | |
|
|
423 | i = find_free_spot (pl->ob, pl->ob->map, pl->ob->x, pl->ob->y, 1, 9); |
|
|
424 | if (i == -1) |
|
|
425 | { |
|
|
426 | new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to teleport to."); |
|
|
427 | return 1; |
|
|
428 | } |
|
|
429 | |
|
|
430 | dummy = object::create (); |
|
|
431 | EXIT_PATH (dummy) = pl->ob->map->path; |
|
|
432 | EXIT_X (dummy) = pl->ob->x + freearr_x[i]; |
|
|
433 | EXIT_Y (dummy) = pl->ob->y + freearr_y[i]; |
|
|
434 | op->enter_exit (dummy); |
|
|
435 | dummy->destroy (); |
|
|
436 | if (!op->contr->hidden) |
|
|
437 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You see a portal open."); |
|
|
438 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
|
|
439 | return 1; |
394 | return 1; |
440 | } |
395 | } |
441 | |
396 | |
442 | /** |
397 | /** |
443 | * This function is a real mess, because we're stucking getting |
398 | * This function is a real mess, because we're stucking getting |