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 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,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 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 |
… | |
… | |
26 | #include <stdio.h> |
26 | #include <stdio.h> |
27 | #include <sys/types.h> |
27 | #include <sys/types.h> |
28 | #include <sys/uio.h> |
28 | #include <sys/uio.h> |
29 | #include <object.h> |
29 | #include <object.h> |
30 | #include <sproto.h> |
30 | #include <sproto.h> |
31 | #include <loader.h> |
|
|
32 | |
31 | |
33 | #include <bitset> |
32 | #include <bitset> |
34 | |
33 | |
35 | UUID UUID::cur; |
34 | UUID UUID::cur; |
36 | static uint64_t seq_next_save; |
35 | static uint64_t seq_next_save; |
… | |
… | |
521 | |
520 | |
522 | return 0; |
521 | return 0; |
523 | } |
522 | } |
524 | |
523 | |
525 | /* |
524 | /* |
|
|
525 | * Returns the object which has the uuid equal to the argument. |
|
|
526 | * MOAR VERRRY slow. |
|
|
527 | */ |
|
|
528 | |
|
|
529 | object * |
|
|
530 | find_object_uuid (UUID i) |
|
|
531 | { |
|
|
532 | for_all_objects (op) |
|
|
533 | if (op->uuid == i) |
|
|
534 | return op; |
|
|
535 | |
|
|
536 | return 0; |
|
|
537 | } |
|
|
538 | |
|
|
539 | /* |
526 | * Returns the first object which has a name equal to the argument. |
540 | * Returns the first object which has a name equal to the argument. |
527 | * Used only by the patch command, but not all that useful. |
541 | * Used only by the patch command, but not all that useful. |
528 | * Enables features like "patch <name-of-other-player> food 999" |
542 | * Enables features like "patch <name-of-other-player> food 999" |
529 | */ |
543 | */ |
530 | object * |
544 | object * |
… | |
… | |
1317 | * Passing 0 for flag gives proper default values, so flag really only needs |
1331 | * Passing 0 for flag gives proper default values, so flag really only needs |
1318 | * to be set if special handling is needed. |
1332 | * to be set if special handling is needed. |
1319 | * |
1333 | * |
1320 | * Return value: |
1334 | * Return value: |
1321 | * new object if 'op' was merged with other object |
1335 | * new object if 'op' was merged with other object |
1322 | * NULL if 'op' was destroyed |
1336 | * NULL if there was an error (destroyed, blocked etc.) |
1323 | * just 'op' otherwise |
1337 | * just 'op' otherwise |
1324 | */ |
1338 | */ |
1325 | object * |
1339 | object * |
1326 | insert_ob_in_map (object *op, maptile *m, object *originator, int flag) |
1340 | insert_ob_in_map (object *op, maptile *m, object *originator, int flag) |
1327 | { |
1341 | { |
… | |
… | |
2679 | |
2693 | |
2680 | insert (force); |
2694 | insert (force); |
2681 | } |
2695 | } |
2682 | } |
2696 | } |
2683 | |
2697 | |
|
|
2698 | void object::change_move_type (MoveType mt) |
|
|
2699 | { |
|
|
2700 | if (move_type == mt) |
|
|
2701 | return; |
|
|
2702 | |
|
|
2703 | if (is_on_map ()) |
|
|
2704 | { |
|
|
2705 | // we are on the map, so handle move_on/off effects |
|
|
2706 | remove (); |
|
|
2707 | move_type = mt; |
|
|
2708 | map->insert (this, x, y, this); |
|
|
2709 | } |
|
|
2710 | else |
|
|
2711 | move_type = mt; |
|
|
2712 | } |
|
|
2713 | |