Hexmap Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <hexmap.h> struct HexList; HexList* hex_list_set_tile (HexList *list, gint depth, HexTile *tile); void hex_list_clear (HexList *list); HexList* hex_list_copy (HexList *list); HexList* hex_list_painter_copy (HexList *list); guint hex_list_painter_hash (HexList *list); gboolean hex_list_painter_equal (HexList *list1, HexList *list2); |
A HexList is a singly linked list of HexTile, with the links proceeding from lowest depth to highest (painter's algorithm order). A singly linked list was used instead of a doubly linked list because it was felt that the computational losses due to reverse traversal of a (in most cases very short) HexList was offset by the savings in ram for HexGrid (especially for mind bogglingly huge grid sizes).
struct HexList { HexTile *tile; gint depth; HexList *next; }; |
A linked list for holding HexTile pointers in depth order, lowest depth first
HexList* hex_list_set_tile (HexList *list, gint depth, HexTile *tile); |
Set the tile at a given depth in a HexList
a HexList. An empty list can be specified by passing NULL.
the depth at which to place the tile
a HexTile. Passing NULL clears the existing tile at this depth.
The updated HexList
void hex_list_clear (HexList *list); |
Clear the contents of a HexList
a HexList.
HexList* hex_list_copy (HexList *list); |
copy a HexList
a HexList. An empty list can be specified by passing NULL.
A copy of list, containing the same tiles as the original
HexList* hex_list_painter_copy (HexList *list); |
Return a new HexList containing the HexData from list in newly created HexTiles. Any HexData with a NULL draw function is not copied.
a HexList
the new HexList
guint hex_list_painter_hash (HexList *list); |
This is a hash function whose return value depends only on the HexData in list, neglecting HexData with a NULL draw function
a HexList
a hash value
gboolean hex_list_painter_equal (HexList *list1, HexList *list2); |
Two lists are equal under the painter's algorithm if they have the same HexData in the same order, neglecting specific depths and HexData with a NULL draw function
a HexList
a HexList
TRUE if the lists are equal under the painter's algorithm, FALSE otherwise