Crossfire Server, Branch 1.12  R12190
Functions
time.c File Reference

Routines that is executed from objects based on their speed have been collected in this file. More...

#include <global.h>
#include <spells.h>
#include <sproto.h>
Include dependency graph for time.c:

Go to the source code of this file.

Functions

static void animate_trigger (object *op)
 Animate a TRIGGER.
static void change_object (object *op)
 Replaces op with its other_arch if it has reached its end of life.
object * fix_stopped_arrow (object *op)
 An ARROW stops moving.
void fix_stopped_item (object *op, mapstruct *map, object *originator)
 Put stopped item where stop_item() had found it.
int free_no_drop (object *op)
 Check whether the given object is FLAG_NO_DROP.
static void generate_monster (object *gen)
 Main generator function.
static void generate_monster_arch (object *gen)
 Generate a monster from the other_arch field.
static void generate_monster_inv (object *gen)
 Will generate a monster according to parameters of generator.
void legacy_animate_trigger (object *op)
void legacy_move_hole (object *op)
void legacy_remove_force (object *op)
void move_firewall (object *op)
 Move for FIREWALL.
static void move_hole (object *op)
 Move a HOLE.
void move_player_mover (object *op)
 This function takes a PLAYERMOVER as an argument, and performs the function of a player mover, which is:
int process_object (object *op)
 Main object move function.
void remove_door (object *op)
 Remove non locked doors.
static void remove_force (object *op)
 Move for FORCE objects.
void remove_locked_door (object *op)
 Same as remove_door() but for locked doors.
object * stop_item (object *op)
 An item (ARROW or such) stops moving.

Detailed Description

Routines that is executed from objects based on their speed have been collected in this file.

Definition in file time.c.


Function Documentation

static void animate_trigger ( object *  op) [static]

Animate a TRIGGER.

Parameters:
optrigger.

Definition at line 351 of file time.c.

References check_trigger(), NUM_ANIMATIONS, SET_ANIMATION, and update_object().

Referenced by legacy_animate_trigger().

Here is the call graph for this function:

Here is the caller graph for this function:

static void change_object ( object *  op) [static]

Replaces op with its other_arch if it has reached its end of life.

This routine doesnt seem to work for "inanimate" objects that are being carried, ie a held torch leaps from your hands!. Modified this routine to allow held objects. b.t.

Parameters:
opobject to change. Will be removed and replaced.

Definition at line 559 of file time.c.

References arch_to_object(), find_first_free_spot(), FLAG_ALIVE, free_object(), freearr_x, freearr_y, insert_ob_in_map(), insert_ob_in_ob(), LAMP, llevError, LOG(), NROFNEWOBJS, QUERY_FLAG, and remove_ob().

Referenced by process_object().

Here is the call graph for this function:

Here is the caller graph for this function:

object* fix_stopped_arrow ( object *  op)

An ARROW stops moving.

Parameters:
oparrow stopping.
Returns:
arrow, or NULL if it was broken.

Definition at line 483 of file time.c.

References add_string(), FREE_AND_CLEAR_STR, free_no_drop(), free_object(), remove_ob(), rndm(), update_ob_speed(), and update_object().

Referenced by hit_with_arrow(), stop_item(), and stop_projectile().

Here is the call graph for this function:

Here is the caller graph for this function:

void fix_stopped_item ( object *  op,
mapstruct map,
object *  originator 
)

Put stopped item where stop_item() had found it.

Inserts item into the old map, or merges it if it already is on the map.

Parameters:
opobject to stop.
mapmust be the value of op->map before stop_item() was called.
originatorwhat caused op to be stopped.

Definition at line 466 of file time.c.

References ARROW, FLAG_REMOVED, insert_ob_in_map(), merge_ob(), and QUERY_FLAG.

Referenced by save_throw_object().

Here is the call graph for this function:

Here is the caller graph for this function:

int free_no_drop ( object *  op)

Check whether the given object is FLAG_NO_DROP.

If so, (optionally) remove and free it.

Parameters:
opthe object to check
Returns:
whether the object was freed

Definition at line 536 of file time.c.

References FLAG_NO_DROP, FLAG_REMOVED, free_object2(), QUERY_FLAG, and remove_ob().

Referenced by fix_stopped_arrow(), hit_with_arrow(), and stop_item().

Here is the call graph for this function:

Here is the caller graph for this function:

static void generate_monster ( object *  gen) [static]

Main generator function.

Will generate a monster based on the parameters.

Parameters:
gengenerator.

Definition at line 222 of file time.c.

References FLAG_CONTENT_ON_GEN, generate_monster_arch(), generate_monster_inv(), GENERATE_SPEED, GET_MAP_OB, get_ob_key_value(), MAP_HEIGHT, MAP_WIDTH, QUERY_FLAG, rndm(), set_ob_key_value(), and strtol().

Referenced by process_object().

Here is the call graph for this function:

Here is the caller graph for this function:

static void generate_monster_arch ( object *  gen) [static]

Generate a monster from the other_arch field.

See generate_monster() for the main generator function.

Parameters:
gengenerator.

Definition at line 168 of file time.c.

References arch_to_object(), create_treasure(), find_multi_free_spot_within_radius(), FLAG_FREED, generate_artifact(), get_ob_key_value(), GT_APPLY, HAS_RANDOM_ITEMS, insert_ob_in_map(), llevError, LOG(), QUERY_FLAG, rndm(), and set_ob_key_value().

Referenced by generate_monster().

Here is the call graph for this function:

Here is the caller graph for this function:

static void generate_monster_inv ( object *  gen) [static]

Will generate a monster according to parameters of generator.

What is generated should be in the generator's inventory.

See generate_monster() for the main generator function.

Parameters:
gengenerator.

Definition at line 114 of file time.c.

References CLEAR_FLAG, create_treasure(), find_multi_free_spot_within_radius(), fix_multipart_object(), FLAG_FREED, FLAG_IS_A_TEMPLATE, generate_artifact(), get_ob_key_value(), GT_APPLY, HAS_RANDOM_ITEMS, insert_ob_in_map_at(), llevError, LOG(), object_create_clone(), QUERY_FLAG, rndm(), set_ob_key_value(), and unflag_inv().

Referenced by generate_monster().

Here is the call graph for this function:

Here is the caller graph for this function:

void legacy_animate_trigger ( object *  op)

Definition at line 772 of file time.c.

References animate_trigger().

Referenced by legacy_ob_process().

Here is the call graph for this function:

Here is the caller graph for this function:

void legacy_move_hole ( object *  op)

Definition at line 776 of file time.c.

References move_hole().

Referenced by legacy_ob_process().

Here is the call graph for this function:

Here is the caller graph for this function:

void legacy_remove_force ( object *  op)

Definition at line 768 of file time.c.

References remove_force().

Referenced by legacy_ob_process().

Here is the call graph for this function:

Here is the caller graph for this function:

void move_firewall ( object *  op)

Move for FIREWALL.

firewalls fire other spells. The direction of the wall is stored in op->stats.sp. walls can have hp, so they can be torn down.

Parameters:
opfirewall.

Definition at line 610 of file time.c.

References cast_spell(), llevError, LOG(), and rndm().

Here is the call graph for this function:

static void move_hole ( object *  op) [static]

Move a HOLE.

Parameters:
ophole to move.

Definition at line 367 of file time.c.

References animate_object(), MOVE_WALK, NUM_ANIMATIONS, ob_move_on(), update_ob_speed(), and update_object().

Referenced by legacy_move_hole().

Here is the call graph for this function:

Here is the caller graph for this function:

void move_player_mover ( object *  op)

This function takes a PLAYERMOVER as an argument, and performs the function of a player mover, which is:

a player mover finds any players that are sitting on it. It moves them in the op->stats.sp direction. speed is how often it'll move.

  • If attacktype is nonzero it will paralyze the player. If lifesave is set,
  • it'll dissapear after hp+1 moves. If hp is set and attacktype is set,
  • it'll paralyze the victim for hp*his speed/op->speed
Parameters:
opmover.

Definition at line 639 of file time.c.

References FABS, FLAG_ALIVE, FLAG_LIFESAVE, FLAG_WIZPASS, free_object(), freearr_x, freearr_y, get_map_flags(), GET_MAP_OB, llevError, LOG(), move_object(), move_player(), P_OUT_OF_MAP, mapdef::path, PLAYER, PLAYERMOVER, QUERY_FLAG, remove_ob(), rndm(), and should_director_abort().

Referenced by legacy_ob_process().

Here is the call graph for this function:

Here is the caller graph for this function:

int process_object ( object *  op)

Main object move function.

Parameters:
opobject to move.
Returns:
0 if object didn't move, 1 else?
Todo:
remove unused return value?

Definition at line 724 of file time.c.

References animate_object(), change_object(), EVENT_TIME, execute_event(), FLAG_ANIMATE, FLAG_APPLIED, FLAG_CHANGING, FLAG_FREED, FLAG_FRIENDLY, FLAG_GENERATOR, FLAG_IS_A_TEMPLATE, FLAG_IS_USED_UP, FLAG_MONSTER, FLAG_SEE_ANYWHERE, free_object(), generate_monster(), make_sure_not_seen(), make_sure_seen(), METHOD_OK, move_monster(), ob_process(), PLAYER, QUERY_FLAG, remove_force(), remove_ob(), and SCRIPT_FIX_NOTHING.

Referenced by attack_ob_simple(), and process_events().

Here is the call graph for this function:

Here is the caller graph for this function:

void remove_door ( object *  op)

Remove non locked doors.

The functions check to see if similar doors are next to the one that is being removed, and if so, set it so those will be removed shortly (in a cascade like fashion.)

See also:
remove_locked_door().
Parameters:
opdoor to remove.

Definition at line 51 of file time.c.

References arch_to_object(), DOOR, free_object(), freearr_x, freearr_y, insert_ob_in_map(), present(), remove_ob(), and update_ob_speed().

Referenced by attempt_pick_lock(), and legacy_ob_process().

Here is the call graph for this function:

Here is the caller graph for this function:

static void remove_force ( object *  op) [static]
void remove_locked_door ( object *  op)

Same as remove_door() but for locked doors.

Parameters:
opdoor to remove.

Definition at line 80 of file time.c.

References arch_to_object(), free_object(), freearr_x, freearr_y, insert_ob_in_map(), LOCKED_DOOR, present(), remove_ob(), and update_ob_speed().

Referenced by legacy_ob_process(), and player_attack_door().

Here is the call graph for this function:

Here is the caller graph for this function:

object* stop_item ( object *  op)

An item (ARROW or such) stops moving.

stop_item() returns a pointer to the stopped object. The stopped object may or may not have been removed from maps or inventories. It will not have been merged with other items.

This function assumes that only items on maps need special treatment.

If the object can't be stopped, or it was destroyed while trying to stop it, NULL is returned.

fix_stopped_item() should be used if the stopped item should be put on the map.

Parameters:
opobject to check.
Returns:
pointer to stopped object, NULL if destroyed or can't be stopped.

Definition at line 426 of file time.c.

References ARROW, fix_stopped_arrow(), free_no_drop(), free_object(), MIN_ACTIVE_SPEED, remove_ob(), and THROWN_OBJ.

Referenced by pick_up(), and save_throw_object().

Here is the call graph for this function:

Here is the caller graph for this function: