Crossfire Server, Branches 1.12  R18729
c_object.c File Reference
#include <global.h>
#include <loader.h>
#include <skills.h>
#include <sproto.h>
#include <living.h>
#include <math.h>
+ Include dependency graph for c_object.c:

Go to the source code of this file.

Macros

#define OBLINKMALLOC(p)
 

Functions

int command_apply (object *op, char *params)
 
int command_disarm (object *op, char *params)
 
int command_drop (object *op, char *params)
 
int command_dropall (object *op, char *params)
 
int command_empty (object *op, char *params)
 
int command_examine (object *op, char *params)
 
int command_lock_item (object *op, char *params)
 
int command_mark (object *op, char *params)
 
int command_pickup (object *op, char *params)
 
int command_rename_item (object *op, char *params)
 
int command_rskill (object *pl, char *params)
 
int command_search (object *op, char *params)
 
int command_search_items (object *op, char *params)
 
int command_take (object *op, char *params)
 
int command_throw (object *op, char *params)
 
int command_use (object *op, char *params)
 
int command_uskill (object *pl, char *params)
 
static void display_new_pickup (const object *op)
 
void drop (object *op, object *tmp)
 
objectdrop_object (object *op, object *tmp, uint32 nrof)
 
static void empty_container (object *container, object *pl)
 
void examine (object *op, object *tmp)
 
void examine_monster (object *op, object *tmp)
 
static objectfind_best_apply_object_match (object *start, object *pl, const char *params, int aflag)
 
static objectfind_best_object_match (object *pl, const char *params)
 
objectfind_marked_object (object *op)
 
void inventory (object *op, object *inv)
 
void pick_up (object *op, object *alt)
 
static void pick_up_object (object *pl, object *op, object *tmp, int nrof)
 
void put_object_in_sack (object *op, object *sack, object *tmp, uint32 nrof)
 
int sack_can_hold (const object *pl, const object *sack, const object *op, uint32 nrof)
 
static void set_pickup_mode (const object *op, int i)
 

Detailed Description

Object commands, including picking/dropping, locking, etc.

Todo:
clean multiple variations of same stuff (pickup and such), or rename for less confusion.

Definition in file c_object.c.

Macro Definition Documentation

#define OBLINKMALLOC (   p)
Value:
if (!((p) = (objectlink *)malloc(sizeof(objectlink)))) \
#define OUT_OF_MEMORY
Definition: define.h:94
Definition: object.h:298
void fatal(int err)
Definition: glue.c:60

Simple objectlink allocation, fail-safe.

Definition at line 50 of file c_object.c.

Function Documentation

int command_apply ( object op,
char *  params 
)

'apply' command.

Parameters
opplayer.
paramswhat to apply.
Returns
whether skill was used or not.

Definition at line 221 of file c_object.c.

References obj::above, AP_APPLY, AP_UNAPPLY, obj::container, draw_ext_info_format(), find_best_apply_object_match(), obj::inv, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, player_apply(), and player_apply_below().

+ Here is the call graph for this function:

int command_disarm ( object op,
char *  params 
)

'disarm' command.

Parameters
opplayer.
paramsunused.
Returns
whether skill was used or not.

Definition at line 181 of file c_object.c.

References SK_DISARM_TRAPS, skill_names, and use_skill().

+ Here is the call graph for this function:

int command_drop ( object op,
char *  params 
)

'drop' command.

Parameters
opplayer.
paramswhat to drop.
Returns
0.

Definition at line 1173 of file c_object.c.

References obj::below, obj::contr, pl::count, draw_ext_info(), draw_ext_info_format(), drop(), FLAG_INV_LOCKED, FLAG_NO_DROP, obj::inv, obj::invisible, item_matched_string(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, PLAYER, QUERY_FLAG, pl::socket, obj::type, and socket_struct::update_look.

+ Here is the call graph for this function:

int command_dropall ( object op,
char *  params 
)

Command to drop all items that have not been locked.

Parameters
opplayer.
paramsoptional specifier, like 'armour', 'weapon' and such.
Returns
0.

Definition at line 1021 of file c_object.c.

References AMULET, ARMOUR, ARMOUR_IMPROVER, ARROW, obj::below, BOOK, BOOTS, BOW, BRACERS, CLEAR_FLAG, CLOAK, obj::container, CONTAINER, obj::contr, pl::count, draw_ext_info(), DRINK, drop(), esrv_update_item(), fix_object(), FLAG_APPLIED, FLAG_INV_LOCKED, FLAG_NO_FIX_PLAYER, FLESH, FOOD, GEM, GIRDLE, GLOVES, HELMET, HORN, obj::inv, obj::invisible, KEY, MONEY, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, PLAYER, POTION, QUERY_FLAG, RING, ROD, SCROLL, SET_FLAG, SHIELD, pl::socket, SPECIAL_KEY, SPELLBOOK, obj::type, UPD_WEIGHT, socket_struct::update_look, WAND, WEAPON, and WEAPON_IMPROVER.

+ Here is the call graph for this function:

int command_empty ( object op,
char *  params 
)

'empty' command.

Parameters
opplayer.
paramsitem specifier.
Returns
0.

Definition at line 1263 of file c_object.c.

References obj::below, CONTAINER, draw_ext_info(), empty_container(), find_best_object_match(), obj::inv, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, and obj::type.

+ Here is the call graph for this function:

int command_examine ( object op,
char *  params 
)

'examine' command.

Parameters
opplayer.
paramsoptional item specifier.
Returns
0.

Definition at line 1306 of file c_object.c.

References obj::below, draw_ext_info_format(), examine(), find_best_object_match(), LOOK_OBJ, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, and NDI_UNIQUE.

+ Here is the call graph for this function:

int command_lock_item ( object op,
char *  params 
)

Alternate way to lock/unlock items (command line).

Parameters
opplayer
paramssent command line.

Definition at line 2234 of file c_object.c.

References CLEAR_FLAG, obj::count, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), find_best_object_match(), FLAG_INV_LOCKED, HUGE_BUF, merge_ob(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, NDI_UNIQUE, QUERY_FLAG, query_short_name(), SET_FLAG, and UPD_FLAGS.

+ Here is the call graph for this function:

int command_mark ( object op,
char *  params 
)

'mark' command, to mark an item for some effects (enchant armor, ...).

Parameters
opplayer.
paramsIf empty, we print out the currently marked object. Otherwise, try to find a matching object - try best match first.
Returns
1 or 0.

Definition at line 1376 of file c_object.c.

References obj::contr, obj::count, draw_ext_info(), draw_ext_info_format(), find_best_object_match(), find_marked_object(), pl::mark, pl::mark_count, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, and query_name().

+ Here is the call graph for this function:

int command_pickup ( object op,
char *  params 
)

'pickup' command.

Parameters
opplayer.
paramspickup mode. Can be empty to display the current mode.
Returns
1 if success, 0 else.
Todo:
trash old pickup mode, merge with new pickup.

Definition at line 1867 of file c_object.c.

References obj::contr, display_new_pickup(), draw_ext_info(), draw_ext_info_format(), llevDebug, LOG(), pl::mode, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, PU_ALLWEAPON, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_DEBUG, PU_DRINK, PU_FLESH, PU_FOOD, PU_GLOVES, PU_HELMET, PU_INHIBIT, PU_JEWELS, PU_KEY, PU_MAGIC_DEVICE, PU_MAGICAL, PU_MISSILEWEAPON, PU_NEWMODE, PU_NOT_CURSED, PU_POTION, PU_READABLES, PU_SHIELD, PU_SKILLSCROLL, PU_SPELLBOOK, PU_STOP, PU_VALUABLES, and set_pickup_mode().

+ Here is the call graph for this function:

int command_rename_item ( object op,
char *  params 
)

Changing the custom name of an item

Syntax is: rename <what object> to <new name>

  • if 'what object' is omitted, marked object is used
  • if 'to new name' is omitted, custom name is cleared

Names are considered for all purpose having a length <=127 (max length sent to client by server).

Parameters
opplayer.
paramshow to rename.
Returns
1

Definition at line 2047 of file c_object.c.

References obj::below, obj::count, obj::custom_name, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), find_best_object_match(), find_marked_object(), FREE_AND_CLEAR_STR, FREE_AND_COPY, obj::inv, obj::invisible, MAX_BUF, merge_ob(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, obj::nrof, query_base_name(), snprintf(), UPD_NAME, and VERY_BIG_BUF.

+ Here is the call graph for this function:

int command_rskill ( object pl,
char *  params 
)

'ready_skill' command.

Parameters
plplayer.
paramsskill name.
Returns
whether skill was readied or not.

Definition at line 132 of file c_object.c.

References change_skill(), draw_ext_info(), draw_ext_info_format(), find_skill_by_name(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_SKILL, MSG_TYPE_SKILL_MISSING, and NDI_UNIQUE.

+ Here is the call graph for this function:

int command_search ( object op,
char *  params 
)

'search' command.

Parameters
opplayer.
paramsunused.
Returns
whether skill was used or not.

Definition at line 167 of file c_object.c.

References SK_FIND_TRAPS, skill_names, and use_skill().

+ Here is the call graph for this function:

int command_search_items ( object op,
char *  params 
)

'search-items' command.

Parameters
opplayer.
paramsoptions.
Returns
1.

Definition at line 1998 of file c_object.c.

References obj::contr, draw_ext_info(), draw_ext_info_format(), FALSE, fix_object(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, Settings::search_items, pl::search_str, and settings.

+ Here is the call graph for this function:

int command_take ( object op,
char *  params 
)

This takes (picks up) and item.

Parameters
opplayer who issued the command.
paramsstring to match against the item name.
Returns
0.

Definition at line 602 of file c_object.c.

References obj::above, obj::below, can_pick(), obj::container, draw_ext_info(), draw_ext_info_format(), FLAG_IS_FLOOR, obj::inv, obj::invisible, item_matched_string(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, obj::name, NDI_UNIQUE, obj::next, pick_up(), and QUERY_FLAG.

+ Here is the call graph for this function:

int command_throw ( object op,
char *  params 
)

'throw' command.

A little special because we do want to pass the full params along as it includes the object to throw.

Parameters
opplayer.
paramswhat to throw.
Returns
whether skill was used or not.

Definition at line 198 of file c_object.c.

References do_skill(), draw_ext_info(), obj::facing, find_skill_by_name(), MSG_TYPE_SKILL, MSG_TYPE_SKILL_MISSING, NDI_UNIQUE, SK_THROWING, and skill_names.

+ Here is the call graph for this function:

int command_use ( object op,
char *  params 
)

Try to use an item on another. Items are checked for key/values matching.

Parameters
opplayer.
paramssent string, with all parameters.
Returns
1.

Definition at line 2282 of file c_object.c.

References obj::arch, decrease_ob, draw_ext_info(), draw_ext_info_format(), find_archetype(), find_best_object_match(), get_ob_key_value(), insert_ob_in_ob(), llevError, LOG(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, obj::name, archt::name, NDI_UNIQUE, obj::nrof, object_create_arch(), PLAYER, snprintf(), obj::subtype, and obj::type.

+ Here is the call graph for this function:

int command_uskill ( object pl,
char *  params 
)

'use_skill' command.

Parameters
plplayer.
paramsskill to use, and optional parameters.
Returns
whether skill was used or not.

Definition at line 113 of file c_object.c.

References draw_ext_info(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, and use_skill().

+ Here is the call graph for this function:

static void display_new_pickup ( const object op)
static

Utility function to display the pickup mode for a player.

Parameters
opmust be a player.

Definition at line 1723 of file c_object.c.

References obj::contr, draw_ext_info(), draw_ext_info_format(), pl::mode, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO, NDI_UNIQUE, PU_ALLWEAPON, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_DEBUG, PU_DRINK, PU_FLESH, PU_FOOD, PU_GLOVES, PU_HELMET, PU_INHIBIT, PU_JEWELS, PU_KEY, PU_MAGIC_DEVICE, PU_MAGICAL, PU_MISSILEWEAPON, PU_NEWMODE, PU_NOT_CURSED, PU_POTION, PU_RATIO, PU_READABLES, PU_SHIELD, PU_SKILLSCROLL, PU_SPELLBOOK, PU_STOP, and PU_VALUABLES.

Referenced by command_pickup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void drop ( object op,
object tmp 
)

Drop an item, either on the floor or in a container.

Parameters
opwho is dropping an item.
tmpwhat object to drop.

Definition at line 943 of file c_object.c.

References obj::above, obj::below, obj::container, obj::contr, obj::count, pl::count, draw_ext_info(), drop_object(), obj::env, FLAG_INV_LOCKED, FLAG_NO_DROP, free_object(), obj::invisible, pl::last_used, pl::last_used_id, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, PLAYER, put_object_in_sack(), QUERY_FLAG, remove_ob(), and obj::type.

Referenced by cfapi_object_drop(), command_drop(), command_dropall(), empty_container(), and handle_apply_yield().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

object* drop_object ( object op,
object tmp,
uint32  nrof 
)

Try to drop an object on the floor.

This function was part of drop, now is own function.

Parameters
opwho is dropping the item.
tmpitem to drop.
nrofif is non zero, then nrof objects is tried to be dropped.
Returns
object dropped, NULL if it was destroyed.
Todo:
shouldn't tmp be NULL if was_destroyed returns true?

Definition at line 847 of file c_object.c.

References AP_NO_MERGE, AP_UNAPPLY, apply_special(), obj::contr, obj::count, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), EVENT_DROP, execute_event(), fix_object(), FLAG_APPLIED, FLAG_NO_DROP, FLAG_NO_FIX_PLAYER, FLAG_STARTEQUIP, FLAG_UNPAID, free_object(), get_split_ob(), insert_ob_in_map(), is_in_shop(), obj::map, MAX_BUF, MONEY, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, obj::nrof, PLAYER, QUERY_FLAG, query_name(), remove_ob(), save_player(), SCRIPT_FIX_ALL, sell_item(), obj::type, UPD_WEIGHT, obj::value, was_destroyed, obj::x, and obj::y.

Referenced by drop(), esrv_move_object(), and transport_type_apply().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void empty_container ( object container,
object pl 
)
static

Put all contents of the container on the ground below the player or in opened container, except locked items.

Parameters
containerwhat to empty.
plplayer to drop for.

Definition at line 1223 of file c_object.c.

References obj::below, draw_ext_info_format(), drop(), esrv_update_item(), FLAG_INV_LOCKED, obj::inv, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, QUERY_FLAG, query_name(), and UPD_WEIGHT.

Referenced by command_empty().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void examine_monster ( object op,
object tmp 
)

Player examine a monster.

Parameters
opplayer.
tmpmonster being examined.

Definition at line 1424 of file c_object.c.

References AT_ACID, obj::attacktype, draw_ext_info(), FLAG_UNDEAD, obj::head, liv::hp, obj::level, liv::maxhp, mon, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, NDI_UNIQUE, POISONING, present_in_ob(), QUERY_FLAG, and obj::stats.

Referenced by examine(), and probe().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static object* find_best_apply_object_match ( object start,
object pl,
const char *  params,
int  aflag 
)
static

Search from start and through below for what matches best with params. we use item_matched_string above - this gives us consistent behaviour between many commands. Return the best match, or NULL if no match.

Parameters
startfirst object to start searching at.
plwhat object we're searching for.
paramswhat to search for.
aflagEither 0 or AP_APPLY or AP_UNAPPLY. Used with apply -u, and apply -a to only unapply applied, or apply unapplied objects.
Returns
matching object, or NULL if no suitable.

Definition at line 70 of file c_object.c.

References AP_APPLY, AP_UNAPPLY, obj::below, FLAG_APPLIED, obj::invisible, item_matched_string(), and QUERY_FLAG.

Referenced by command_apply(), and find_best_object_match().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static object* find_best_object_match ( object pl,
const char *  params 
)
static

Shortcut to find_best_apply_object_match(pl->inv, pl, params, AF_NULL);

Parameters
plwho to search an item for.
paramswhat to search for.
Returns
matching object, or NULL if no suitable.

Definition at line 99 of file c_object.c.

References AP_NULL, find_best_apply_object_match(), and obj::inv.

Referenced by command_empty(), command_examine(), command_lock_item(), command_mark(), command_rename_item(), and command_use().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

object* find_marked_object ( object op)

Return the object the player has marked with the 'mark' command below. If no match is found (or object has changed), we return NULL. We leave it up to the calling function to print messages if nothing is found.

Parameters
opobject. Should be a player.
Returns
marked object if still valid, NULL else.

Definition at line 1339 of file c_object.c.

References obj::below, obj::contr, obj::count, obj::inv, obj::invisible, pl::mark, and pl::mark_count.

Referenced by animate_weapon(), apply_map_builder(), armour_improver_type_apply(), cast_item_curse_or_curse(), cfapi_object_get_property(), command_mark(), command_rename_item(), find_throw_ob(), identify_altar_type_move_on(), lighter_type_apply(), recharge(), weapon_improver_type_apply(), and write_on_item().

+ Here is the caller graph for this function:

void inventory ( object op,
object inv 
)

Prints object's inventory.

Parameters
opwho to print for.
invif NULL then print op's inventory, else print the inventory of inv.

Definition at line 1653 of file c_object.c.

References obj::below, CONTAINER, obj::count, draw_ext_info(), draw_ext_info_format(), FLAG_APPLIED, FLAG_WIZ, obj::inv, obj::invisible, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_INVENTORY, NDI_UNIQUE, QUERY_FLAG, query_name(), query_weight(), and obj::type.

Referenced by command_inventory(), and look_at().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void pick_up ( object op,
object alt 
)

Try to pick up an item.

Parameters
opobject trying to pick up.
altoptional object op is trying to pick. If NULL, try to pick first item under op.

Definition at line 462 of file c_object.c.

References obj::below, can_pick(), obj::container, CONTAINER, obj::contr, obj::count, pl::count, draw_ext_info(), draw_ext_info_format(), obj::env, FLAG_APPLIED, FLAG_STARTEQUIP, INS_NO_MERGE, insert_ob_in_map(), obj::inv, llevDebug, LOG(), obj::map, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, obj::nrof, pick_up_object(), PLAYER, QUERY_FLAG, obj::race, sack_can_hold(), stop_item(), and obj::type.

Referenced by attempt_steal(), cast_create_missile(), cfapi_object_pickup(), check_pick(), command_take(), and esrv_move_object().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void pick_up_object ( object pl,
object op,
object tmp,
int  nrof 
)
static

Try to pick up some item.

Parameters
plobject (player or monster) picking up.
opobject to put tmp into.
tmpobject to pick up.
nrofnumber of tmp to pick up (0 means all of them).

Definition at line 340 of file c_object.c.

References obj::carrying, draw_ext_info(), obj::env, esrv_update_item(), EVENT_PICKUP, execute_event(), F_BUY, F_SHOP, FALSE, fix_object(), FLAG_NO_DROP, FLAG_REMOVED, FLAG_UNPAID, FLAG_WAS_WIZ, FLAG_WIZ, free_object(), get_player_container(), get_split_ob(), HUGE_BUF, insert_ob_in_ob(), obj::inv, MAX_BUF, MAX_STAT, MOVE_FLYING, obj::move_type, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, obj::nrof, PLAYER, query_cost_string(), QUERY_FLAG, query_name(), Settings::real_wiz, remove_ob(), SCRIPT_FIX_ALL, SET_FLAG, settings, snprintf(), obj::stats, liv::Str, stringbuffer_finish(), obj::type, UPD_WEIGHT, obj::weight, and weight_limit.

Referenced by pick_up().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void put_object_in_sack ( object op,
object sack,
object tmp,
uint32  nrof 
)

Something tries to put an object into another.

This function was part of drop(), now is own function.

Note
the 'sack' in question can now be a transport, so this function isn't named very good anymore.
Parameters
opwho is moving the item.
sackwhere to put the object.
tmpwhat to put into sack.
nrofif non zero, then nrof objects is tried to put into sack, else everything is put.

Definition at line 700 of file c_object.c.

References AP_NO_MERGE, AP_UNAPPLY, apply_special(), obj::below, CLEAR_FLAG, obj::container, CONTAINER, obj::contr, obj::count, draw_ext_info(), draw_ext_info_format(), obj::env, esrv_update_item(), fix_object(), FLAG_APPLIED, FLAG_NO_FIX_PLAYER, FLAG_STARTEQUIP, get_split_ob(), insert_ob_in_map_at(), insert_ob_in_ob(), obj::inv, obj::map, MAX_BUF, obj::move_off, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, obj::nrof, PLAYER, QUERY_FLAG, query_name(), remove_ob(), sack_can_hold(), set_object_face_main(), obj::slaying, pl::socket, TRANSPORT, transport_can_hold(), obj::type, UPD_WEIGHT, socket_struct::update_look, obj::x, and obj::y.

Referenced by drop(), esrv_move_object(), and START_TEST().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int sack_can_hold ( const object pl,
const object sack,
const object op,
uint32  nrof 
)

Check if an item op can be put into a sack. If pl exists then tell a player the reason of failure.

Parameters
plplayer.
sackcontainer to try to put into.
opwhat to put in the sack.
nrofnumber of objects (op) we want to put in. We specify it separately instead of using op->nrof because often times, a player may have specified a certain number of objects to drop, so we can pass that number, and not need to use split_ob() and stuff.
Returns
1 if it will fit, 0 if it will not.

Definition at line 282 of file c_object.c.

References obj::carrying, CONTAINER, draw_ext_info_format(), FLAG_APPLIED, liv::food, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, QUERY_FLAG, query_name(), obj::race, obj::slaying, SPECIAL_KEY, obj::stats, liv::Str, obj::type, obj::weight, and obj::weight_limit.

Referenced by esrv_move_object(), pick_up(), and put_object_in_sack().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void set_pickup_mode ( const object op,
int  i 
)
static

Sets the 'old' pickup mode.

Parameters
opplayer.
inew pickup mode.

Definition at line 1944 of file c_object.c.

References obj::contr, draw_ext_info(), pl::mode, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, and NDI_UNIQUE.

Referenced by command_pickup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: