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

Comparing deliantra/server/common/object.C (file contents):
Revision 1.355 by root, Mon Nov 12 03:14:32 2012 UTC vs.
Revision 1.362 by root, Thu Jan 19 21:51:43 2017 UTC

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,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 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
72 25, 26, 27, 30, 31, 32, 33, 36, 37, 39, 39, 42, 43, 44, 45, 48, 72 25, 26, 27, 30, 31, 32, 33, 36, 37, 39, 39, 42, 43, 44, 45, 48,
73 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 73 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49
74}; 74};
75 75
76const char *wall_suffix[16] = { 76const char *wall_suffix[16] = {
77 "0", 77 "0",
78 "1_3", 78 "1_3",
79 "1_4", 79 "1_4",
80 "2_1_2", 80 "2_1_2",
81 "1_2", 81 "1_2",
82 "2_2_4", 82 "2_2_4",
83 "2_2_1", 83 "2_2_1",
84 "3_1", 84 "3_1",
85 "1_1", 85 "1_1",
86 "2_2_3", 86 "2_2_3",
87 "2_2_2", 87 "2_2_2",
88 "3_3", 88 "3_3",
89 "2_1_1", 89 "2_1_1",
90 "3_4", 90 "3_4",
91 "3_2", 91 "3_2",
92 "4" 92 "4"
93}; 93};
94 94
95static void 95static void
96write_uuid (uval64 skip, bool sync) 96write_uuid (uval64 skip, bool sync)
97{ 97{
351 /* inventory ok - still need to check rest of this object to see 351 /* inventory ok - still need to check rest of this object to see
352 * if it is valid. 352 * if it is valid.
353 */ 353 */
354 } 354 }
355 355
356 /* Don't merge objects that are applied. With the new 'body' code, 356 /* Don't merge objects that are applied. With the new 'body' code,
357 * it is possible for most any character to have more than one of 357 * it is possible for most any character to have more than one of
358 * some items equipped, and we don't want those to merge. 358 * some items equipped, and we don't want those to merge.
359 */ 359 */
360 if (ob1->flag [FLAG_APPLIED] || ob2->flag [FLAG_APPLIED]) 360 if (ob1->flag [FLAG_APPLIED] || ob2->flag [FLAG_APPLIED])
361 return 0; 361 return 0;
362 362
363 /* Note sure why the following is the case - either the object has to 363 /* Not sure why the following is the case - either the object has to
364 * be animated or have a very low speed. Is this an attempted monster 364 * be animated or have a very low speed. Is this an attempted monster
365 * check? 365 * check?
366 */ 366 */
367 if (!ob1->flag [FLAG_ANIMATE] && ob1->has_active_speed ()) 367 if (!ob1->flag [FLAG_ANIMATE] && ob1->has_active_speed ())
368 return 0; 368 return 0;
369 369
464static void 464static void
465adjust_weight (object *op, weight_t sub, weight_t add) 465adjust_weight (object *op, weight_t sub, weight_t add)
466{ 466{
467 while (op) 467 while (op)
468 { 468 {
469 weight_t carrying = op->carrying 469 weight_t carrying = (weight_t)op->carrying
470 - weight_adjust_for (op, sub); 470 - weight_adjust_for (op, sub)
471 + weight_adjust_for (op, add); 471 + weight_adjust_for (op, add);
472 472
473 sub = op->carrying; 473 sub = op->carrying;
474 op->carrying = carrying; 474 op->carrying = carrying;
475 add = op->carrying; 475 add = op->carrying;
636 speed_left = -1.; 636 speed_left = -1.;
637 637
638 /* copy the body_info to the body_used - this is only really 638 /* copy the body_info to the body_used - this is only really
639 * need for monsters, but doesn't hurt to do it for everything. 639 * need for monsters, but doesn't hurt to do it for everything.
640 * by doing so, when a monster is created, it has good starting 640 * by doing so, when a monster is created, it has good starting
641 * values for the body_used info, so when items are created 641 * values for the body_used info, so when items are created
642 * for it, they can be properly equipped. 642 * for it, they can be properly equipped.
643 */ 643 */
644 for (int i = NUM_BODY_LOCATIONS; i--; ) 644 for (int i = NUM_BODY_LOCATIONS; i--; )
645 slot[i].used = slot[i].info; 645 slot[i].used = slot[i].info;
646 646
1581 if (!items // testing !items ensures we can drop at least one item 1581 if (!items // testing !items ensures we can drop at least one item
1582 || (items < m->max_items 1582 || (items < m->max_items
1583 && ms.volume () < m->max_volume)) 1583 && ms.volume () < m->max_volume))
1584 return true; 1584 return true;
1585 1585
1586 if (originator && originator->is_player ()) 1586 if (originator)
1587 originator->contr->failmsgf ( 1587 originator->failmsgf (
1588 "No matter how hard you try, you just cannot put the %s here H<Try to remove some items from the floor first.>", 1588 "No matter how hard you try, you just cannot put the %s here! H<Try to remove some items from the floor first.>",
1589 query_name () 1589 query_name ()
1590 ); 1590 );
1591 1591
1592 return false; 1592 return false;
1593} 1593}
1678/* 1678/*
1679 * env->insert (op) 1679 * env->insert (op)
1680 * This function inserts the object op in the linked list 1680 * This function inserts the object op in the linked list
1681 * inside the object environment. 1681 * inside the object environment.
1682 * 1682 *
1683 * The function returns now pointer to inserted item, and return value can 1683 * The function returns now pointer to inserted item, and return value can
1684 * be != op, if items are merged. -Tero 1684 * be != op, if items are merged. -Tero
1685 */ 1685 */
1686object * 1686object *
1687object::insert (object *op) 1687object::insert (object *op)
1688{ 1688{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines