Angband
Data Structures | Macros | Typedefs | Enumerations | Functions
game-event.h File Reference

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

#include "z-type.h"

Go to the source code of this file.

Data Structures

union  game_event_data
 

Macros

#define N_GAME_EVENTS   EVENT_END + 1
 

Typedefs

typedef enum game_event_type game_event_type
 The various events we can send signals about. More...
 
typedef void game_event_handler (game_event_type type, game_event_data *data, void *user)
 A function called when a game event occurs - these are registered to be called by event_add_handler or event_add_handler_set, and deregistered when they should no longer be called through event_remove_handler or event_remove_handler_set. More...
 

Enumerations

enum  game_event_type {
  EVENT_MAP = 0, EVENT_STATS, EVENT_HP, EVENT_MANA,
  EVENT_AC, EVENT_EXPERIENCE, EVENT_PLAYERLEVEL, EVENT_PLAYERTITLE,
  EVENT_GOLD, EVENT_MONSTERHEALTH, EVENT_DUNGEONLEVEL, EVENT_PLAYERSPEED,
  EVENT_RACE_CLASS, EVENT_STUDYSTATUS, EVENT_STATUS, EVENT_DETECTIONSTATUS,
  EVENT_FEELING, EVENT_STATE, EVENT_PLAYERMOVED, EVENT_SEEFLOOR,
  EVENT_EXPLOSION, EVENT_BOLT, EVENT_MISSILE, EVENT_INVENTORY,
  EVENT_EQUIPMENT, EVENT_ITEMLIST, EVENT_MONSTERLIST, EVENT_MONSTERTARGET,
  EVENT_OBJECTTARGET, EVENT_MESSAGE, EVENT_SOUND, EVENT_BELL,
  EVENT_USE_STORE, EVENT_STORECHANGED, EVENT_INPUT_FLUSH, EVENT_MESSAGE_FLUSH,
  EVENT_CHECK_INTERRUPT, EVENT_REFRESH, EVENT_NEW_LEVEL_DISPLAY, EVENT_COMMAND_REPEAT,
  EVENT_ANIMATE, EVENT_CHEAT_DEATH, EVENT_INITSTATUS, EVENT_BIRTHPOINTS,
  EVENT_ENTER_INIT, EVENT_LEAVE_INIT, EVENT_ENTER_BIRTH, EVENT_LEAVE_BIRTH,
  EVENT_ENTER_GAME, EVENT_LEAVE_GAME, EVENT_ENTER_WORLD, EVENT_LEAVE_WORLD,
  EVENT_ENTER_STORE, EVENT_LEAVE_STORE, EVENT_ENTER_DEATH, EVENT_LEAVE_DEATH,
  EVENT_END
}
 The various events we can send signals about. More...
 

Functions

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_birthpoints (int stats[6], int remaining)
 
void event_signal_point (game_event_type, int x, int y)
 
void event_signal_string (game_event_type, const char *s)
 
void event_signal_message (game_event_type type, int t, const char *s)
 
void event_signal_flag (game_event_type type, bool flag)
 
void event_signal (game_event_type)
 
void event_signal_blast (game_event_type type, int proj_type, int num_grids, int *distance_to_grid, bool seen, 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)
 

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.

Macro Definition Documentation

#define N_GAME_EVENTS   EVENT_END + 1

Typedef Documentation

typedef void game_event_handler(game_event_type type, game_event_data *data, void *user)

A function called when a game event occurs - these are registered to be called by event_add_handler or event_add_handler_set, and deregistered when they should no longer be called through event_remove_handler or event_remove_handler_set.

The various events we can send signals about.

Enumeration Type Documentation

The various events we can send signals about.

Enumerator
EVENT_MAP 
EVENT_STATS 
EVENT_HP 
EVENT_MANA 
EVENT_AC 
EVENT_EXPERIENCE 
EVENT_PLAYERLEVEL 
EVENT_PLAYERTITLE 
EVENT_GOLD 
EVENT_MONSTERHEALTH 
EVENT_DUNGEONLEVEL 
EVENT_PLAYERSPEED 
EVENT_RACE_CLASS 
EVENT_STUDYSTATUS 
EVENT_STATUS 
EVENT_DETECTIONSTATUS 
EVENT_FEELING 
EVENT_STATE 
EVENT_PLAYERMOVED 
EVENT_SEEFLOOR 
EVENT_EXPLOSION 
EVENT_BOLT 
EVENT_MISSILE 
EVENT_INVENTORY 
EVENT_EQUIPMENT 
EVENT_ITEMLIST 
EVENT_MONSTERLIST 
EVENT_MONSTERTARGET 
EVENT_OBJECTTARGET 
EVENT_MESSAGE 
EVENT_SOUND 
EVENT_BELL 
EVENT_USE_STORE 
EVENT_STORECHANGED 
EVENT_INPUT_FLUSH 
EVENT_MESSAGE_FLUSH 
EVENT_CHECK_INTERRUPT 
EVENT_REFRESH 
EVENT_NEW_LEVEL_DISPLAY 
EVENT_COMMAND_REPEAT 
EVENT_ANIMATE 
EVENT_CHEAT_DEATH 
EVENT_INITSTATUS 
EVENT_BIRTHPOINTS 
EVENT_ENTER_INIT 
EVENT_LEAVE_INIT 
EVENT_ENTER_BIRTH 
EVENT_LEAVE_BIRTH 
EVENT_ENTER_GAME 
EVENT_LEAVE_GAME 
EVENT_ENTER_WORLD 
EVENT_LEAVE_WORLD 
EVENT_ENTER_STORE 
EVENT_LEAVE_STORE 
EVENT_ENTER_DEATH 
EVENT_LEAVE_DEATH 
EVENT_END 

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  )

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  seen,
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  ,
int  x,
int  y 
)
void event_signal_string ( game_event_type  ,
const char *  s 
)