Angband
Data Structures | Functions | Variables
game-event.c File Reference

Allows the registering of handlers to be told about game events. More...

#include <assert.h>
#include "game-event.h"
#include "object.h"
#include "z-virt.h"

Data Structures

struct  event_handler_entry
 

Functions

static void game_event_dispatch (game_event_type type, game_event_data *data)
 
void event_add_handler (game_event_type type, game_event_handler *fn, void *user)
 
void event_remove_handler (game_event_type type, game_event_handler *fn, void *user)
 
void event_remove_handler_type (game_event_type type)
 
void event_remove_all_handlers (void)
 
void event_add_handler_set (game_event_type *type, size_t n_types, game_event_handler *fn, void *user)
 
void event_remove_handler_set (game_event_type *type, size_t n_types, game_event_handler *fn, void *user)
 
void event_signal (game_event_type type)
 
void event_signal_flag (game_event_type type, bool flag)
 
void event_signal_point (game_event_type type, int x, int y)
 
void event_signal_string (game_event_type type, const char *s)
 
void event_signal_message (game_event_type type, int t, const char *s)
 
void event_signal_birthpoints (int stats[6], int remaining)
 
void event_signal_blast (game_event_type type, int proj_type, int num_grids, int *distance_to_grid, bool drawing, bool *player_sees_grid, struct loc *blast_grid, struct loc centre)
 
void event_signal_bolt (game_event_type type, int proj_type, bool drawing, bool seen, bool beam, int oy, int ox, int y, int x)
 
void event_signal_missile (game_event_type type, struct object *obj, bool seen, int y, int x)
 

Variables

static struct event_handler_entryevent_handlers [N_GAME_EVENTS]
 

Detailed Description

Allows the registering of handlers to be told about game events.

Copyright (c) 2007 Antony Sidwell

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

void event_add_handler ( game_event_type  type,
game_event_handler fn,
void user 
)
void event_add_handler_set ( game_event_type type,
size_t  n_types,
game_event_handler fn,
void user 
)

References event_add_handler(), and i.

Referenced by subwindow_flag_changed(), and ui_enter_world().

void event_remove_all_handlers ( void  )
void event_remove_handler ( game_event_type  type,
game_event_handler fn,
void user 
)
void event_remove_handler_set ( game_event_type type,
size_t  n_types,
game_event_handler fn,
void user 
)

References event_remove_handler(), and i.

Referenced by subwindow_flag_changed(), and ui_leave_world().

void event_remove_handler_type ( game_event_type  type)

References mem_free(), event_handler_entry::next, NULL, and type.

Referenced by do_cmd_hold(), and move_player().

void event_signal ( game_event_type  type)

References game_event_dispatch(), and NULL.

Referenced by brand_object(), cheat_death(), check_devices(), check_for_player_interrupt(), close_game(), cmd_get_string(), colors_browse_hook(), combine_pack(), death_file(), death_screen(), display_object_recall_interactive(), display_winner(), disturb(), do_cmd_accept_character(), do_cmd_autopickup(), do_cmd_buy(), do_cmd_cast(), do_cmd_change_name(), do_cmd_disarm_aux(), do_cmd_disarm_chest(), do_cmd_hold(), do_cmd_lock_door(), do_cmd_open_aux(), do_cmd_open_chest(), do_cmd_prev_stats(), do_cmd_redraw(), do_cmd_retrieve(), do_cmd_roll_stats(), do_cmd_save_screen_html(), do_cmd_sell(), do_cmd_stash(), do_cmd_wiz_features(), do_cmd_wiz_query(), do_cmd_wizard(), dump_pref_file(), enchant_spell(), enter_score(), enter_store(), get_char(), get_character_name(), get_com_ex(), init_angband(), inven_drop(), keymap_browse_hook(), keymap_get_trigger(), leave_store(), lore_show_interactive(), move_player(), on_leave_level(), on_new_level(), player_pickup_item(), print_error(), process_player(), recalculate_stats(), redraw_stuff(), run_game_loop(), save_game(), screen_load(), screen_save(), see_floor_items(), show_file(), spell_cast(), spoiler_menu_act(), start_game(), store_menu_handle(), take_hit(), textui_cmd_debug(), textui_cmd_suicide(), textui_get_check(), textui_get_item(), textui_get_rep_dir(), textui_get_string(), textui_store_knowledge(), update_player_object_knowledge(), update_stuff(), use_store(), visuals_browse_hook(), visuals_reset(), wiz_cheat_death(), and wiz_statistics().

void event_signal_birthpoints ( int  stats[6],
int  remaining 
)
void event_signal_blast ( game_event_type  type,
int  proj_type,
int  num_grids,
int distance_to_grid,
bool  drawing,
bool *  player_sees_grid,
struct loc blast_grid,
struct loc  centre 
)
void event_signal_bolt ( game_event_type  type,
int  proj_type,
bool  drawing,
bool  seen,
bool  beam,
int  oy,
int  ox,
int  y,
int  x 
)
void event_signal_flag ( game_event_type  type,
bool  flag 
)
void event_signal_message ( game_event_type  type,
int  t,
const char *  s 
)
void event_signal_missile ( game_event_type  type,
struct object obj,
bool  seen,
int  y,
int  x 
)
void event_signal_point ( game_event_type  type,
int  x,
int  y 
)
void event_signal_string ( game_event_type  type,
const char *  s 
)
static void game_event_dispatch ( game_event_type  type,
game_event_data data 
)
static

Variable Documentation

struct event_handler_entry* event_handlers[N_GAME_EVENTS]
static