Crossfire Server, Trunk
time.c File Reference
#include "global.h"
#include <stdlib.h>
#include "spells.h"
#include "sproto.h"
#include "object.h"
+ Include dependency graph for time.c:

Go to the source code of this file.

Functions

static void animate_trigger (object *op)
 
void change_object (object *op)
 
objectfix_stopped_arrow (object *op)
 
void fix_stopped_item (object *op, mapstruct *map, object *originator)
 
int free_no_drop (object *op)
 
static void generate_monster (object *gen)
 
static int generate_monster_arch (object *gen)
 
static int generate_monster_inv (object *gen)
 
void legacy_animate_trigger (object *op)
 
void legacy_move_hole (object *op)
 
void legacy_remove_force (object *op)
 
void move_firewall (object *op)
 
static void move_hole (object *op)
 
void move_player_mover (object *op)
 
int process_object (object *op)
 
void remove_door (object *op)
 
static void remove_force (object *op)
 
void remove_locked_door (object *op)
 
objectstop_item (object *op)
 

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

◆ animate_trigger()

static void animate_trigger ( object op)
static

Animate a TRIGGER.

Parameters
optrigger.

Definition at line 383 of file time.c.

References check_trigger(), NUM_ANIMATIONS, object_update(), give::op, SET_ANIMATION, and UP_OBJ_FACE.

Referenced by legacy_animate_trigger().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_object()

void change_object ( object op)

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.
Note
Now handles multipart objects! If it fails to insert a multipart object, it re-inserts the original object. So, FLAG_FREED and FLAG_REMOVED will not be set in op if it is put back.

Definition at line 592 of file time.c.

References add_friendly_object(), arch_to_object(), env, FLAG_ALIVE, FLAG_FRIENDLY, FLAG_UNAGGRESSIVE, INS_ABOVE_FLOOR_ONLY, INS_NO_MERGE, INS_NO_WALK_ON, LAMP, llevError, llevInfo, LOG(), object_find_multi_free_spot_around(), object_fix_multipart(), object_free_drop_inventory(), object_get_owner(), object_insert_in_map(), object_insert_in_ob(), object_insert_to_free_spot_or_free(), object_remove(), object_set_owner(), give::op, PETMOVE, QUERY_FLAG, remove_friendly_object(), SET_FLAG, SIZEOFFREE1, and Ice::tmp.

Referenced by do_monster_change(), hit_player(), and process_object().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fix_stopped_arrow()

object* fix_stopped_arrow ( object op)

An ARROW stops moving.

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

Definition at line 512 of file time.c.

References add_string(), animate_object(), FREE_AND_CLEAR_STR, free_no_drop(), object_clear_owner(), object_free_drop_inventory(), object_remove(), object_update(), object_update_speed(), give::op, rndm(), and UP_OBJ_FACE.

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:

◆ fix_stopped_item()

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 495 of file time.c.

References ARROW, FLAG_REMOVED, disinfect::map, object_insert_in_map(), object_merge(), give::op, and QUERY_FLAG.

Referenced by save_throw_object().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_no_drop()

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 565 of file time.c.

References FLAG_NO_DROP, FLAG_REMOVED, FREE_OBJ_FREE_INVENTORY, object_free(), object_remove(), give::op, and QUERY_FLAG.

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:

◆ generate_monster()

static void generate_monster ( object gen)
static

Main generator function. Will generate a monster based on the parameters.

Parameters
gengenerator.

Definition at line 224 of file time.c.

References buf, FLAG_CONTENT_ON_GEN, FOR_MAP_FINISH, FOR_MAP_PREPARE, generate_monster_arch(), generate_monster_inv(), GENERATE_SPEED, obj::map, MAP_HEIGHT, MAP_WIDTH, obj::name, object_free_drop_inventory(), object_get_value(), object_handle_death_animation(), object_remove(), object_set_value(), object_value_set(), QUERY_FLAG, rndm(), Ice::tmp, autojail::value, diamondslots::x, and diamondslots::y.

Referenced by process_object().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate_monster_arch()

static int generate_monster_arch ( object gen)
static

Generate a monster from the other_arch field.

See generate_monster() for the main generator function.

Parameters
gengenerator.
Returns
TRUE if monster was put on map, FALSE if not

Definition at line 164 of file time.c.

References archt::clone, create_treasure(), mapdef::difficulty, FALSE, FLAG_FREED, FLAG_MONSTER, generate_artifact(), HAS_RANDOM_ITEMS, llevError, LOG(), obj::map, monster_check_apply_all(), obj::name, object_create_clone(), object_find_multi_free_spot_within_radius(), object_get_value(), object_insert_in_map_at(), object_set_value(), give::op, obj::other_arch, QUERY_FLAG, rndm(), and TRUE.

Referenced by generate_monster().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate_monster_inv()

static int 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.
Returns
TRUE if put a monster on a map, FALSE if did not

Definition at line 97 of file time.c.

References CLEAR_FLAG, create_treasure(), mapdef::difficulty, FALSE, FLAG_FREED, FLAG_IS_A_TEMPLATE, FLAG_MONSTER, FOR_INV_FINISH, FOR_INV_PREPARE, generate_artifact(), HAS_RANDOM_ITEMS, llevError, LOG(), obj::map, monster_check_apply_all(), obj::name, object_create_clone(), object_find_multi_free_spot_within_radius(), object_fix_multipart(), object_get_value(), object_insert_in_map_at(), object_set_value(), object_unset_flag_inv(), give::op, QUERY_FLAG, obj::randomitems, rndm(), Ice::tmp, and TRUE.

Referenced by generate_monster().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ legacy_animate_trigger()

void legacy_animate_trigger ( object op)

Definition at line 869 of file time.c.

References animate_trigger(), and give::op.

Referenced by legacy_ob_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ legacy_move_hole()

void legacy_move_hole ( object op)

Definition at line 873 of file time.c.

References move_hole(), and give::op.

Referenced by legacy_ob_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ legacy_remove_force()

void legacy_remove_force ( object op)

Definition at line 865 of file time.c.

References give::op, and remove_force().

Referenced by legacy_ob_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_firewall()

void move_firewall ( object op)

Move for FIREWALL.

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

Parameters
opfirewall.

Definition at line 678 of file time.c.

References cast_spell(), get_random_dir(), llevError, LOG(), and give::op.

+ Here is the call graph for this function:

◆ move_hole()

static void move_hole ( object op)
static

Move a HOLE.

Parameters
ophole to move.

Definition at line 399 of file time.c.

References animate_object(), FOR_ABOVE_FINISH, FOR_ABOVE_PREPARE, MOVE_WALK, NUM_ANIMATIONS, ob_move_on(), object_update(), object_update_speed(), give::op, Ice::tmp, and UP_OBJ_FACE.

Referenced by legacy_move_hole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_player_mover()

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 707 of file time.c.

References FABS, FLAG_ALIVE, FLAG_LIFESAVE, FLAG_WIZPASS, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), get_random_dir(), HEAD, llevError, LOG(), m, move_object(), move_player(), object_free_drop_inventory(), object_remove(), object_update_speed(), give::op, P_OUT_OF_MAP, PLAYER, PLAYERMOVER, QUERY_FLAG, should_director_abort(), and reputation::victim.

Referenced by legacy_ob_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ process_object()

◆ remove_door()

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 38 of file time.c.

References arch_to_object(), DOOR, freearr_x, freearr_y, map_find_by_type(), object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_update_speed(), give::op, and Ice::tmp.

Referenced by attempt_pick_lock(), legacy_ob_process(), and player_attack_door().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove_force()

◆ remove_locked_door()

void remove_locked_door ( object op)

Same as remove_door() but for locked doors.

Parameters
opdoor to remove.

Definition at line 64 of file time.c.

References arch_to_object(), freearr_x, freearr_y, LOCKED_DOOR, map_find_by_type(), object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_update_speed(), give::op, and Ice::tmp.

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:

◆ stop_item()

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 455 of file time.c.

References ARROW, fix_stopped_arrow(), free_no_drop(), MIN_ACTIVE_SPEED, object_free_drop_inventory(), object_remove(), give::op, and THROWN_OBJ.

Referenced by pick_up(), put_in_icecube(), and save_throw_object().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: