|
Atrinik Server 2.5
|
#include <global.h>Go to the source code of this file.
Functions | |
| static int | pointer_strcmp (const void *p1, const void *p2) |
| int | load_dir (const char *dir, char ***namelist, int skip_dirs) |
| mapstruct * | load_style_map (char *style_name) |
| mapstruct * | find_style (char *dirname, char *stylename, int difficulty) |
| object * | pick_random_object (mapstruct *style) |
| void | free_style_maps () |
Variables | |
| mapstruct * | styles = NULL |
Those functions deal with style for random maps.
Definition in file style.c.
| mapstruct* find_style | ( | char * | dirname, |
| char * | stylename, | ||
| int | difficulty | ||
| ) |
Loads and returns the map requested.
Dirname, for example, is "/styles/wallstyles", stylename, is, for example, "castle", difficulty is -1 when difficulty is irrelevant to the style.
If dirname is given, but stylename isn't, and difficulty is -1, it returns a random style map.
Otherwise, it tries to match the difficulty given with a style file, named style_name_# where # is an integer.
| dirname | Where to look. |
| stylename | Style to use, can be NULL. |
| difficulty | Style difficulty. |
| int load_dir | ( | const char * | dir, |
| char *** | namelist, | ||
| int | skip_dirs | ||
| ) |
This is our own version of scandir/select_regular_files/sort.
To support having subdirectories in styles, we need to know if in fact the directory we read is a subdirectory. However, we can't get that through the normal dirent entry. So instead, we do our own where we do have the full directory path so can do stat calls to see if in fact it is a directory.
| dir | Name of the directory to scan. |
| namelist | Array of file names returned. It needs to be freed by the caller. |
| skip_dirs | If nonzero, we don't skip any subdirectories - if zero, we store those away, since there are cases where we want to choose a random directory. |
| mapstruct* load_style_map | ( | char * | style_name | ) |
| static int pointer_strcmp | ( | const void * | p1, |
| const void * | p2 | ||
| ) | [static] |
1.7.4