--- deliantra/server/server/move.C 2007/01/15 21:06:20 1.15 +++ deliantra/server/server/move.C 2007/11/16 04:18:10 1.23 @@ -1,25 +1,24 @@ /* - * CrossFire, A Multiplayer game for X-windows + * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team - * Copyright (C) 2002 Mark Wedel & Crossfire Development Team - * Copyright (C) 1992 Frank Tore Johansen + * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992,2007 Frank Tore Johansen * - * This program is free software; you can redistribute it and/or modify + * Deliantra is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * The author can be reached via e-mail to + * along with this program. If not, see . + * + * The authors can be reached via e-mail to */ #include @@ -27,11 +26,6 @@ # include #endif -#ifdef COZY_SERVER -// use a ptotoype -extern int same_party (partylist *a, partylist *b); -#endif - /* * move_object() tries to move object op in the direction "dir". * If it fails (something blocks the passage), it returns 0, @@ -46,7 +40,6 @@ return move_ob (op, dir, op); } - /* object op is trying to move in direction dir. * originator is typically the same as op, but * can be different if originator is causing op to @@ -188,8 +181,8 @@ op = op->head; op->remove (); for (tmp = op; tmp != NULL; tmp = tmp->more) - tmp->x = x + freearr_x[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x), - tmp->y = y + freearr_y[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.y); + tmp->x = x + freearr_x[i] + (tmp->arch == NULL ? 0 : tmp->arch->x), + tmp->y = y + freearr_y[i] + (tmp->arch == NULL ? 0 : tmp->arch->y); tmp = insert_ob_in_map (op, op->map, originator, 0); if (tmp) @@ -250,7 +243,8 @@ if (!nrofalt) { - LOG (llevError, "No alternative teleporters around!\n"); + LOG (llevError, "%s: no alternative teleporters around (user %s).\n", + teleporter->debug_desc (), user->debug_desc ()); return 0; } @@ -294,8 +288,8 @@ /* Update location for the object */ for (tmp = user; tmp != NULL; tmp = tmp->more) { - tmp->x = other_teleporter->x + freearr_x[k] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x); - tmp->y = other_teleporter->y + freearr_y[k] + (tmp->arch == NULL ? 0 : tmp->arch->clone.y); + tmp->x = other_teleporter->x + freearr_x[k] + (tmp->arch == NULL ? 0 : tmp->arch->x); + tmp->y = other_teleporter->y + freearr_y[k] + (tmp->arch == NULL ? 0 : tmp->arch->y); } tmp = insert_ob_in_map (user, other_teleporter->map, NULL, 0); return (tmp == NULL); @@ -430,11 +424,8 @@ /* player change place with his pets or summoned creature */ /* TODO: allow multi arch pushing. Can't be very difficult */ if (who->more == NULL -#ifdef COZY_SERVER - && ((owner && owner->contr && pusher->contr && same_party (owner->contr->party, pusher->contr->party)) || owner == pusher) -#else - && owner == pusher -#endif + && ((owner && owner->contr && pusher->contr && same_party (owner->contr->party, pusher->contr->party)) + || owner == pusher) ) { int temp; @@ -459,26 +450,22 @@ return 0; } - /* We want ONLY become enemy of evil, unaggressive monster. We must RUN in them */ /* In original we have here a unaggressive check only - that was the reason why */ /* we so often become an enemy of friendly monsters... */ /* funny: was they set to unaggressive 0 (= not so nice) they don't attack */ - if (owner != pusher && pusher->type == PLAYER && who->type != PLAYER && !QUERY_FLAG (who, FLAG_FRIENDLY) && !QUERY_FLAG (who, FLAG_NEUTRAL)) { if (pusher->contr->run_on) /* only when we run */ { - new_draw_info_format (NDI_UNIQUE, 0, pusher, "You start to attack %s !!", &who->name); + new_draw_info_format (NDI_UNIQUE, 0, pusher, "You start to attack %s!!", &who->name); CLEAR_FLAG (who, FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ who->enemy = pusher; return 1; } else - { - new_draw_info_format (NDI_UNIQUE, 0, pusher, "You avoid attacking %s.", &who->name); - } + new_draw_info_format (NDI_UNIQUE, 0, pusher, "You avoid attacking %s.", &who->name); } /* now, lets test stand still. we NEVER can push stand_still monsters. */ @@ -498,13 +485,12 @@ str1 = (who->stats.Str > 0 ? who->stats.Str : who->level); str2 = (pusher->stats.Str > 0 ? pusher->stats.Str : pusher->level); if (QUERY_FLAG (who, FLAG_WIZ) || - random_roll (str1, str1 / 2 + str1 * 2, who, PREFER_HIGH) >= - random_roll (str2, str2 / 2 + str2 * 2, pusher, PREFER_HIGH) || !move_object (who, dir)) + random_roll (str1, str1 * 5 / 2, who, PREFER_HIGH) >= + random_roll (str2, str2 * 5 / 2, pusher, PREFER_HIGH) || !move_object (who, dir)) { if (who->type == PLAYER) - { - new_draw_info_format (NDI_UNIQUE, 0, who, "%s tried to push you.", &pusher->name); - } + new_draw_info_format (NDI_UNIQUE, 0, who, "%s tried to push you.", &pusher->name); + return 0; }