Angband
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"

Functions

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

Variables

static monster_list_tmonster_list_subwindow = NULL
 Shared monster list instance. More...
 

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

static bool monster_list_can_update ( const monster_list_t list)
static

Return true if there is nothing preventing the list from being updated.

This should be for structural sanity checks and not gameplay checks.

References cave, cave_monster_max(), monster_list_s::entries, monster_list_s::entries_size, and NULL.

Referenced by monster_list_collect().

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.

Parameters
entryis the monster list entry to display.
Returns
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, rf_has, and RF_UNIQUE.

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, mem_free(), and NULL.

Referenced by monster_list_finalize(), and monster_list_show_interactive().

void monster_list_init ( void  )

Initialize the monster list module.

References NULL.

Referenced by init_angband().

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(), NULL, and size.

Referenced by monster_list_shared_instance(), and monster_list_show_interactive().

void monster_list_reset ( monster_list_t list)

Zero out the contents of a monster list.

If needed, this function will reallocate the entry list if the number of monsters has changed.

References cave, cave_monster_max(), monster_list_s::creation_turn, monster_list_s::distinct_entries, monster_list_s::entries, monster_list_s::entries_size, mem_realloc(), MONSTER_LIST_SECTION_MAX, NULL, monster_list_s::sorted, monster_list_s::total_entries, and monster_list_s::total_monsters.

Referenced by monster_list_show_subwindow().

monster_list_t* monster_list_shared_instance ( void  )

Return a common monster list instance.

References monster_list_new(), monster_list_subwindow, and NULL.

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 NULL.

Referenced by monster_list_show_interactive(), and monster_list_show_subwindow().

Variable Documentation

monster_list_t* monster_list_subwindow = NULL
static

Shared monster list instance.

Referenced by monster_list_shared_instance().