--- deliantra/server/server/move.C 2010/05/09 18:40:02 1.41
+++ deliantra/server/server/move.C 2018/11/17 23:40:04 1.50
@@ -1,24 +1,25 @@
/*
* This file is part of Deliantra, the Roguelike Realtime MMORPG.
- *
- * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
+ *
+ * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
+ * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 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
* 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
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the Affero GNU General Public License
* and the GNU General Public License along with this program. If not, see
* .
- *
+ *
* The authors can be reached via e-mail to
*/
@@ -30,8 +31,8 @@
int
object::move (int dir, object *originator)
{
- sint16 newx = x + freearr_x[dir];
- sint16 newy = y + freearr_y[dir];
+ sint16 newx = x + DIRX (dir);
+ sint16 newy = y + DIRY (dir);
mapxy pos (this);
pos.move (dir);
@@ -77,6 +78,8 @@
remove ();
+ pos.m->activate ();
+
if (INVOKE_PLAYER (MAP_CHANGE, contr, ARG_MAP (pos.m), ARG_INT (pos.x), ARG_INT (pos.y)))
return 0;
@@ -106,7 +109,6 @@
transfer_ob (object *op, int x, int y, int randomly, object *originator)
{
int i;
- object *tmp;
if (randomly)
i = find_free_spot (op, op->map, x, y, 0, SIZEOFFREE);
@@ -121,8 +123,8 @@
for (object *tmp = op; tmp; tmp = tmp->more)
{
- tmp->x = x + freearr_x[i] + tmp->arch->x;
- tmp->y = y + freearr_y[i] + tmp->arch->y;
+ tmp->x = x + DIRX (i) + tmp->arch->x;
+ tmp->y = y + DIRY (i) + tmp->arch->y;
}
op = insert_ob_in_map (op, op->map, originator, 0);
@@ -197,7 +199,7 @@
sint16 sx, sy;
if (get_map_flags (other_teleporter->map, &m,
- other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k], &sx, &sy) & P_OUT_OF_MAP)
+ other_teleporter->x + DIRX (k), other_teleporter->y + DIRY (k), &sx, &sy) & P_OUT_OF_MAP)
continue;
if (!OB_TYPE_MOVE_BLOCK (user, GET_MAP_MOVE_BLOCK (m, sx, sy)))
@@ -216,7 +218,7 @@
}
return !other_teleporter->map->insert (
- user, other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k]
+ user, other_teleporter->x + DIRX (k), other_teleporter->y + DIRY (k)
);
}
@@ -266,7 +268,7 @@
}
/*
- * this is not perfect yet.
+ * this is not perfect yet.
* it does not roll objects behind multipart objects properly.
* Support for rolling multipart objects is questionable.
*/
@@ -281,8 +283,8 @@
if (op->head)
op = op->head;
- x = op->x + freearr_x[dir];
- y = op->y + freearr_y[dir];
+ x = op->x + DIRX (dir);
+ y = op->y + DIRY (dir);
if (!op->flag [FLAG_CAN_ROLL]
|| (op->weight && random_roll (0, op->weight / 50000 - 1, pusher, PREFER_LOW)