|
Atrinik Server 2.5
|
00001 /************************************************************************ 00002 * Atrinik, a Multiplayer Online Role Playing Game * 00003 * * 00004 * Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team * 00005 * * 00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game) * 00007 * and Crossfire (Multiplayer game for X-windows). * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License * 00020 * along with this program; if not, write to the Free Software * 00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00022 * * 00023 * The author can be reached at admin@atrinik.org * 00024 ************************************************************************/ 00025 00030 #include <global.h> 00031 00039 void move_teleporter(object *op) 00040 { 00041 object *tmp, *next; 00042 00043 /* Sanity check */ 00044 if (!op->map) 00045 { 00046 return; 00047 } 00048 00049 /* get first object of this map node */ 00050 for (tmp = GET_BOTTOM_MAP_OB(op); tmp != NULL; tmp = next) 00051 { 00052 next = tmp->above; 00053 00054 if (QUERY_FLAG(tmp, FLAG_NO_TELEPORT)) 00055 { 00056 continue; 00057 } 00058 00059 /* teleport to different map */ 00060 if (EXIT_PATH(op)) 00061 { 00062 /* Trigger the TRIGGER event */ 00063 if (trigger_event(EVENT_TRIGGER, tmp, op, NULL, NULL, 0, 0, 0, SCRIPT_FIX_NOTHING)) 00064 { 00065 return; 00066 } 00067 00068 enter_exit(tmp, op); 00069 } 00070 /* teleport inside this map */ 00071 else if (EXIT_X(op) != -1 && EXIT_Y(op) != -1) 00072 { 00073 /* use OUT_OF_REAL_MAP() - we want be truly on THIS map */ 00074 if (OUT_OF_REAL_MAP(op->map, EXIT_X(op), EXIT_Y(op))) 00075 { 00076 LOG(llevBug, "Removed illegal teleporter (map: %s (%d,%d)) -> (%d,%d)\n", op->map->name, op->x, op->y, EXIT_X(op), EXIT_Y(op)); 00077 remove_ob(op); 00078 check_walk_off(op, NULL, MOVE_APPLY_VANISHED); 00079 return; 00080 } 00081 00082 /* Trigger the TRIGGER event */ 00083 if (trigger_event(EVENT_TRIGGER, tmp, op, NULL, NULL, 0, 0, 0, SCRIPT_FIX_NOTHING)) 00084 { 00085 return; 00086 } 00087 00088 transfer_ob(tmp, EXIT_X(op), EXIT_Y(op), 0, op, NULL); 00089 } 00090 /* Random teleporter */ 00091 else 00092 { 00093 /* Trigger the TRIGGER event */ 00094 if (trigger_event(EVENT_TRIGGER, op, tmp, NULL, NULL, 0, 0, 0, SCRIPT_FIX_NOTHING)) 00095 { 00096 return; 00097 } 00098 00099 teleport(op, TELEPORTER, tmp); 00100 } 00101 } 00102 }
1.7.4