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

Comparing deliantra/server/server/c_object.C (file contents):
Revision 1.128 by root, Fri Feb 3 02:04:11 2012 UTC vs.
Revision 1.133 by root, Sun Jan 29 02:47:05 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 (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 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
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.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the Affero GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 20 * <http://www.gnu.org/licenses/>.
21 * 21 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24 24
25/* 25/*
26 * Object (handling) commands 26 * Object (handling) commands
233 { 233 {
234 new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't put the key into %s.", query_name (sack)); 234 new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't put the key into %s.", query_name (sack));
235 return 0; 235 return 0;
236 } 236 }
237 237
238 if (sack->weight_limit && (sint32) (sack->carrying + (nrof ? nrof : 1) * 238 if (sack->weight_limit
239 && weight_t (sack->carrying
240 + sack->number_of ()
239 (op->weight + (op->type == CONTAINER ? (op->carrying * op->stats.Str) : 0)) 241 * (op->weight + (op->type == CONTAINER ? (op->carrying * op->stats.Str) : 0))
240 * (100 - sack->stats.Str) / 100) > sack->weight_limit) 242 * (100 - sack->stats.Str) / 100)
243 > sack->weight_limit)
241 { 244 {
242 new_draw_info_format (NDI_UNIQUE, 0, pl, "That won't fit in the %s!", query_name (sack)); 245 new_draw_info_format (NDI_UNIQUE, 0, pl, "That won't fit in the %s!", query_name (sack));
243 return 0; 246 return 0;
244 } 247 }
245 248
248} 251}
249 252
250/* Pick up commands follow */ 253/* Pick up commands follow */
251 254
252/* pl = player (not always - monsters can use this now) 255/* pl = player (not always - monsters can use this now)
253 * op is the object to put tmp into, 256 * op is the object to put tmp into,
254 * tmp is the object to pick up, nrof is the number to 257 * tmp is the object to pick up, nrof is the number to
255 * pick up (0 means all of them) 258 * pick up (0 means all of them)
256 */ 259 */
257static void 260static void
258pick_up_object (object *pl, object *op, object *tmp, int nrof) 261pick_up_object (object *pl, object *op, object *tmp, int nrof)
259{ 262{
260 uint32 weight, effective_weight_limit; 263 weight_t weight, effective_weight_limit;
261 int tmp_nrof = tmp->number_of (); 264 int tmp_nrof = tmp->number_of ();
262 265
263 /* IF the player is flying & trying to take the item out of a container 266 /* IF the player is flying & trying to take the item out of a container
264 * that is in his inventory, let him. tmp->env points to the container 267 * that is in his inventory, let him. tmp->env points to the container
265 * (sack, luggage, etc), tmp->env->env then points to the player (nested 268 * (sack, luggage, etc), tmp->env->env then points to the player (nested
266 * containers not allowed as of now) 269 * containers not allowed as of now)
267 */ 270 */
268 if ((pl->move_type & MOVE_FLYING) && !pl->flag [FLAG_WIZ] && tmp->in_player () != pl) 271 if ((pl->move_type & MOVE_FLYING) && !pl->flag [FLAG_WIZ] && tmp->in_player () != pl)
269 { 272 {
270 pl->failmsg ("You are levitating, you can't reach the ground! " 273 pl->failmsg ("You are levitating, you can't reach the ground! "
500 503
501 return 0; 504 return 0;
502} 505}
503 506
504/* 507/*
505 * This function was part of drop, now is own function. 508 * This function was part of drop, now is own function.
506 * Player 'op' tries to put object 'tmp' into sack 'sack', 509 * Player 'op' tries to put object 'tmp' into sack 'sack',
507 * if nrof is non zero, then nrof objects is tried to put into sack. 510 * if nrof is non zero, then nrof objects is tried to put into sack.
508 * 511 *
509 * Note that the 'sack' in question can now be a transport, 512 * Note that the 'sack' in question can now be a transport,
510 * so this function isn't named very good anymore. 513 * so this function isn't named very good anymore.
511 */ 514 */
512void 515void
605 if (obj->destroyed () || obj->is_inserted ()) 608 if (obj->destroyed () || obj->is_inserted ())
606 return; 609 return;
607 610
608 if (dropper->is_in_shop () && !obj->flag [FLAG_UNPAID] && obj->type != MONEY) 611 if (dropper->is_in_shop () && !obj->flag [FLAG_UNPAID] && obj->type != MONEY)
609 if (!sell_item (obj, dropper)) 612 if (!sell_item (obj, dropper))
610 return; 613 return;
611 614
612 if (!obj->can_drop_at (dropper->map, dropper->x, dropper->y, dropper)) 615 if (!obj->can_drop_at (dropper->map, dropper->x, dropper->y, dropper))
613 return; 616 return;
614 617
615 /* If nothing special happened with this object, the default action is to 618 /* If nothing special happened with this object, the default action is to
734 } 737 }
735 738
736 object *curinv = op->inv; 739 object *curinv = op->inv;
737 object *nextinv; 740 object *nextinv;
738 741
739 /* 742 /*
740 This is the default. Drops everything not locked or considered 743 This is the default. Drops everything not locked or considered
741 not something that should be dropped. 744 not something that should be dropped.
742 */ 745 */
743 /* 746 /*
744 Care must be taken that the next item pointer is not to money as 747 Care must be taken that the next item pointer is not to money as

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines