1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
32 | |
32 | |
33 | //+GPL |
33 | //+GPL |
34 | |
34 | |
35 | typedef int tag_t; |
35 | typedef int tag_t; |
36 | |
36 | |
|
|
37 | // also see common/item.C |
37 | enum { |
38 | enum { |
38 | body_skill, |
39 | body_skill, |
39 | body_combat, |
40 | body_combat, |
40 | body_range, |
41 | body_range, |
41 | body_shield, |
42 | body_shield, |
… | |
… | |
397 | remove (); |
398 | remove (); |
398 | *this = pos; |
399 | *this = pos; |
399 | insert_at (this, this); |
400 | insert_at (this, this); |
400 | } |
401 | } |
401 | |
402 | |
402 | // high-level move functions, return true if successful |
403 | // high-level move method. |
|
|
404 | // object op is trying to move in direction dir. |
|
|
405 | // originator is typically the same as op, but |
|
|
406 | // can be different if originator is causing op to |
|
|
407 | // move (originator is pushing op) |
|
|
408 | // returns 0 if the object is not able to move to the |
|
|
409 | // desired space, 1 otherwise (in which case we also |
|
|
410 | // move the object accordingly. This function is |
|
|
411 | // very similiar to move_object. |
403 | int move (int dir, object *originator); |
412 | int move (int dir, object *originator); |
404 | |
413 | |
405 | int move (int dir) |
414 | int move (int dir) |
406 | { |
415 | { |
407 | return move (dir, this); |
416 | return move (dir, this); |
408 | } |
417 | } |
409 | |
418 | |
410 | // changes move_type to a new value - handles move_on/move_off effects |
419 | // changes move_type to a new value - handles move_on/move_off effects |
411 | void change_move_type (MoveType mt); |
420 | MTH void change_move_type (MoveType mt); |
412 | |
421 | |
413 | static bool can_merge_slow (object *op1, object *op2); |
422 | static bool can_merge_slow (object *op1, object *op2); |
414 | |
423 | |
415 | // this is often used in time-critical code, so optimise |
424 | // this is often used in time-critical code, so optimise |
416 | MTH static bool can_merge (object *op1, object *op2) |
425 | MTH static bool can_merge (object *op1, object *op2) |
… | |
… | |
421 | } |
430 | } |
422 | |
431 | |
423 | MTH void set_owner (object *owner); |
432 | MTH void set_owner (object *owner); |
424 | MTH void set_speed (float speed); |
433 | MTH void set_speed (float speed); |
425 | MTH void set_glow_radius (sint8 rad); |
434 | MTH void set_glow_radius (sint8 rad); |
426 | MTH bool change_weapon (object *ob); |
|
|
427 | MTH bool change_skill (object *ob); |
435 | MTH bool change_skill (object *ob); // deprecated? |
428 | |
436 | |
429 | MTH void open_container (object *new_container); |
437 | MTH void open_container (object *new_container); |
430 | MTH void close_container () |
438 | MTH void close_container () |
431 | { |
439 | { |
432 | open_container (0); |
440 | open_container (0); |
… | |
… | |
652 | MTH void set_flag_inv (int flag, int value = 1); |
660 | MTH void set_flag_inv (int flag, int value = 1); |
653 | |
661 | |
654 | void enter_exit (object *exit);//Perl |
662 | void enter_exit (object *exit);//Perl |
655 | MTH void enter_map (maptile *newmap, int x, int y); |
663 | MTH void enter_map (maptile *newmap, int x, int y); |
656 | void player_goto (const_utf8_string path, int x, int y); // only for players |
664 | void player_goto (const_utf8_string path, int x, int y); // only for players |
|
|
665 | MTH bool apply (object *ob, int aflags = AP_APPLY); // ob may be 0 |
657 | |
666 | |
658 | // returns the mapspace this object is in |
667 | // returns the mapspace this object is in |
659 | mapspace &ms () const; |
668 | mapspace &ms () const; |
660 | |
669 | |
661 | // fully recursive iterator |
670 | // fully recursive iterator |