ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_wiz.C
(Generate patch)

Comparing deliantra/server/server/c_wiz.C (file contents):
Revision 1.29 by root, Fri Jan 5 10:50:47 2007 UTC vs.
Revision 1.34 by root, Mon Feb 5 01:24:46 2007 UTC

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#include <sproto.h> 26#include <sproto.h>
26#include <spells.h> 27#include <spells.h>
27#include <treasure.h> 28#include <treasure.h>
388 pl->ob->enter_exit (dummy); 389 pl->ob->enter_exit (dummy);
389 dummy->destroy (); 390 dummy->destroy ();
390 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); 391 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned.");
391 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 392 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
392 393
393 return 1;
394}
395
396/**
397 * Teleport next to target player.
398 */
399
400/* mids 01/16/2002 */
401int
402command_teleport (object *op, char *params)
403{
404 int i;
405 object *dummy;
406 player *pl;
407
408 if (!op)
409 return 0;
410
411 if (params == NULL)
412 {
413 new_draw_info (NDI_UNIQUE, 0, op, "Usage: teleport <player>.");
414 return 1;
415 }
416
417 pl = get_other_player_from_name (op, params);
418 if (!pl)
419 return 1;
420
421 i = find_free_spot (pl->ob, pl->ob->map, pl->ob->x, pl->ob->y, 1, 9);
422 if (i == -1)
423 {
424 new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to teleport to.");
425 return 1;
426 }
427
428 dummy = object::create ();
429 EXIT_PATH (dummy) = pl->ob->map->path;
430 EXIT_X (dummy) = pl->ob->x + freearr_x[i];
431 EXIT_Y (dummy) = pl->ob->y + freearr_y[i];
432 op->enter_exit (dummy);
433 dummy->destroy ();
434 if (!op->contr->hidden)
435 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You see a portal open.");
436 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
437 return 1; 394 return 1;
438} 395}
439 396
440/** 397/**
441 * This function is a real mess, because we're stucking getting 398 * This function is a real mess, because we're stucking getting
535 at_spell = archetype::find (cp); 492 at_spell = archetype::find (cp);
536 if (!at_spell || at_spell->clone.type != SPELL) 493 if (!at_spell || at_spell->clone.type != SPELL)
537 at_spell = find_archetype_by_object_name (cp); 494 at_spell = find_archetype_by_object_name (cp);
538 if (!at_spell || at_spell->clone.type != SPELL) 495 if (!at_spell || at_spell->clone.type != SPELL)
539 { 496 {
540 strcpy (spell_name, cp); 497 assign (spell_name, cp);
541 fsp = strchr (spell_name, ' '); 498 fsp = strchr (spell_name, ' ');
542 if (fsp) 499 if (fsp)
543 { 500 {
544 *fsp = 0; 501 *fsp = 0;
545 fsp++; 502 fsp++;
1048 1005
1049 if (from != STACK_FROM_STACK) 1006 if (from != STACK_FROM_STACK)
1050 /* 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 */
1051 dm_stack_pop (op->contr); 1008 dm_stack_pop (op->contr);
1052 1009
1053 if (!QUERY_FLAG (tmp, FLAG_REMOVED))
1054 {
1055 new_draw_info (NDI_UNIQUE, 0, op, "Warning, item wasn't removed.");
1056 tmp->remove ();
1057 }
1058
1059 if (tmp->head) 1010 if (tmp->head)
1060 tmp = tmp->head; 1011 tmp = tmp->head;
1061 1012
1062 tmp->destroy (); 1013 tmp->destroy ();
1063 return 1; 1014 return 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines