20#define SP_XML_ID "slot"
25typedef struct SlotProperty_s {
40static int sp_check(
unsigned int spid );
62 node = doc->xmlChildrenNode;
64 WARN(_(
"Malformed '%s' file: missing root element '%s'"), sp_files[i],
SP_XML_ID );
70 xmlr_attr_strd( node,
"name", sp->
name );
71 cur = node->xmlChildrenNode;
76 xmlr_strd( cur,
"display", sp->
display );
78 if (xml_isNode( cur,
"required" )) {
82 if (xml_isNode( cur,
"exclusive" )) {
86 if (xml_isNode( cur,
"locked" )) {
90 if (xml_isNode( cur,
"icon" )) {
91 char path[STRMAX_SHORT];
92 snprintf( path,
sizeof(path),
"gfx/slots/%s", xml_get(cur) );
98 WARN(_(
"Slot Property '%s' has unknown node '%s'."), node->name, cur->name);
99 }
while (xml_nextNode(cur));
139 if (strcmp( sp->
name, name ) == 0)
142 WARN(_(
"Slot property '%s' not found in array."), name);
Provides macros to work with dynamic arrays.
#define array_free(ptr_array)
Frees memory allocated and sets array to NULL.
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
#define array_grow(ptr_array)
Increases the number of elements by one and returns the last element.
#define array_create(basic_type)
Creates a new dynamic array of ‘basic_type’.
Header file with generic functions and naev-specifics.
char ** ndata_listRecursive(const char *path)
Lists all the visible files in a directory, at any depth.
glTexture * xml_parseTexture(xmlNodePtr node, const char *path, int defsx, int defsy, const unsigned int flags)
Parses a texture handling the sx and sy elements.
xmlDocPtr xml_parsePhysFS(const char *filename)
Analogous to xmlParseMemory/xmlParseFile.
void gl_freeTexture(glTexture *texture)
Frees a texture.
int sp_locked(unsigned int spid)
Gets whether or not a slot property is locked.
unsigned int sp_get(const char *name)
Gets the id of a slot property.
const char * sp_description(unsigned int spid)
Gets the description of a slot property (in English).
void sp_cleanup(void)
Cleans up after the slot properties.
static int sp_check(unsigned int spid)
Checks to see if in bound of array.
int sp_load(void)
Initializes the slot properties.
const glTexture * sp_icon(unsigned int spid)
Gets the icon associated with the slot.
const char * sp_display(unsigned int spid)
Gets the display name of a slot property (in English).
int sp_required(unsigned int spid)
Gets whether or not a slot property is required.
int sp_exclusive(unsigned int spid)
Gets whether or not a slot property is exclusive.
static SlotProperty_t * sp_array
Representation of a slot property.
Abstraction for rendering sprite sheets.