ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/move.C
(Generate patch)

Comparing deliantra/server/server/move.C (file contents):
Revision 1.30 by root, Sun Dec 28 15:28:47 2008 UTC vs.
Revision 1.35 by root, Sun Nov 15 19:13:10 2009 UTC

3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24#include <global.h> 25#include <global.h>
245 return !other_teleporter->map->insert ( 246 return !other_teleporter->map->insert (
246 user, other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k] 247 user, other_teleporter->x + freearr_x[k], other_teleporter->y + freearr_y[k]
247 ); 248 );
248} 249}
249 250
250void
251recursive_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 (void) move_ob (pusher, dir, pusher);
259 new_draw_info_format (NDI_BLACK, 0, pusher, "You move the %s.", query_name (op));
260 return;
261}
262
263/* 251/*
264 * This is a new version of blocked, this one handles objects 252 * This is a new version of blocked, this one handles objects
265 * that can be passed through by monsters with the CAN_PASS_THRU defined. 253 * that can be passed through by monsters with the CAN_PASS_THRU defined.
266 * 254 *
267 * very new version handles also multipart objects 255 * very new version handles also multipart objects
268 * This is currently only used for the boulder roll code. 256 * This is currently only used for the boulder roll code.
269 * Returns 1 if object does not fit, 0 if it does. 257 * Returns 1 if object does not fit, 0 if it does.
270 */ 258 */
271 259static int
272int
273try_fit (object *op, maptile *m, int x, int y) 260try_fit (object *op, maptile *m, int x, int y)
274{ 261{
275 object *tmp, *more; 262 object *tmp, *more;
276 sint16 tx, ty; 263 sint16 tx, ty;
277 int mflags; 264 int mflags;
309/* 296/*
310 * this is not perfect yet. 297 * this is not perfect yet.
311 * it does not roll objects behind multipart objects properly. 298 * it does not roll objects behind multipart objects properly.
312 * Support for rolling multipart objects is questionable. 299 * Support for rolling multipart objects is questionable.
313 */ 300 */
314int 301static int
315roll_ob (object *op, int dir, object *pusher) 302roll_ob (object *op, int dir, object *pusher)
316{ 303{
317 sint16 x, y; 304 sint16 x, y;
318 int flags; 305 int flags;
319 maptile *m; 306 maptile *m;
355 return 0; 342 return 0;
356 343
357 op->move (dir); 344 op->move (dir);
358 345
359 return 1; 346 return 1;
347}
348
349void
350recursive_roll (object *op, int dir, object *pusher)
351{
352 if (!roll_ob (op, dir, pusher))
353 {
354 new_draw_info_format (NDI_UNIQUE, 0, pusher, "You fail to push the %s.", query_name (op));
355 return;
356 }
357
358 move_ob (pusher, dir, pusher);
359 new_draw_info_format (NDI_BLACK, 0, pusher, "You move the %s.", query_name (op));
360 return;
360} 361}
361 362
362/* returns 1 if pushing invokes a attack, 0 when not */ 363/* returns 1 if pushing invokes a attack, 0 when not */
363int 364int
364push_ob (object *who, int dir, object *pusher) 365push_ob (object *who, int dir, object *pusher)
416 CLEAR_FLAG (who, FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ 417 CLEAR_FLAG (who, FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */
417 who->enemy = pusher; 418 who->enemy = pusher;
418 return 1; 419 return 1;
419 } 420 }
420 else 421 else
421 new_draw_info_format (NDI_UNIQUE, 0, pusher, "You avoid attacking %s.", &who->name); 422 new_draw_info_format (NDI_UNIQUE, 0, pusher, "You avoid attacking %s. H<You have to run if you wish to attack unnagressive NPCs.>", &who->name);
422 } 423 }
423 424
424 /* now, lets test stand still. we NEVER can push stand_still monsters. */ 425 /* now, let's test stand still. we NEVER can push stand_still monsters. */
425 if (QUERY_FLAG (who, FLAG_STAND_STILL)) 426 if (QUERY_FLAG (who, FLAG_STAND_STILL))
426 { 427 {
427 new_draw_info_format (NDI_UNIQUE, 0, pusher, "You can't push %s.", &who->name); 428 new_draw_info_format (NDI_UNIQUE, 0, pusher, "You can't push %s. H<You simply can't.>", &who->name);
428 return 0; 429 return 0;
429 } 430 }
430 431
431 /* This block is basically if you are pushing friendly but 432 /* This block is basically if you are pushing friendly but
432 * non pet creaturs. 433 * non pet creaturs.
449 450
450 /* If we get here, the push succeeded. 451 /* If we get here, the push succeeded.
451 * Let everyone know the status. 452 * Let everyone know the status.
452 */ 453 */
453 if (who->type == PLAYER) 454 if (who->type == PLAYER)
454 {
455 new_draw_info_format (NDI_UNIQUE, 0, who, "%s pushed you.", &pusher->name); 455 new_draw_info_format (NDI_UNIQUE, 0, who, "%s pushed you.", &pusher->name);
456 } 456
457 if (pusher->type == PLAYER) 457 if (pusher->type == PLAYER)
458 {
459 new_draw_info_format (NDI_UNIQUE, 0, pusher, "You pushed %s back.", &who->name); 458 new_draw_info_format (NDI_UNIQUE, 0, pusher, "You pushed %s back.", &who->name);
460 }
461 459
462 return 1; 460 return 1;
463} 461}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines