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. |
… | |
… | |
520 | |
520 | |
521 | return 0; |
521 | return 0; |
522 | } |
522 | } |
523 | |
523 | |
524 | /* |
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 | /* |
525 | * 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. |
526 | * Used only by the patch command, but not all that useful. |
541 | * Used only by the patch command, but not all that useful. |
527 | * Enables features like "patch <name-of-other-player> food 999" |
542 | * Enables features like "patch <name-of-other-player> food 999" |
528 | */ |
543 | */ |
529 | object * |
544 | object * |
… | |
… | |
599 | { |
614 | { |
600 | // now check wether any body locations became invalid, in which case |
615 | // now check wether any body locations became invalid, in which case |
601 | // we cannot apply the weapon at the moment. |
616 | // we cannot apply the weapon at the moment. |
602 | for (int i = 0; i < NUM_BODY_LOCATIONS; ++i) |
617 | for (int i = 0; i < NUM_BODY_LOCATIONS; ++i) |
603 | if (slot[i].used < 0) |
618 | if (slot[i].used < 0) |
604 | { |
619 | { |
|
|
620 | if (chosen_skill) |
|
|
621 | chosen_skill->flag [FLAG_APPLIED] = false; |
|
|
622 | |
605 | current_weapon = chosen_skill = 0; |
623 | current_weapon = chosen_skill = 0; |
606 | update_stats (); |
624 | update_stats (); |
607 | |
625 | |
608 | new_draw_info_format (NDI_UNIQUE, 0, this, |
626 | new_draw_info_format (NDI_UNIQUE, 0, this, |
609 | "You try to balance all your items at once, " |
627 | "You try to balance all your items at once, " |
610 | "but the %s is just too much for your body. " |
628 | "but the %s is just too much for your body. " |
611 | "[You need to unapply some items first - use the 'body' command to see " |
629 | "[You need to unapply some items first - use the 'body' command to see " |
612 | "how many items you cna wera on a specific body part.]", &ob->name); |
630 | "how many items you can wear on a specific body part.]", &ob->name); |
613 | return false; |
631 | return false; |
614 | } |
632 | } |
615 | |
633 | |
616 | //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
634 | //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
617 | } |
635 | } |
… | |
… | |
1316 | * Passing 0 for flag gives proper default values, so flag really only needs |
1334 | * Passing 0 for flag gives proper default values, so flag really only needs |
1317 | * to be set if special handling is needed. |
1335 | * to be set if special handling is needed. |
1318 | * |
1336 | * |
1319 | * Return value: |
1337 | * Return value: |
1320 | * new object if 'op' was merged with other object |
1338 | * new object if 'op' was merged with other object |
1321 | * NULL if 'op' was destroyed |
1339 | * NULL if there was an error (destroyed, blocked etc.) |
1322 | * just 'op' otherwise |
1340 | * just 'op' otherwise |
1323 | */ |
1341 | */ |
1324 | object * |
1342 | object * |
1325 | insert_ob_in_map (object *op, maptile *m, object *originator, int flag) |
1343 | insert_ob_in_map (object *op, maptile *m, object *originator, int flag) |
1326 | { |
1344 | { |
… | |
… | |
2678 | |
2696 | |
2679 | insert (force); |
2697 | insert (force); |
2680 | } |
2698 | } |
2681 | } |
2699 | } |
2682 | |
2700 | |
|
|
2701 | void object::change_move_type (MoveType mt) |
|
|
2702 | { |
|
|
2703 | if (move_type == mt) |
|
|
2704 | return; |
|
|
2705 | |
|
|
2706 | if (is_on_map ()) |
|
|
2707 | { |
|
|
2708 | // we are on the map, so handle move_on/off effects |
|
|
2709 | remove (); |
|
|
2710 | move_type = mt; |
|
|
2711 | map->insert (this, x, y, this); |
|
|
2712 | } |
|
|
2713 | else |
|
|
2714 | move_type = mt; |
|
|
2715 | } |
|
|
2716 | |