1 |
elmex |
1.1 |
/* |
2 |
root |
1.22 |
* This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 |
pippijn |
1.15 |
* |
4 |
root |
1.24 |
* Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 |
root |
1.19 |
* Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 |
|
|
* Copyright (©) 1992,2007 Frank Tore Johansen |
7 |
pippijn |
1.15 |
* |
8 |
root |
1.22 |
* Deliantra is free software: you can redistribute it and/or modify |
9 |
root |
1.21 |
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation, either version 3 of the License, or |
11 |
|
|
* (at your option) any later version. |
12 |
pippijn |
1.15 |
* |
13 |
root |
1.21 |
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
pippijn |
1.15 |
* |
18 |
root |
1.21 |
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
root |
1.19 |
* |
21 |
root |
1.22 |
* The authors can be reached via e-mail to <support@deliantra.net> |
22 |
pippijn |
1.15 |
*/ |
23 |
elmex |
1.1 |
|
24 |
|
|
#include <global.h> |
25 |
|
|
#ifndef __CEXTRACT__ |
26 |
root |
1.7 |
# include <sproto.h> |
27 |
elmex |
1.1 |
#endif |
28 |
|
|
|
29 |
|
|
/* |
30 |
|
|
* move_object() tries to move object op in the direction "dir". |
31 |
|
|
* If it fails (something blocks the passage), it returns 0, |
32 |
|
|
* otherwise 1. |
33 |
|
|
* This is an improvement from the previous move_ob(), which |
34 |
|
|
* removed and inserted objects even if they were unable to move. |
35 |
|
|
*/ |
36 |
root |
1.7 |
int |
37 |
|
|
move_object (object *op, int dir) |
38 |
|
|
{ |
39 |
root |
1.29 |
return op->move (dir); |
40 |
elmex |
1.1 |
} |
41 |
|
|
|
42 |
|
|
/* object op is trying to move in direction dir. |
43 |
|
|
* originator is typically the same as op, but |
44 |
|
|
* can be different if originator is causing op to |
45 |
|
|
* move (originator is pushing op) |
46 |
|
|
* returns 0 if the object is not able to move to the |
47 |
|
|
* desired space, 1 otherwise (in which case we also |
48 |
|
|
* move the object accordingly. This function is |
49 |
|
|
* very similiar to move_object. |
50 |
|
|
*/ |
51 |
root |
1.7 |
int |
52 |
|
|
move_ob (object *op, int dir, object *originator) |
53 |
elmex |
1.1 |
{ |
54 |
root |
1.29 |
return op->move (dir, originator); |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
int |
58 |
|
|
object::move (int dir, object *originator) |
59 |
|
|
{ |
60 |
|
|
sint16 newx = x + freearr_x[dir]; |
61 |
|
|
sint16 newy = y + freearr_y[dir]; |
62 |
elmex |
1.1 |
|
63 |
root |
1.30 |
mapxy pos (this); |
64 |
|
|
pos.move (dir); |
65 |
root |
1.7 |
|
66 |
root |
1.30 |
/* If the space the object is moving to is out of the map, |
67 |
root |
1.7 |
* bail now - we know it can't work. |
68 |
|
|
*/ |
69 |
root |
1.30 |
if (!pos.normalise ()) |
70 |
root |
1.7 |
return 0; |
71 |
elmex |
1.1 |
|
72 |
root |
1.7 |
/* Is this space blocked? Players with wizpass are immune to |
73 |
|
|
* this condition. |
74 |
|
|
*/ |
75 |
root |
1.30 |
if (blocked_link (this, pos.m, pos.x, pos.y) && !flag [FLAG_WIZPASS]) |
76 |
root |
1.7 |
return 0; |
77 |
elmex |
1.1 |
|
78 |
root |
1.30 |
// check tail movability |
79 |
|
|
if (more && !more->move (dir, more->head)) |
80 |
|
|
return 0; |
81 |
|
|
|
82 |
|
|
/* we need to set the direction for the new animation code. |
83 |
root |
1.7 |
* it uses it to figure out face to use - I can't see it |
84 |
|
|
* breaking anything, but it might. |
85 |
|
|
*/ |
86 |
root |
1.29 |
direction = dir; |
87 |
elmex |
1.1 |
|
88 |
root |
1.29 |
if (will_apply & 4) |
89 |
root |
1.30 |
check_earthwalls (this, pos.m, pos.x, pos.y); |
90 |
root |
1.12 |
|
91 |
root |
1.29 |
if (will_apply & 8) |
92 |
root |
1.30 |
check_doors (this, pos.m, pos.x, pos.y); |
93 |
elmex |
1.1 |
|
94 |
root |
1.7 |
/* If this is a tail portion, just want to tell caller that move is |
95 |
|
|
* ok - the caller will deal with actual object removal/insertion |
96 |
|
|
*/ |
97 |
root |
1.29 |
if (head) |
98 |
root |
1.7 |
return 1; |
99 |
elmex |
1.1 |
|
100 |
root |
1.30 |
if (pos.m != map && contr) |
101 |
root |
1.13 |
{ |
102 |
root |
1.29 |
if (INVOKE_MAP (LEAVE, map, ARG_PLAYER (contr))) |
103 |
root |
1.13 |
return 0; |
104 |
|
|
|
105 |
root |
1.29 |
remove (); |
106 |
root |
1.13 |
|
107 |
root |
1.30 |
if (INVOKE_PLAYER (MAP_CHANGE, contr, ARG_MAP (pos.m), ARG_INT (pos.x), ARG_INT (pos.y))) |
108 |
root |
1.13 |
return 0; |
109 |
|
|
|
110 |
root |
1.30 |
if (INVOKE_MAP (ENTER, pos.m, ARG_PLAYER (contr), ARG_INT (pos.x), ARG_INT (pos.y))) |
111 |
root |
1.13 |
return 0; |
112 |
|
|
} |
113 |
elmex |
1.1 |
|
114 |
root |
1.7 |
/* insert_ob_in_map will deal with any tiling issues */ |
115 |
root |
1.30 |
pos.insert (this, originator); |
116 |
elmex |
1.1 |
|
117 |
root |
1.7 |
return 1; |
118 |
elmex |
1.1 |
} |
119 |
|
|
|
120 |
|
|
/* |
121 |
|
|
* transfer_ob(): Move an object (even linked objects) to another spot |
122 |
|
|
* on the same map. |
123 |
|
|
* |
124 |
|
|
* Does nothing if there is no free spot. |
125 |
|
|
* |
126 |
|
|
* randomly: If true, use find_free_spot() to find the destination, otherwise |
127 |
|
|
* use find_first_free_spot(). |
128 |
|
|
* |
129 |
|
|
* Return value: 1 if object was destroyed, 0 otherwise. |
130 |
|
|
*/ |
131 |
|
|
|
132 |
root |
1.7 |
int |
133 |
|
|
transfer_ob (object *op, int x, int y, int randomly, object *originator) |
134 |
elmex |
1.1 |
{ |
135 |
root |
1.7 |
int i; |
136 |
|
|
object *tmp; |
137 |
|
|
|
138 |
|
|
if (randomly) |
139 |
|
|
i = find_free_spot (op, op->map, x, y, 0, SIZEOFFREE); |
140 |
|
|
else |
141 |
|
|
i = find_first_free_spot (op, op->map, x, y); |
142 |
|
|
|
143 |
|
|
if (i == -1) |
144 |
|
|
return 0; /* No free spot */ |
145 |
|
|
|
146 |
root |
1.26 |
op = op->head_ (); |
147 |
root |
1.10 |
op->remove (); |
148 |
elmex |
1.1 |
|
149 |
root |
1.26 |
for (object *tmp = op; tmp; tmp = tmp->more) |
150 |
|
|
{ |
151 |
root |
1.30 |
tmp->x = x + freearr_x[i] + tmp->arch->x; |
152 |
|
|
tmp->y = y + freearr_y[i] + tmp->arch->y; |
153 |
root |
1.26 |
} |
154 |
|
|
|
155 |
|
|
op = insert_ob_in_map (op, op->map, originator, 0); |
156 |
|
|
|
157 |
|
|
return !op; |
158 |
elmex |
1.1 |
} |
159 |
|
|
|
160 |
|
|
/* |
161 |
|
|
* Return value: 1 if object was destroyed, 0 otherwise. |
162 |
|
|
* Modified so that instead of passing the 'originator' that had no |
163 |
|
|
* real use, instead we pass the 'user' of the teleporter. All the |
164 |
|
|
* callers know what they wanted to teleporter (move_teleporter or |
165 |
|
|
* shop map code) |
166 |
|
|
* tele_type is the type of teleporter we want to match against - |
167 |
|
|
* currently, this is either set to SHOP_MAT or TELEPORTER. |
168 |
|
|
* It is basically used so that shop_mats and normal teleporters can |
169 |
|
|
* be used close to each other and not have the player put to the |
170 |
|
|
* one of another type. |
171 |
|
|
*/ |
172 |
root |
1.7 |
int |
173 |
|
|
teleport (object *teleporter, uint8 tele_type, object *user) |
174 |
elmex |
1.1 |
{ |
175 |
root |
1.30 |
if (!user) |
176 |
|
|
return 0; |
177 |
|
|
|
178 |
|
|
object *other_teleporter = 0; |
179 |
|
|
int nrofalt = 0; |
180 |
root |
1.7 |
|
181 |
root |
1.30 |
user = user->head_ (); |
182 |
elmex |
1.1 |
|
183 |
root |
1.7 |
/* Find all other teleporters within range. This range |
184 |
|
|
* should really be setable by some object attribute instead of |
185 |
|
|
* using hard coded values. |
186 |
|
|
*/ |
187 |
root |
1.30 |
unordered_mapwalk (teleporter, -5, -5, 5, 5) |
188 |
|
|
{ |
189 |
|
|
mapspace &ms = m->at (nx, ny); |
190 |
root |
1.28 |
|
191 |
root |
1.30 |
for (object *tmp = ms.top; tmp; tmp = tmp->below) |
192 |
|
|
if (tmp->type == tele_type) |
193 |
|
|
{ |
194 |
|
|
if ((dx || dy) && !rndm (++nrofalt)) |
195 |
|
|
other_teleporter = tmp; |
196 |
root |
1.7 |
|
197 |
root |
1.30 |
break; |
198 |
root |
1.7 |
} |
199 |
|
|
} |
200 |
elmex |
1.1 |
|
201 |
root |
1.7 |
if (!nrofalt) |
202 |
|
|
{ |
203 |
root |
1.23 |
LOG (llevError, "%s: no alternative teleporters around (user %s).\n", |
204 |
|
|
teleporter->debug_desc (), user->debug_desc ()); |
205 |
root |
1.7 |
return 0; |
206 |
elmex |
1.1 |
} |
207 |
|
|
|
208 |
root |
1.30 |
int k = find_free_spot (user, other_teleporter->map, other_teleporter->x, other_teleporter->y, 1, 9); |
209 |
root |
1.7 |
|
210 |
|
|
/* if k==-1, unable to find a free spot. If this is shop |
211 |
|
|
* mat that the player is using, find someplace to move |
212 |
|
|
* the player - otherwise, player can get trapped in the shops |
213 |
|
|
* that appear in random dungeons. We basically just make |
214 |
|
|
* sure the space isn't no pass (eg wall), and don't care |
215 |
|
|
* about is alive. |
216 |
|
|
*/ |
217 |
|
|
if (k == -1) |
218 |
|
|
{ |
219 |
root |
1.30 |
if (tele_type == SHOP_MAT && user->is_player ()) |
220 |
root |
1.7 |
{ |
221 |
|
|
for (k = 1; k < 9; k++) |
222 |
|
|
{ |
223 |
root |
1.30 |
maptile *m; |
224 |
|
|
sint16 sx, sy; |
225 |
|
|
|
226 |
root |
1.7 |
if (get_map_flags (other_teleporter->map, &m, |
227 |
|
|
other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k], &sx, &sy) & P_OUT_OF_MAP) |
228 |
|
|
continue; |
229 |
root |
1.4 |
|
230 |
root |
1.7 |
if (!OB_TYPE_MOVE_BLOCK (user, GET_MAP_MOVE_BLOCK (m, sx, sy))) |
231 |
|
|
break; |
232 |
root |
1.30 |
} |
233 |
root |
1.4 |
|
234 |
root |
1.7 |
if (k == 9) |
235 |
|
|
{ |
236 |
|
|
LOG (llevError, "Shop mat %s (%d, %d) is in solid rock?\n", |
237 |
|
|
&other_teleporter->name, other_teleporter->x, other_teleporter->y); |
238 |
|
|
return 0; |
239 |
root |
1.4 |
} |
240 |
|
|
} |
241 |
root |
1.7 |
else |
242 |
|
|
return 0; |
243 |
elmex |
1.1 |
} |
244 |
|
|
|
245 |
root |
1.30 |
return !other_teleporter->map->insert ( |
246 |
|
|
user, other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k] |
247 |
|
|
); |
248 |
elmex |
1.1 |
} |
249 |
|
|
|
250 |
root |
1.7 |
void |
251 |
|
|
recursive_roll (object *op, int dir, object *pusher) |
252 |
|
|
{ |
253 |
|
|
if (!roll_ob (op, dir, pusher)) |
254 |
|
|
{ |
255 |
|
|
new_draw_info_format (NDI_UNIQUE, 0, pusher, "You fail to push the %s.", query_name (op)); |
256 |
|
|
return; |
257 |
|
|
} |
258 |
root |
1.31 |
|
259 |
|
|
move_ob (pusher, dir, pusher); |
260 |
root |
1.7 |
new_draw_info_format (NDI_BLACK, 0, pusher, "You move the %s.", query_name (op)); |
261 |
elmex |
1.1 |
return; |
262 |
|
|
} |
263 |
|
|
|
264 |
|
|
/* |
265 |
|
|
* This is a new version of blocked, this one handles objects |
266 |
|
|
* that can be passed through by monsters with the CAN_PASS_THRU defined. |
267 |
|
|
* |
268 |
|
|
* very new version handles also multipart objects |
269 |
|
|
* This is currently only used for the boulder roll code. |
270 |
|
|
* Returns 1 if object does not fit, 0 if it does. |
271 |
|
|
*/ |
272 |
|
|
|
273 |
root |
1.7 |
int |
274 |
root |
1.9 |
try_fit (object *op, maptile *m, int x, int y) |
275 |
elmex |
1.1 |
{ |
276 |
root |
1.7 |
object *tmp, *more; |
277 |
|
|
sint16 tx, ty; |
278 |
|
|
int mflags; |
279 |
root |
1.9 |
maptile *m2; |
280 |
elmex |
1.1 |
|
281 |
root |
1.7 |
if (op->head) |
282 |
|
|
op = op->head; |
283 |
elmex |
1.1 |
|
284 |
root |
1.7 |
for (more = op; more; more = more->more) |
285 |
|
|
{ |
286 |
|
|
tx = x + more->x - op->x; |
287 |
|
|
ty = y + more->y - op->y; |
288 |
elmex |
1.1 |
|
289 |
root |
1.7 |
mflags = get_map_flags (m, &m2, tx, ty, &tx, &ty); |
290 |
elmex |
1.1 |
|
291 |
root |
1.7 |
if (mflags & P_OUT_OF_MAP) |
292 |
|
|
return 1; |
293 |
elmex |
1.1 |
|
294 |
root |
1.12 |
for (tmp = GET_MAP_OB (m2, tx, ty); tmp; tmp = tmp->above) |
295 |
root |
1.7 |
{ |
296 |
|
|
if (tmp->head == op || tmp == op) |
297 |
|
|
continue; |
298 |
elmex |
1.1 |
|
299 |
root |
1.7 |
if ((QUERY_FLAG (tmp, FLAG_ALIVE) && tmp->type != DOOR)) |
300 |
|
|
return 1; |
301 |
elmex |
1.1 |
|
302 |
root |
1.7 |
if (OB_MOVE_BLOCK (op, tmp)) |
303 |
|
|
return 1; |
304 |
elmex |
1.1 |
|
305 |
root |
1.4 |
} |
306 |
elmex |
1.1 |
} |
307 |
root |
1.7 |
return 0; |
308 |
elmex |
1.1 |
} |
309 |
|
|
|
310 |
|
|
/* |
311 |
|
|
* this is not perfect yet. |
312 |
|
|
* it does not roll objects behind multipart objects properly. |
313 |
|
|
* Support for rolling multipart objects is questionable. |
314 |
|
|
*/ |
315 |
root |
1.7 |
int |
316 |
|
|
roll_ob (object *op, int dir, object *pusher) |
317 |
|
|
{ |
318 |
|
|
sint16 x, y; |
319 |
|
|
int flags; |
320 |
root |
1.9 |
maptile *m; |
321 |
root |
1.7 |
MoveType move_block; |
322 |
|
|
|
323 |
|
|
if (op->head) |
324 |
|
|
op = op->head; |
325 |
|
|
|
326 |
|
|
x = op->x + freearr_x[dir]; |
327 |
|
|
y = op->y + freearr_y[dir]; |
328 |
|
|
|
329 |
root |
1.25 |
if (!QUERY_FLAG (op, FLAG_CAN_ROLL) |
330 |
|
|
|| (op->weight && random_roll (0, op->weight / 50000 - 1, pusher, PREFER_LOW) |
331 |
|
|
> pusher->stats.Str)) |
332 |
root |
1.7 |
return 0; |
333 |
elmex |
1.1 |
|
334 |
root |
1.7 |
m = op->map; |
335 |
|
|
flags = get_map_flags (m, &m, x, y, &x, &y); |
336 |
elmex |
1.1 |
|
337 |
root |
1.7 |
if (flags & (P_OUT_OF_MAP | P_IS_ALIVE)) |
338 |
|
|
return 0; |
339 |
elmex |
1.1 |
|
340 |
root |
1.7 |
move_block = GET_MAP_MOVE_BLOCK (m, x, y); |
341 |
elmex |
1.1 |
|
342 |
root |
1.7 |
/* If the target space is not blocked, no need to look at the objects on it */ |
343 |
|
|
if ((op->move_type & move_block) == op->move_type) |
344 |
|
|
{ |
345 |
root |
1.30 |
for (object *tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above) |
346 |
root |
1.7 |
{ |
347 |
|
|
if (tmp->head == op) |
348 |
root |
1.4 |
continue; |
349 |
root |
1.30 |
|
350 |
root |
1.7 |
if (OB_MOVE_BLOCK (op, tmp) && !roll_ob (tmp, dir, pusher)) |
351 |
root |
1.4 |
return 0; |
352 |
|
|
} |
353 |
elmex |
1.1 |
} |
354 |
root |
1.30 |
|
355 |
root |
1.7 |
if (try_fit (op, m, x, y)) |
356 |
|
|
return 0; |
357 |
elmex |
1.1 |
|
358 |
root |
1.30 |
op->move (dir); |
359 |
|
|
|
360 |
root |
1.7 |
return 1; |
361 |
elmex |
1.1 |
} |
362 |
|
|
|
363 |
|
|
/* returns 1 if pushing invokes a attack, 0 when not */ |
364 |
root |
1.7 |
int |
365 |
|
|
push_ob (object *who, int dir, object *pusher) |
366 |
|
|
{ |
367 |
|
|
int str1, str2; |
368 |
|
|
object *owner; |
369 |
|
|
|
370 |
|
|
if (who->head != NULL) |
371 |
|
|
who = who->head; |
372 |
root |
1.11 |
owner = who->owner; |
373 |
root |
1.7 |
|
374 |
|
|
/* Wake up sleeping monsters that may be pushed */ |
375 |
|
|
CLEAR_FLAG (who, FLAG_SLEEP); |
376 |
|
|
|
377 |
|
|
/* player change place with his pets or summoned creature */ |
378 |
|
|
/* TODO: allow multi arch pushing. Can't be very difficult */ |
379 |
|
|
if (who->more == NULL |
380 |
root |
1.18 |
&& ((owner && owner->contr && pusher->contr && same_party (owner->contr->party, pusher->contr->party)) |
381 |
|
|
|| owner == pusher) |
382 |
root |
1.7 |
) |
383 |
|
|
{ |
384 |
|
|
int temp; |
385 |
root |
1.9 |
maptile *m; |
386 |
root |
1.7 |
|
387 |
root |
1.10 |
who->remove (); |
388 |
|
|
pusher->remove (); |
389 |
root |
1.7 |
temp = pusher->x; |
390 |
|
|
pusher->x = who->x; |
391 |
|
|
who->x = temp; |
392 |
|
|
|
393 |
|
|
temp = pusher->y; |
394 |
|
|
pusher->y = who->y; |
395 |
|
|
who->y = temp; |
396 |
root |
1.4 |
|
397 |
root |
1.7 |
m = pusher->map; |
398 |
|
|
pusher->map = who->map; |
399 |
|
|
who->map = m; |
400 |
|
|
|
401 |
|
|
insert_ob_in_map (who, who->map, pusher, 0); |
402 |
|
|
insert_ob_in_map (pusher, pusher->map, pusher, 0); |
403 |
root |
1.30 |
|
404 |
root |
1.7 |
return 0; |
405 |
elmex |
1.1 |
} |
406 |
|
|
|
407 |
root |
1.7 |
/* We want ONLY become enemy of evil, unaggressive monster. We must RUN in them */ |
408 |
|
|
/* In original we have here a unaggressive check only - that was the reason why */ |
409 |
|
|
/* we so often become an enemy of friendly monsters... */ |
410 |
|
|
/* funny: was they set to unaggressive 0 (= not so nice) they don't attack */ |
411 |
|
|
if (owner != pusher && pusher->type == PLAYER && who->type != PLAYER && |
412 |
|
|
!QUERY_FLAG (who, FLAG_FRIENDLY) && !QUERY_FLAG (who, FLAG_NEUTRAL)) |
413 |
|
|
{ |
414 |
|
|
if (pusher->contr->run_on) /* only when we run */ |
415 |
|
|
{ |
416 |
root |
1.16 |
new_draw_info_format (NDI_UNIQUE, 0, pusher, "You start to attack %s!!", &who->name); |
417 |
root |
1.7 |
CLEAR_FLAG (who, FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ |
418 |
|
|
who->enemy = pusher; |
419 |
|
|
return 1; |
420 |
root |
1.4 |
} |
421 |
root |
1.7 |
else |
422 |
root |
1.16 |
new_draw_info_format (NDI_UNIQUE, 0, pusher, "You avoid attacking %s.", &who->name); |
423 |
elmex |
1.1 |
} |
424 |
|
|
|
425 |
root |
1.7 |
/* now, lets test stand still. we NEVER can push stand_still monsters. */ |
426 |
|
|
if (QUERY_FLAG (who, FLAG_STAND_STILL)) |
427 |
elmex |
1.1 |
{ |
428 |
root |
1.7 |
new_draw_info_format (NDI_UNIQUE, 0, pusher, "You can't push %s.", &who->name); |
429 |
|
|
return 0; |
430 |
elmex |
1.1 |
} |
431 |
root |
1.7 |
|
432 |
|
|
/* This block is basically if you are pushing friendly but |
433 |
|
|
* non pet creaturs. |
434 |
|
|
* It basically does a random strength comparision to |
435 |
|
|
* determine if you can push someone around. Note that |
436 |
|
|
* this pushes the other person away - its not a swap. |
437 |
|
|
*/ |
438 |
|
|
|
439 |
|
|
str1 = (who->stats.Str > 0 ? who->stats.Str : who->level); |
440 |
|
|
str2 = (pusher->stats.Str > 0 ? pusher->stats.Str : pusher->level); |
441 |
|
|
if (QUERY_FLAG (who, FLAG_WIZ) || |
442 |
root |
1.17 |
random_roll (str1, str1 * 5 / 2, who, PREFER_HIGH) >= |
443 |
|
|
random_roll (str2, str2 * 5 / 2, pusher, PREFER_HIGH) || !move_object (who, dir)) |
444 |
root |
1.7 |
{ |
445 |
|
|
if (who->type == PLAYER) |
446 |
root |
1.17 |
new_draw_info_format (NDI_UNIQUE, 0, who, "%s tried to push you.", &pusher->name); |
447 |
|
|
|
448 |
root |
1.7 |
return 0; |
449 |
elmex |
1.1 |
} |
450 |
|
|
|
451 |
root |
1.7 |
/* If we get here, the push succeeded. |
452 |
|
|
* Let everyone know the status. |
453 |
|
|
*/ |
454 |
|
|
if (who->type == PLAYER) |
455 |
|
|
{ |
456 |
|
|
new_draw_info_format (NDI_UNIQUE, 0, who, "%s pushed you.", &pusher->name); |
457 |
elmex |
1.1 |
} |
458 |
root |
1.7 |
if (pusher->type == PLAYER) |
459 |
|
|
{ |
460 |
|
|
new_draw_info_format (NDI_UNIQUE, 0, pusher, "You pushed %s back.", &who->name); |
461 |
|
|
} |
462 |
|
|
|
463 |
|
|
return 1; |
464 |
elmex |
1.1 |
} |