![]() |
Crossfire Server, Trunk
1.75.0
|
#include <global.h>
#include <ob_methods.h>
#include <ob_types.h>
#include <sounds.h>
#include <sproto.h>
Go to the source code of this file.
Functions | |
int | apply_container (object *op, object *sack, int aflags) |
Handle apply on containers. More... | |
method_ret | close_container_apply (object *op, object *applier, int aflags) |
method_ret | container_apply (object *op, object *applier, int aflags) |
void | container_describe (const object *op, const object *observer, int use_media_tags, char *buf, size_t size) |
method_ret | container_examine (const object *op, const object *, int, char *buf, size_t size) |
static method_ret | container_type_move_on (object *trap, object *victim, object *originator) |
Move on this Container object. More... | |
void | init_type_container (void) |
Initializer for the CONTAINER object type. 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... | |
bool | sack_race_can_contain (const object *sack, const object *ob) |
int | set_object_face_main (object *op) |
Makes an object's face the main face, which is supposed to be the "closed" one. More... | |
static int | set_object_face_other (object *op) |
Makes an object's face the other_arch face, supposed to be the "opened" one. More... | |
The implementation of the Container class of objects.
Definition in file container.cpp.
Handle apply on containers.
This is for containers that are applied by a player, whether in inventory or on the ground: eg, sacks, luggage, etc.
Moved to own function and added many features [Tero.Haatanen(at)lut.fi] This version is for client/server mode.
Reminder - there are three states for any container - closed (non applied), applied (not open, but objects that match get tossed into it), and open (applied flag set, and op->container points to the open container)
op | player. |
sack | container the player is opening or closing. |
aflags | combination of Flags for apply_special(). flags. |
Definition at line 203 of file container.cpp.
References AP_APPLY, AP_NULL, AP_OPEN, AP_UNAPPLY, CLEAR_FLAG, CONTAINER, object::container, socket_struct::container_position, object::contr, object::count, draw_ext_info_format(), object::env, esrv_send_inventory(), esrv_send_item(), esrv_update_item(), EVENT_CLOSE, events_execute_object_event(), find_key(), FLAG_APPLIED, object::head, INS_NO_MERGE, llevError, LOG(), object::map, MAX_BUF, object::more, MOVE_ALL, object::move_off, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, MSG_TYPE_APPLY_SUCCESS, MSG_TYPE_APPLY_UNAPPLY, object::name, NDI_UNIQUE, object::nrof, object_insert_in_map_at(), object_insert_in_ob(), object_split(), object_was_destroyed, PLAYER, QUERY_FLAG, query_name(), SCRIPT_FIX_ALL, SET_FLAG, set_object_face_main(), set_object_face_other(), object::slaying, player::socket, object::type, UPD_FACE, UPD_FLAGS, object::x, and object::y.
Referenced by close_container_apply(), container_apply(), container_type_move_on(), and loot_object().
method_ret close_container_apply | ( | object * | op, |
object * | applier, | ||
int | aflags | ||
) |
Definition at line 460 of file container.cpp.
References apply_container(), object::env, METHOD_OK, PLAYER, and object::type.
Referenced by init_type_container().
method_ret container_apply | ( | object * | op, |
object * | applier, | ||
int | aflags | ||
) |
Definition at line 454 of file container.cpp.
References apply_container(), METHOD_OK, PLAYER, and object::type.
Referenced by init_type_container().
void container_describe | ( | const object * | op, |
const object * | observer, | ||
int | use_media_tags, | ||
char * | buf, | ||
size_t | size | ||
) |
Definition at line 466 of file container.cpp.
References buf, object::container, object::env, FLAG_APPLIED, legacy_ob_describe(), and QUERY_FLAG.
Referenced by init_type_container().
method_ret container_examine | ( | const object * | op, |
const object * | , | ||
int | , | ||
char * | buf, | ||
size_t | size | ||
) |
Definition at line 472 of file container.cpp.
References buf, METHOD_OK, object::race, object::stats, living::Str, and object::weight_limit.
Referenced by init_type_container().
|
static |
Move on this Container object.
trap | The Container we're moving on |
victim | The object moving over this one |
originator | The object that caused the move_on event |
Definition at line 501 of file container.cpp.
References AP_NULL, apply_container(), common_post_ob_move_on(), common_pre_ob_move_on(), METHOD_ERROR, METHOD_OK, PLAYER, and object::type.
Referenced by init_type_container().
void init_type_container | ( | void | ) |
Initializer for the CONTAINER object type.
Definition at line 487 of file container.cpp.
References CLOSE_CON, close_container_apply(), CONTAINER, container_apply(), container_describe(), container_examine(), container_type_move_on(), register_apply(), register_describe(), register_examine(), and register_move_on().
Referenced by register_all_ob_types().
Check if an item op can be put into a sack.
If pl exists then tell a player the reason of failure.
pl | player. |
sack | container to try to put into. |
op | what to put in the sack. |
nrof | number 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. |
Definition at line 66 of file container.cpp.
References object::carrying, CONTAINER, draw_ext_info_format(), FLAG_APPLIED, living::food, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, name, NDI_UNIQUE, QUERY_FLAG, query_name(), object::race, sack_race_can_contain(), object::slaying, SPECIAL_KEY, object::stats, living::Str, object::type, object::weight, and object::weight_limit.
Referenced by esrv_move_object(), pick_up(), put_object_in_sack(), and sell_item().
Definition at line 36 of file container.cpp.
References csv_contains(), and object::race.
Referenced by sack_can_hold().
int set_object_face_main | ( | object * | op | ) |
Makes an object's face the main face, which is supposed to be the "closed" one.
Sets an object's face to the 'face' in the archetype. Meant for showing containers opening and closing.
op | Object to set face on |
Definition at line 127 of file container.cpp.
References object::arch, archetype::clone, object::face, FALSE, object::more, object_get_value(), sstring, TRUE, and try_find_face().
Referenced by apply_container(), and put_object_in_sack().
|
static |
Makes an object's face the other_arch face, supposed to be the "opened" one.
Sets an object's face to the other_arch 'face'. Meant for showing containers opening and closing.
op | Object to set face on |
Definition at line 154 of file container.cpp.
References object::arch, archetype::clone, object::face, FALSE, object::head, object::more, Face::name, object_get_value(), object_set_value(), object::other_arch, sstring, TRUE, and try_find_face().
Referenced by apply_container().