Functions | Variables
mon-list.c File Reference

Monster list UI. More...

#include "game-world.h"
#include "mon-desc.h"
#include "mon-list.h"
#include "project.h"


monster_list_tmonster_list_new (void)
 Allocate a new monster list based on the size of the current cave's monster array.
void monster_list_free (monster_list_t *list)
 Free a monster list.
void monster_list_init (void)
 Initialize the monster list module.
void monster_list_finalize (void)
 Tear down the monster list module.
monster_list_tmonster_list_shared_instance (void)
 Return a common monster list instance.
static bool monster_list_needs_update (const monster_list_t *list)
 Return TRUE if the list needs to be updated.
void monster_list_reset (monster_list_t *list)
 Zero out the contents of a monster list.
void monster_list_collect (monster_list_t *list)
 Collect monster information from the current cave's monster list.
int monster_list_standard_compare (const void *a, const void *b)
 Standard comparison function for the monster list: sort by depth and then power.
void monster_list_sort (monster_list_t *list, int(*compare)(const void *, const void *))
 Sort the monster list with the given sort function.
byte monster_list_entry_line_color (const monster_list_entry_t *entry)
 Return an color to display a particular list entry with.


static monster_list_tmonster_list_subwindow = NULL
 Shared monster list instance.

Detailed Description

Monster list UI.

Copyright (c) 1997-2007 Ben Harrison, James E. Wilson, Robert A. Koeneke Copyright (c) 2013 Ben Semmler

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 monster_list_collect ( monster_list_t list)
byte monster_list_entry_line_color ( const monster_list_entry_t entry)

Return an color to display a particular list entry with.

entryis the monster list entry to display.
a color for the monster entry.

References COLOUR_RED, COLOUR_VIOLET, COLOUR_WHITE, player::depth, monster_race::flags, monster_race::level, monster_list_entry_s::race, and rf_has.

Referenced by monster_list_format_section().

void monster_list_finalize ( void  )

Tear down the monster list module.

References monster_list_free().

Referenced by cleanup_angband().

void monster_list_free ( monster_list_t list)

Free a monster list.

References monster_list_s::entries, and mem_free().

Referenced by monster_list_finalize(), and monster_list_show_interactive().

void monster_list_init ( void  )

Initialize the monster list module.

Referenced by init_angband().

static bool monster_list_needs_update ( const monster_list_t list)

Return TRUE if the list needs to be updated.

Usually this is each turn or if the number of cave monsters changes.

References cave, cave_monster_max(), monster_list_s::creation_turn, monster_list_s::entries, monster_list_s::entries_size, FALSE, int, and turn.

Referenced by monster_list_collect(), and monster_list_reset().

monster_list_t* monster_list_new ( void  )

Allocate a new monster list based on the size of the current cave's monster array.

References cave, cave_monster_max(), monster_list_s::entries, monster_list_s::entries_size, mem_free(), mem_zalloc(), and size.

Referenced by monster_list_shared_instance(), and monster_list_show_interactive().

void monster_list_reset ( monster_list_t list)
monster_list_t* monster_list_shared_instance ( void  )

Return a common monster list instance.

References monster_list_new(), and monster_list_subwindow.

Referenced by monster_list_force_subwindow_update(), and monster_list_show_subwindow().

void monster_list_sort ( monster_list_t list,
int(*)(const void *, const void *)  compare 
int monster_list_standard_compare ( const void a,
const void b 

Standard comparison function for the monster list: sort by depth and then power.

References monster_race::level, and monster_race::power.

Referenced by monster_list_show_interactive(), and monster_list_show_subwindow().

Variable Documentation

monster_list_t* monster_list_subwindow = NULL

Shared monster list instance.

Referenced by monster_list_shared_instance().