1 | /* |
1 | /* |
2 | * static char *rcsid_c_object_c = |
2 | * static char *rcsid_c_object_c = |
3 | * "$Id: c_object.C,v 1.12 2006/09/03 00:18:42 root Exp $"; |
3 | * "$Id: c_object.C,v 1.13 2006/09/07 10:01:57 pippijn Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
8 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
… | |
… | |
201 | if (op->type == SPECIAL_KEY && sack->slaying && op->slaying) { |
201 | if (op->type == SPECIAL_KEY && sack->slaying && op->slaying) { |
202 | new_draw_info_format(NDI_UNIQUE, 0, pl, |
202 | new_draw_info_format(NDI_UNIQUE, 0, pl, |
203 | "You can't put the key into %s.", query_name(sack)); |
203 | "You can't put the key into %s.", query_name(sack)); |
204 | return 0; |
204 | return 0; |
205 | } |
205 | } |
206 | if (sack->weight_limit && sack->carrying + (nrof ? nrof : 1) * |
206 | if (sack->weight_limit && (sint32) (sack->carrying + (nrof ? nrof : 1) * |
207 | (op->weight + (op->type==CONTAINER?(op->carrying*op->stats.Str):0)) |
207 | (op->weight + (op->type == CONTAINER ? (op->carrying * op->stats.Str) : 0)) |
208 | * (100 - sack->stats.Str) / 100 > sack->weight_limit) { |
208 | * (100 - sack->stats.Str) / 100) > sack->weight_limit) { |
209 | new_draw_info_format(NDI_UNIQUE, 0, pl, |
209 | new_draw_info_format(NDI_UNIQUE, 0, pl, |
210 | "That won't fit in the %s!", query_name(sack)); |
210 | "That won't fit in the %s!", query_name(sack)); |
211 | return 0; |
211 | return 0; |
212 | } |
212 | } |
213 | /* All other checks pass, must be OK */ |
213 | /* All other checks pass, must be OK */ |
… | |
… | |
1437 | |
1437 | |
1438 | int command_rename_item(object *op, char *params) |
1438 | int command_rename_item(object *op, char *params) |
1439 | { |
1439 | { |
1440 | char buf[VERY_BIG_BUF]; |
1440 | char buf[VERY_BIG_BUF]; |
1441 | int itemnumber; |
1441 | int itemnumber; |
1442 | object *item=NULL; |
1442 | object *item = NULL; |
1443 | char *closebrace; |
1443 | char *closebrace; |
1444 | size_t counter; |
1444 | size_t counter; |
1445 | |
1445 | |
1446 | if (params) { |
1446 | if (params) { |
1447 | /* Let's skip white spaces */ |
1447 | /* Let's skip white spaces */ |
1448 | while(' '==*params) params++; |
1448 | while(' '==*params) params++; |
1449 | |
1449 | |
1450 | /* Checking the first part */ |
1450 | /* Checking the first part */ |
1451 | if ((itemnumber = atoi(params))!=0) { |
1451 | if ((itemnumber = atoi(params))!=0) { |
1452 | for (item=op->inv; item && ((item->count != itemnumber) || item->invisible); item=item->below); |
1452 | for (item = op->inv; item && ((item->count != (tag_t) itemnumber) || item->invisible); item = item->below); |
1453 | if (!item) { |
1453 | if (!item) { |
1454 | new_draw_info(NDI_UNIQUE,0,op,"Tried to rename an invalid item."); |
1454 | new_draw_info(NDI_UNIQUE,0,op,"Tried to rename an invalid item."); |
1455 | return 1; |
1455 | return 1; |
1456 | } |
1456 | } |
1457 | while(isdigit(*params) || ' '==*params) params++; |
1457 | while(isdigit(*params) || ' '==*params) params++; |