--- deliantra/server/server/move.C 2010/02/07 04:22:33 1.36 +++ deliantra/server/server/move.C 2011/04/23 04:56:56 1.42 @@ -1,9 +1,9 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team - * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team - * Copyright (©) 1992,2007 Frank Tore Johansen + * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2002 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992 Frank Tore Johansen * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the @@ -27,34 +27,6 @@ # include #endif -/* - * move_object() tries to move object op in the direction "dir". - * If it fails (something blocks the passage), it returns 0, - * otherwise 1. - * This is an improvement from the previous move_ob(), which - * removed and inserted objects even if they were unable to move. - */ -int -move_object (object *op, int dir) -{ - return op->move (dir); -} - -/* 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 - * move (originator is pushing op) - * returns 0 if the object is not able to move to the - * desired space, 1 otherwise (in which case we also - * move the object accordingly. This function is - * very similiar to move_object. - */ -int -move_ob (object *op, int dir, object *originator) -{ - return op->move (dir, originator); -} - int object::move (int dir, object *originator) { @@ -206,7 +178,7 @@ return 0; } - int k = find_free_spot (user, other_teleporter->map, other_teleporter->x, other_teleporter->y, 1, 9); + int k = find_free_spot (user, other_teleporter->map, other_teleporter->x, other_teleporter->y, 1, SIZEOFFREE1 + 1); /* if k==-1, unable to find a free spot. If this is shop * mat that the player is using, find someplace to move @@ -282,7 +254,7 @@ if (tmp->head == op || tmp == op) continue; - if ((QUERY_FLAG (tmp, FLAG_ALIVE) && tmp->type != DOOR)) + if ((tmp->flag [FLAG_ALIVE] && tmp->type != DOOR)) return 1; if (OB_MOVE_BLOCK (op, tmp)) @@ -312,7 +284,7 @@ x = op->x + freearr_x[dir]; y = op->y + freearr_y[dir]; - if (!QUERY_FLAG (op, FLAG_CAN_ROLL) + if (!op->flag [FLAG_CAN_ROLL] || (op->weight && random_roll (0, op->weight / 50000 - 1, pusher, PREFER_LOW) > pusher->stats.Str)) return 0; @@ -355,7 +327,7 @@ return; } - move_ob (pusher, dir, pusher); + pusher->move (dir); new_draw_info_format (NDI_BLACK, 0, pusher, "You move the %s.", query_name (op)); return; } @@ -372,7 +344,7 @@ owner = who->owner; /* Wake up sleeping monsters that may be pushed */ - CLEAR_FLAG (who, FLAG_SLEEP); + who->clr_flag (FLAG_SLEEP); /* player change place with his pets or summoned creature */ /* TODO: allow multi arch pushing. Can't be very difficult */ @@ -409,12 +381,12 @@ /* 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)) + !who->flag [FLAG_FRIENDLY] && !who->flag [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); - CLEAR_FLAG (who, FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ + who->clr_flag (FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ who->enemy = pusher; return 1; } @@ -423,7 +395,7 @@ } /* now, let's test stand still. we NEVER can push stand_still monsters. */ - if (QUERY_FLAG (who, FLAG_STAND_STILL)) + if (who->flag [FLAG_STAND_STILL]) { new_draw_info_format (NDI_UNIQUE, 0, pusher, "You can't push %s. H", &who->name); return 0; @@ -438,9 +410,9 @@ 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) || + if (who->flag [FLAG_WIZ] || random_roll (str1, str1 * 5 / 2, who, PREFER_HIGH) >= - random_roll (str2, str2 * 5 / 2, pusher, PREFER_HIGH) || !move_object (who, dir)) + random_roll (str2, str2 * 5 / 2, pusher, PREFER_HIGH) || !who->move (dir)) { if (who->type == PLAYER) new_draw_info_format (NDI_UNIQUE, 0, who, "%s tried to push you.", &pusher->name);