z-type.c File Reference

Support various data types. More...

#include "z-rand.h"
#include "z-type.h"
#include "z-virt.h"


struct loc loc (int x, int y)
bool loc_eq (struct loc grid1, struct loc grid2)
 Determine if two grid locations are equal. More...
bool loc_is_zero (struct loc grid)
 Determine if a grid location is the (0, 0) location. More...
struct loc loc_sum (struct loc grid1, struct loc grid2)
 Sum two grid locations. More...
struct loc loc_diff (struct loc grid1, struct loc grid2)
 Take the difference of two grid locations. More...
struct loc rand_loc (struct loc grid, int x_spread, int y_spread)
 Get a random location with the given x and y centres and spread. More...
struct loc loc_offset (struct loc grid, int dx, int dy)
struct point_setpoint_set_new (int initial_size)
 Utility functions to work with point_sets. More...
void point_set_dispose (struct point_set *ps)
void add_to_point_set (struct point_set *ps, struct loc grid)
 Add the point to the given point set, making more space if there is no more space left. More...
int point_set_size (struct point_set *ps)
int point_set_contains (struct point_set *ps, struct loc grid)

Detailed Description

Support various data types.

Copyright (c) 2007 Angband Developers

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Function Documentation

◆ add_to_point_set()

void add_to_point_set ( struct point_set ps,
struct loc  grid 

Add the point to the given point set, making more space if there is no more space left.

References point_set::allocated, mem_realloc(), point_set::n, and point_set::pts.

Referenced by cave_room_aux(), set_up_path_distances(), and target_get_monsters().

◆ loc()

struct loc loc ( int  x,
int  y 

References p, loc::x, and loc::y.

Referenced by arena_gen(), become_aware(), become_viewable(), build_circular(), build_colors(), build_crossed(), build_large(), build_pit(), build_room_of_chambers(), build_room_template(), build_ruin(), build_simple(), build_store(), build_streamer(), build_vault(), calc_lighting(), cave_find(), cave_free(), cave_generate(), cave_illuminate(), cave_known(), chunk_validate_objects(), chunk_write(), clear_small_regions(), context_menu_cave(), display_map(), display_page(), display_player_sust_info(), display_resistance_panel(), do_cmd_wiz_bamf(), do_cmd_wiz_features(), do_cmd_wiz_hack_nick(), do_cmd_wiz_query(), draw_rectangle(), drop_find_grid(), effect_handler_ARC(), effect_handler_BALL(), effect_handler_BREATH(), effect_handler_DESTRUCTION(), effect_handler_DETECT_DOORS(), effect_handler_DETECT_GOLD(), effect_handler_DETECT_OBJECTS(), effect_handler_DETECT_STAIRS(), effect_handler_DETECT_TRAPS(), effect_handler_EARTHQUAKE(), effect_handler_LASH(), effect_handler_MAP_AREA(), effect_handler_MELEE_BLOWS(), effect_handler_SENSE_OBJECTS(), effect_handler_SHORT_BEAM(), effect_handler_TELEPORT(), effect_handler_TELEPORT_TO(), fill_rectangle(), fill_xrange(), fill_yrange(), find_artifact(), find_nearby_grid(), find_start(), floor_carry(), floor_object_for_use(), forget_remembered_objects(), gauntlet_gen(), generate_hole(), generate_open(), generate_plus(), generate_starburst_room(), get_chamber_monsters(), get_move(), get_move_find_hiding(), get_move_find_safety(), get_move_flee(), get_vault_monsters(), hard_centre_gen(), init_cavern(), inven_carry(), loc_diff(), loc_is_zero(), loc_offset(), loc_sum(), los(), make_chamber(), make_inner_chamber_wall(), mark_wasseen(), menu_layout(), monster_carry(), monster_turn_grab_objects(), monster_turn_multiply(), next_grid(), object_delete(), object_flavor_aware(), origin_get_loc(), pick_and_place_distant_monster(), place_feeling(), prepare_next_level(), process_world(), project(), project_aimed(), project_path(), prt_map(), prt_map_aux(), push_object(), rand_loc(), ranged_helper(), rd_dungeon(), rd_dungeon_aux(), region_calculate(), room_build(), sanitize_player_loc(), show_combined_generic(), spread_monsters(), square_destroy_decoy(), square_know_pile(), store_display_recalc(), summon_possible(), target_accept(), target_get_monsters(), target_set_interactive(), target_set_interactive_aux(), target_set_location(), test_dir_to(), textui_get_rep_dir(), textui_process_click(), thrust_away(), town_gen_layout(), update_mon(), update_view(), update_view_one(), vault_chunk(), wiz_dark(), wiz_light(), wr_dungeon_aux(), wr_objects_aux(), and wr_traps_aux().

◆ loc_diff()

struct loc loc_diff ( struct loc  grid1,
struct loc  grid2 

Take the difference of two grid locations.

References loc().

Referenced by build_room_template(), build_tunnel(), cave_find_in_range(), effect_handler_MOVE_ATTACK(), get_move(), and thrust_away().

◆ loc_eq()

bool loc_eq ( struct loc  grid1,
struct loc  grid2 

◆ loc_is_zero()

bool loc_is_zero ( struct loc  grid)

◆ loc_offset()

struct loc loc_offset ( struct loc  grid,
int  dx,
int  dy 

References loc().

Referenced by effect_handler_TELEPORT_TO().

◆ loc_sum()

struct loc loc_sum ( struct loc  grid1,
struct loc  grid2 

Sum two grid locations.

References loc().

Referenced by build_color_point(), build_room_of_chambers(), build_room_template(), build_streamer(), build_tunnel(), calc_lighting(), cave_illuminate(), cave_known(), count_adj_walls(), count_chests(), count_feats(), do_cmd_alter_aux(), do_cmd_close(), do_cmd_disarm(), do_cmd_jump(), do_cmd_mon_command(), do_cmd_open(), do_cmd_run(), do_cmd_steal_aux(), do_cmd_tunnel(), do_cmd_walk(), drop_find_grid(), effect_handler_ARC(), effect_handler_BALL(), effect_handler_BIZARRE(), effect_handler_BREATH(), effect_handler_EARTHQUAKE(), effect_handler_JUMP_AND_BITE(), effect_handler_MELEE_BLOWS(), effect_handler_MOVE_ATTACK(), effect_handler_RUBBLE(), effect_handler_SHORT_BEAM(), effect_handler_STAR(), effect_handler_STAR_BALL(), effect_handler_SWARM(), effect_handler_SWEEP(), find_path(), generate_starburst_room(), get_move(), get_move_advance(), get_move_bodyguard(), get_move_find_hiding(), get_move_find_safety(), get_move_flee(), get_target(), hollow_out_room(), join_region(), light_room(), make_noise(), monster_turn(), move_player(), next_to_corr(), place_new_monster_group(), player_attack_random_monster(), project(), project_player_handler_FORCE(), ranged_helper(), renderer_COMPACT_FLAG_RENDERER_WITH_COMBINED_AUX(), renderer_COMPACT_RESIST_RENDERER_WITH_COMBINED_AUX(), renderer_NUMERIC_AS_SIGN_RENDERER_WITH_COMBINED_AUX(), renderer_NUMERIC_RENDERER_WITH_BOOL_AUX(), renderer_NUMERIC_RENDERER_WITH_COMBINED_AUX(), run_init(), run_step(), run_test(), see_wall(), set_up_path_distances(), square_islitwall(), square_smash_wall(), thrust_away(), update_scent(), wiz_dark(), and wiz_light().

◆ point_set_contains()

int point_set_contains ( struct point_set ps,
struct loc  grid 

References i, loc_eq(), point_set::n, and point_set::pts.

Referenced by cave_room_aux().

◆ point_set_dispose()

void point_set_dispose ( struct point_set ps)

◆ point_set_new()

struct point_set* point_set_new ( int  initial_size)

Utility functions to work with point_sets.

References point_set::allocated, mem_alloc(), mem_zalloc(), point_set::n, and point_set::pts.

Referenced by light_room(), set_up_path_distances(), and target_get_monsters().

◆ point_set_size()

int point_set_size ( struct point_set ps)

◆ rand_loc()

struct loc rand_loc ( struct loc  grid,
int  x_spread,
int  y_spread 

Get a random location with the given x and y centres and spread.

References loc(), and rand_spread.

Referenced by build_streamer(), drop_find_grid(), effect_handler_TELEPORT_TO(), and scatter().