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) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | |
7 | * |
8 | 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 |
9 | 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 |
10 | the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. |
11 | * (at your option) any later version. |
12 | |
12 | * |
13 | 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, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | |
17 | * |
18 | 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 |
19 | along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | |
21 | * |
22 | 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> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <sproto.h> |
26 | #include <sproto.h> |
27 | #include <spells.h> |
27 | #include <spells.h> |
28 | #include <treasure.h> |
28 | #include <treasure.h> |
… | |
… | |
389 | pl->ob->enter_exit (dummy); |
389 | pl->ob->enter_exit (dummy); |
390 | dummy->destroy (); |
390 | dummy->destroy (); |
391 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); |
391 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); |
392 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
392 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
393 | |
393 | |
394 | return 1; |
|
|
395 | } |
|
|
396 | |
|
|
397 | /** |
|
|
398 | * Teleport next to target player. |
|
|
399 | */ |
|
|
400 | |
|
|
401 | /* mids 01/16/2002 */ |
|
|
402 | int |
|
|
403 | command_teleport (object *op, char *params) |
|
|
404 | { |
|
|
405 | int i; |
|
|
406 | object *dummy; |
|
|
407 | player *pl; |
|
|
408 | |
|
|
409 | if (!op) |
|
|
410 | return 0; |
|
|
411 | |
|
|
412 | if (params == NULL) |
|
|
413 | { |
|
|
414 | new_draw_info (NDI_UNIQUE, 0, op, "Usage: teleport <player>."); |
|
|
415 | return 1; |
|
|
416 | } |
|
|
417 | |
|
|
418 | pl = get_other_player_from_name (op, params); |
|
|
419 | if (!pl) |
|
|
420 | return 1; |
|
|
421 | |
|
|
422 | i = find_free_spot (pl->ob, pl->ob->map, pl->ob->x, pl->ob->y, 1, 9); |
|
|
423 | if (i == -1) |
|
|
424 | { |
|
|
425 | new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to teleport to."); |
|
|
426 | return 1; |
|
|
427 | } |
|
|
428 | |
|
|
429 | dummy = object::create (); |
|
|
430 | EXIT_PATH (dummy) = pl->ob->map->path; |
|
|
431 | EXIT_X (dummy) = pl->ob->x + freearr_x[i]; |
|
|
432 | EXIT_Y (dummy) = pl->ob->y + freearr_y[i]; |
|
|
433 | op->enter_exit (dummy); |
|
|
434 | dummy->destroy (); |
|
|
435 | if (!op->contr->hidden) |
|
|
436 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You see a portal open."); |
|
|
437 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
|
|
438 | return 1; |
394 | return 1; |
439 | } |
395 | } |
440 | |
396 | |
441 | /** |
397 | /** |
442 | * This function is a real mess, because we're stucking getting |
398 | * This function is a real mess, because we're stucking getting |
… | |
… | |
536 | at_spell = archetype::find (cp); |
492 | at_spell = archetype::find (cp); |
537 | if (!at_spell || at_spell->clone.type != SPELL) |
493 | if (!at_spell || at_spell->clone.type != SPELL) |
538 | at_spell = find_archetype_by_object_name (cp); |
494 | at_spell = find_archetype_by_object_name (cp); |
539 | if (!at_spell || at_spell->clone.type != SPELL) |
495 | if (!at_spell || at_spell->clone.type != SPELL) |
540 | { |
496 | { |
541 | strcpy (spell_name, cp); |
497 | assign (spell_name, cp); |
542 | fsp = strchr (spell_name, ' '); |
498 | fsp = strchr (spell_name, ' '); |
543 | if (fsp) |
499 | if (fsp) |
544 | { |
500 | { |
545 | *fsp = 0; |
501 | *fsp = 0; |
546 | fsp++; |
502 | fsp++; |
… | |
… | |
1049 | |
1005 | |
1050 | if (from != STACK_FROM_STACK) |
1006 | if (from != STACK_FROM_STACK) |
1051 | /* Item is either stack top, or is a number thus is now stack top, let's remove it */ |
1007 | /* Item is either stack top, or is a number thus is now stack top, let's remove it */ |
1052 | dm_stack_pop (op->contr); |
1008 | dm_stack_pop (op->contr); |
1053 | |
1009 | |
1054 | if (!QUERY_FLAG (tmp, FLAG_REMOVED)) |
|
|
1055 | { |
|
|
1056 | new_draw_info (NDI_UNIQUE, 0, op, "Warning, item wasn't removed."); |
|
|
1057 | tmp->remove (); |
|
|
1058 | } |
|
|
1059 | |
|
|
1060 | if (tmp->head) |
1010 | if (tmp->head) |
1061 | tmp = tmp->head; |
1011 | tmp = tmp->head; |
1062 | |
1012 | |
1063 | tmp->destroy (); |
1013 | tmp->destroy (); |
1064 | return 1; |
1014 | return 1; |