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. |
… | |
… | |
397 | remove (); |
397 | remove (); |
398 | *this = pos; |
398 | *this = pos; |
399 | insert_at (this, this); |
399 | insert_at (this, this); |
400 | } |
400 | } |
401 | |
401 | |
402 | // high-level move functions, return true if successful |
402 | // high-level move method. |
|
|
403 | // object op is trying to move in direction dir. |
|
|
404 | // originator is typically the same as op, but |
|
|
405 | // can be different if originator is causing op to |
|
|
406 | // move (originator is pushing op) |
|
|
407 | // returns 0 if the object is not able to move to the |
|
|
408 | // desired space, 1 otherwise (in which case we also |
|
|
409 | // move the object accordingly. This function is |
|
|
410 | // very similiar to move_object. |
403 | int move (int dir, object *originator); |
411 | int move (int dir, object *originator); |
404 | |
412 | |
405 | int move (int dir) |
413 | int move (int dir) |
406 | { |
414 | { |
407 | return move (dir, this); |
415 | return move (dir, this); |
408 | } |
416 | } |
|
|
417 | |
|
|
418 | // changes move_type to a new value - handles move_on/move_off effects |
|
|
419 | MTH void change_move_type (MoveType mt); |
409 | |
420 | |
410 | static bool can_merge_slow (object *op1, object *op2); |
421 | static bool can_merge_slow (object *op1, object *op2); |
411 | |
422 | |
412 | // this is often used in time-critical code, so optimise |
423 | // this is often used in time-critical code, so optimise |
413 | MTH static bool can_merge (object *op1, object *op2) |
424 | MTH static bool can_merge (object *op1, object *op2) |
… | |
… | |
808 | MTH void post_load_check (); // do some adjustments after parsing |
819 | MTH void post_load_check (); // do some adjustments after parsing |
809 | |
820 | |
810 | object_vector_index ACC (RW, archid); // index in archvector |
821 | object_vector_index ACC (RW, archid); // index in archvector |
811 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
822 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
812 | |
823 | |
813 | sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ |
824 | sint8 ACC (RW, max_x); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ |
814 | sint8 ACC (RW, max_x), ACC (RW, max_y); |
|
|
815 | |
825 | |
816 | // support for archetype loading |
826 | // support for archetype loading |
817 | static archetype *read (object_thawer &f); |
827 | static archetype *read (object_thawer &f); |
818 | MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more |
828 | MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more |
819 | static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ |
829 | static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ |
820 | }; |
830 | }; |
821 | |
831 | |
822 | // returns whether the objetc is a dragon player, which are often specialcased |
832 | // returns whether the object is a dragon player, which are often specialcased |
823 | inline bool |
833 | inline bool |
824 | object::is_dragon () const |
834 | object::is_dragon () const |
825 | { |
835 | { |
826 | return arch->race == shstr_dragon && is_player (); |
836 | return arch->race == shstr_dragon && is_player (); |
827 | } |
837 | } |