Atrinik Server 2.5
Functions
types/container.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

static int container_trap (object *op, object *container)
int esrv_apply_container (object *op, object *sack)
int container_link (player *pl, object *sack)
int container_unlink (player *pl, object *sack)
void free_container_monster (object *monster, object *op)
int check_magical_container (object *op, object *container)

Detailed Description

Handles code for handling containers.

Definition in file container.c.


Function Documentation

int check_magical_container ( object op,
object container 
)

We don't to allow putting magical container inside another magical container, so we check for it here.

Parameters:
opObject being put into the container.
containerThe container.
Returns:
1 if both op and container are magical containers, 0 otherwise.

Definition at line 498 of file container.c.

int container_link ( player pl,
object sack 
)

A player has opened a container - link him to the list of players which have (perhaps) it opened too.

Parameters:
plThe player object.
sackThe container.
Returns:
1 if we are the first opening this container, 0 otherwise.

Definition at line 198 of file container.c.

static int container_trap ( object op,
object container 
) [static]

Examine the items in a container which gets readied or opened by a player.

Explode or trigger every trap and rune in there and free trapped monsters.

Parameters:
opThe player opening the container.
containerThe container object.
Returns:
0 if no trap or monster found/exploded/freed, count of all found/exploded/freed traps and monsters otherwise.

Definition at line 468 of file container.c.

int container_unlink ( player pl,
object sack 
)

Remove a player from the container list.

Unlinking is a bit more tricky - pl OR sack can be NULL.

Parameters:
plThe player object. If NULL, we unlink all players from the container identified by 'sack'.
sackThe container object. If NULL, unlink this container from player object identified by 'pl'.

Definition at line 287 of file container.c.

int esrv_apply_container ( object op,
object sack 
)

Handle apply on containers.

Note:
There are three states for any container - closed (not applied), applied (not open, but objects that match get tossed into it) and open (appled flag set, and op->container points to the open container).
Parameters:
opThe player.
sackThe container the player is opening or closing.
Returns:
1 if an object is applied somehow or another, 0 if error/no apply.

Definition at line 43 of file container.c.

void free_container_monster ( object monster,
object op 
)

Frees a monster trapped in container when opened by a player.

Parameters:
monsterThe monster trapped.
opThe player that opened the container.

Definition at line 428 of file container.c.