Crossfire Server, Trunk  R20513
Functions
c_object.c File Reference

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

#include "global.h"
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "living.h"
#include "loader.h"
#include "shop.h"
#include "skills.h"
#include "sproto.h"
Include dependency graph for c_object.c:

Go to the source code of this file.

Functions

void command_apply (object *op, const char *params)
 'apply' command. More...
 
void command_disarm (object *op, const char *params)
 'disarm' command. More...
 
void command_drop (object *op, const char *params)
 'drop' command. More...
 
void command_dropall (object *op, const char *params)
 Command to drop all items that have not been locked. More...
 
void command_empty (object *op, const char *params)
 'empty' command. More...
 
void command_examine (object *op, const char *params)
 'examine' command. More...
 
void command_lock_item (object *op, const char *params)
 Alternate way to lock/unlock items (command line). More...
 
void command_mark (object *op, const char *params)
 'mark' command, to mark an item for some effects (enchant armor, ...). More...
 
void command_pickup (object *op, const char *params)
 'pickup' command. More...
 
void command_rename_item (object *op, const char *params)
 Changing the custom name of an item. More...
 
void command_rskill (object *pl, const char *params)
 'ready_skill' command. More...
 
void command_search (object *op, const char *params)
 'search' command. More...
 
void command_search_items (object *op, const char *params)
 'search-items' command. More...
 
void command_take (object *op, const char *params)
 This takes (picks up) and item. More...
 
void command_throw (object *op, const char *params)
 'throw' command. More...
 
void command_use (object *op, const char *params)
 Try to use an item on another. More...
 
void command_uskill (object *pl, const char *params)
 'use_skill' command. More...
 
static void display_new_pickup (const object *op, int old)
 Utility function to display the pickup mode for a player. More...
 
void drop (object *op, object *tmp)
 Drop an item, either on the floor or in a container. More...
 
objectdrop_object (object *op, object *tmp, uint32_t nrof)
 Try to drop an object on the floor. More...
 
static void empty_container (object *container, object *pl)
 Put all contents of the container on the ground below the player or in opened container, except locked items. More...
 
void examine (object *op, object *tmp)
 Player examines some object. More...
 
void examine_monster (object *op, object *tmp, int level)
 Player examine a monster. More...
 
static objectfind_best_apply_object_match (object *start, object *pl, const char *params, int aflag)
 Search from start and through below for what matches best with params. More...
 
static objectfind_best_object_match (object *pl, const char *params)
 Shortcut to find_best_apply_object_match(pl->inv, pl, params, AF_NULL);. More...
 
objectfind_marked_object (object *op)
 Return the object the player has marked with the 'mark' command below. More...
 
void inventory (object *op, object *inv)
 Prints object's inventory. More...
 
void pick_up (object *op, object *alt)
 Try to pick up an item. More...
 
static void pick_up_object (object *pl, object *op, object *tmp, int nrof)
 Try to pick up some item. More...
 
void put_object_in_sack (object *op, object *sack, object *tmp, uint32_t nrof)
 Something tries to put an object into another. More...
 
int sack_can_hold (const object *pl, const object *sack, const object *op, uint32_t nrof)
 Check if an item op can be put into a sack. More...
 
static void set_pickup_mode (const object *op, int i)
 Sets the 'old' pickup mode. More...
 

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.

Function Documentation

void command_apply ( object op,
const char *  params 
)

'apply' command.

Parameters
opplayer.
paramswhat to apply.

Definition at line 195 of file c_object.c.

References obj::above, AP_APPLY, AP_NULL, AP_UNAPPLY, apply_by_living(), apply_by_living_below(), obj::container, draw_ext_info_format(), find_best_apply_object_match(), obj::inv, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, and NDI_UNIQUE.

Here is the call graph for this function:

void command_disarm ( object op,
const char *  params 
)

'disarm' command.

Parameters
opplayer.
paramsunused.

Definition at line 159 of file c_object.c.

References SK_DISARM_TRAPS, skill_names, and use_skill().

Here is the call graph for this function:

void command_drop ( object op,
const char *  params 
)

'drop' command.

Parameters
opplayer.
paramswhat to drop.

Definition at line 1096 of file c_object.c.

References obj::contr, pl::count, draw_ext_info(), draw_ext_info_format(), drop(), FLAG_INV_LOCKED, FLAG_NO_DROP, FOR_INV_FINISH, FOR_INV_PREPARE, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, object_matches_string(), PLAYER, QUERY_FLAG, and obj::type.

Here is the call graph for this function:

void command_dropall ( object op,
const char *  params 
)
void command_empty ( object op,
const char *  params 
)

'empty' command.

Parameters
opplayer.
paramsitem specifier.

Definition at line 1186 of file c_object.c.

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

Here is the call graph for this function:

void command_examine ( object op,
const char *  params 
)

'examine' command.

Parameters
opplayer.
paramsoptional item specifier.

Definition at line 1225 of file c_object.c.

References draw_ext_info_format(), examine(), find_best_object_match(), FOR_BELOW_FINISH, FOR_BELOW_PREPARE, LOOK_OBJ, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, and NDI_UNIQUE.

Here is the call graph for this function:

void command_lock_item ( object op,
const char *  params 
)

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

Parameters
opplayer
paramssent command line.

Definition at line 2249 of file c_object.c.

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

Here is the call graph for this function:

void command_mark ( object op,
const 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.

Definition at line 1289 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:

void command_pickup ( object op,
const char *  params 
)

'pickup' command.

Parameters
opplayer.
paramspickup mode. Can be empty to display the current mode.
Todo:
trash old pickup mode, merge with new pickup.

Definition at line 1884 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_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_CONTAINER, PU_DEBUG, PU_DRINK, PU_FLESH, PU_FOOD, PU_GLOVES, PU_HELMET, PU_INHIBIT, PU_JEWELS, PU_KEY, PU_MAGIC_DEVICE, PU_MAGICAL, PU_MELEEWEAPON, 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:

void command_rename_item ( object op,
const 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.

Definition at line 2063 of file c_object.c.

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

Here is the call graph for this function:

void command_rskill ( object pl,
const char *  params 
)

'ready_skill' command.

Parameters
plplayer.
paramsskill name.

Definition at line 115 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:

void command_search ( object op,
const char *  params 
)

'search' command.

Parameters
opplayer.
paramsunused.

Definition at line 147 of file c_object.c.

References SK_FIND_TRAPS, skill_names, and use_skill().

Here is the call graph for this function:

void command_search_items ( object op,
const char *  params 
)

'search-items' command.

Parameters
opplayer.
paramsoptions.

Definition at line 2018 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:

void command_take ( object op,
const char *  params 
)

This takes (picks up) and item.

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

Definition at line 585 of file c_object.c.

References obj::above, obj::below, obj::container, draw_ext_info(), draw_ext_info_format(), FLAG_IS_FLOOR, FOR_BELOW_FINISH, FOR_BELOW_PREPARE, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, obj::inv, obj::invisible, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, obj::name, NDI_UNIQUE, object_can_pick(), object_matches_string(), pick_up(), and QUERY_FLAG.

Referenced by knowledge_alchemy_attempt().

Here is the call graph for this function:

Here is the caller graph for this function:

void command_throw ( object op,
const 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.

Definition at line 174 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:

void command_use ( object op,
const char *  params 
)

Try to use an item on another.

Items are checked for key/values matching.

Parameters
opplayer.
paramssent string, with all parameters.
Todo:
handle multiple ingredients
Todo:
handle ingredient count, handle batches, and such

Definition at line 2292 of file c_object.c.

References obj::arch, recipestruct::arch_name, create_archetype(), draw_ext_info(), draw_ext_info_format(), find_best_object_match(), find_recipe_for_tool(), recipestruct::ingred, recipestruct::ingred_count, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, linked_char::name, obj::name, archt::name, NDI_UNIQUE, obj::nrof, object_decrease_nrof_by_one, object_insert_in_ob(), PLAYER, snprintf, obj::type, and recipestruct::yield.

Here is the call graph for this function:

void command_uskill ( object pl,
const char *  params 
)

'use_skill' command.

Parameters
plplayer.
paramsskill to use, and optional parameters.

Definition at line 98 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,
int  old 
)
static

Utility function to display the pickup mode for a player.

Parameters
opmust be a player.
oldprevious pickup mode.

Definition at line 1759 of file c_object.c.

References obj::contr, draw_ext_info(), draw_ext_info_format(), esrv_send_pickup(), pl::mode, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO, NDI_UNIQUE, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_CONTAINER, PU_DEBUG, PU_DRINK, PU_FLESH, PU_FOOD, PU_GLOVES, PU_HELMET, PU_INHIBIT, PU_JEWELS, PU_KEY, PU_MAGIC_DEVICE, PU_MAGICAL, PU_MELEEWEAPON, 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 910 of file c_object.c.

References obj::container, obj::contr, pl::count, draw_ext_info(), drop_object(), obj::env, FLAG_INV_LOCKED, FLAG_NO_DROP, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, obj::invisible, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, object_free_drop_inventory(), object_remove(), PLAYER, put_object_in_sack(), QUERY_FLAG, and obj::type.

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

Here is the call graph for this function:

Here is the caller graph for this function:

object* drop_object ( object op,
object tmp,
uint32_t  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 object_was_destroyed returns true?

Definition at line 814 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_REMOVED, FLAG_STARTEQUIP, FLAG_UNPAID, INS_BELOW_ORIGINATOR, obj::map, MAX_BUF, MONEY, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, obj::nrof, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_split(), object_was_destroyed, PLAYER, QUERY_FLAG, query_name(), save_player(), SCRIPT_FIX_ALL, sell_item(), shop_contains(), obj::type, UPD_WEIGHT, obj::value, 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 1148 of file c_object.c.

References obj::below, draw_ext_info_format(), drop(), esrv_update_item(), FLAG_INV_LOCKED, FOR_INV_FINISH, FOR_INV_PREPARE, 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 ( object op,
object tmp 
)

Player examines some object.

The item may be identified automatically if the player has the correct skill for that.

Parameters
opplayer.
tmpobject to examine.

Definition at line 1424 of file c_object.c.

References obj::body_info, body_locations, BOOK, change_exp(), CLEAR_FLAG, CLOSE_CON, CONTAINER, CORPSE, cost_approx_str(), cost_str(), obj::count, obj::custom_name, detect_curse_on_item(), detect_magic_on_item(), draw_ext_info(), draw_ext_info_format(), examine_monster(), EXIT, find_skill_by_number(), FLAG_IDENTIFIED, FLAG_IS_BUILDABLE, FLAG_IS_CAULDRON, FLAG_IS_LINKED, FLAG_MONSTER, FLAG_NO_PICK, FLAG_NO_SKILL_IDENT, FLAG_STARTEQUIP, FLAG_UNPAID, liv::food, FOR_INV_FINISH, FOR_INV_PREPARE, FORCE, get_button_value(), get_levelnumber(), get_typedata(), identify_object_with_skill(), typedata::identifyskill, typedata::identifyskill2, obj::inv, knowledge_item_can_be_used_alchemy(), obj::level, llevError, LOG(), obj::map, obj::materialname, MAX_BUF, obj::move_on, obj::msg, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, obj::name, NDI_UNIQUE, need_identify(), obj::nrof, NUM_BODY_LOCATIONS, ob_describe(), object_can_pick(), mapdef::path, QUERY_FLAG, obj::race, shop_contains(), shop_price_buy(), shop_price_sell(), SK_DET_CURSE, SK_DET_MAGIC, SK_SUBTRACT_SKILL_EXP, obj::skill, snprintf, SPELLBOOK, obj::stats, liv::Str, strncasecmp(), obj::type, obj::value, VERY_BIG_BUF, WAND, obj::weight, and obj::weight_limit.

Referenced by command_examine(), examine_cmd(), and knowledge_alchemy_attempt().

Here is the call graph for this function:

Here is the caller graph for this function:

void examine_monster ( object op,
object tmp,
int  level 
)

Player examine a monster.

Parameters
opplayer.
tmpmonster being examined.
levellevel of the probe, to have a persistant marker for some duration.

Definition at line 1336 of file c_object.c.

References add_string(), obj::arch, AT_ACID, obj::attacktype, create_archetype(), draw_ext_info(), fix_object(), FLAG_APPLIED, FLAG_PROBE, FLAG_UNDEAD, FORCE, FORCE_NAME, free_string(), HEAD, liv::hp, knowledge_show_monster_detail(), obj::level, liv::maxhp, mon, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, archt::name, NDI_UNIQUE, object_find_by_type_and_name(), object_insert_in_ob(), object_present_in_ob(), POISONING, probe(), QUERY_FLAG, SET_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 object_matches_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 55 of file c_object.c.

References AP_APPLY, AP_UNAPPLY, FLAG_APPLIED, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, obj::invisible, object_matches_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 86 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 1256 of file c_object.c.

References obj::contr, FOR_INV_FINISH, FOR_INV_PREPARE, 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 1694 of file c_object.c.

References CONTAINER, draw_ext_info(), draw_ext_info_format(), FLAG_APPLIED, FLAG_WIZ, FOR_INV_FINISH, FOR_INV_PREPARE, 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 446 of file c_object.c.

References obj::below, CONTAINER, obj::container, obj::contr, pl::count, draw_ext_info(), draw_ext_info_format(), obj::env, FLAG_APPLIED, FLAG_STARTEQUIP, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, INS_NO_MERGE, obj::inv, llevDebug, LOG(), obj::map, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, obj::name, NDI_UNIQUE, obj::nrof, object_can_pick(), object_insert_in_map(), 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
void put_object_in_sack ( object op,
object sack,
object tmp,
uint32_t  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 678 of file c_object.c.

References AP_NO_MERGE, AP_UNAPPLY, apply_special(), CLEAR_FLAG, CONTAINER, obj::container, obj::contr, draw_ext_info(), draw_ext_info_format(), obj::env, esrv_update_item(), fix_object(), FLAG_APPLIED, FLAG_NO_FIX_PLAYER, FLAG_STARTEQUIP, FOR_INV_FINISH, FOR_INV_PREPARE, 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, object_insert_in_map_at(), object_insert_in_ob(), object_remove(), object_split(), PLAYER, QUERY_FLAG, query_name(), 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(), knowledge_alchemy_attempt(), 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_t  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 257 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 1965 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: