naev 0.11.5
tech.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "commodity.h"
7#include "nxml.h"
8#include "outfit.h"
9#include "ship.h"
10
11/*
12 * Forward declaration of tech group struct.
13 */
14struct tech_group_s;
15typedef struct tech_group_s tech_group_t;
16
17/*
18 * Load/free.
19 */
20int tech_load (void);
21void tech_free (void);
22
23/*
24 * Group creation/destruction.
25 */
26tech_group_t *tech_groupCreate( void );
27tech_group_t *tech_groupCreateXML( xmlNodePtr node );
28void tech_groupDestroy( tech_group_t *grp );
29int tech_groupWrite( xmlTextWriterPtr writer, tech_group_t *grp );
30
31/*
32 * Group addition/removal.
33 */
34int tech_addItemTech( tech_group_t *tech, const char *value );
35int tech_rmItemTech( tech_group_t *tech, const char *value );
36int tech_addItem( const char *name, const char *value );
37int tech_rmItem( const char *name, const char *value );
38
39/*
40 * Get.
41 */
42int tech_hasItem( const tech_group_t *tech, const char *item );
43int tech_getItemCount( const tech_group_t *tech );
44char** tech_getItemNames( const tech_group_t *tech, int *n );
45char** tech_getAllItemNames( int *n );
46Outfit** tech_getOutfit( const tech_group_t *tech );
47Outfit** tech_getOutfitArray( tech_group_t **tech, int num );
48Ship** tech_getShip( const tech_group_t *tech );
49Ship** tech_getShipArray( tech_group_t **tech, int num );
50Commodity** tech_getCommodity( const tech_group_t *tech );
51Commodity** tech_getCommodityArray( tech_group_t **tech, int num );
52
53/*
54 * Check.
55 */
56int tech_checkOutfit( const tech_group_t *tech, const Outfit *o );
Represents a commodity.
Definition commodity.h:43
A ship outfit, depends radically on the type.
Definition outfit.h:328
Represents a space ship.
Definition ship.h:94
Group of tech items, basic unit of the tech trees.
Definition tech.c:57
void tech_free(void)
Cleans up after the tech stuff.
Definition tech.c:141
Ship ** tech_getShipArray(tech_group_t **tech, int num)
Gets the ships from an array of techs.
Definition tech.c:802
int tech_load(void)
Loads the tech information.
Definition tech.c:91
Commodity ** tech_getCommodity(const tech_group_t *tech)
Gets all of the ships associated to a tech group.
Definition tech.c:849
int tech_checkOutfit(const tech_group_t *tech, const Outfit *o)
Checks to see if there is an outfit in the tech group.
Definition tech.c:869
int tech_groupWrite(xmlTextWriterPtr writer, tech_group_t *grp)
Writes a group in an xml node.
Definition tech.c:219
int tech_rmItemTech(tech_group_t *tech, const char *value)
Removes an item from a tech.
Definition tech.c:488
tech_group_t * tech_groupCreate(void)
Creates a tech group.
Definition tech.c:176
int tech_getItemCount(const tech_group_t *tech)
Gets the number of techs within a given group.
Definition tech.c:674
int tech_rmItem(const char *name, const char *value)
Removes a tech item.
Definition tech.c:507
int tech_hasItem(const tech_group_t *tech, const char *item)
Checks whether a given tech group has the specified item.
Definition tech.c:658
tech_group_t * tech_groupCreateXML(xmlNodePtr node)
Creates a tech group from an XML node.
Definition tech.c:165
void tech_groupDestroy(tech_group_t *grp)
Frees a tech group.
Definition tech.c:185
Commodity ** tech_getCommodityArray(tech_group_t **tech, int num)
Gets the ships from an array of techs.
Definition tech.c:826
Ship ** tech_getShip(const tech_group_t *tech)
Gets all of the ships associated to a tech group.
Definition tech.c:776
int tech_addItemTech(tech_group_t *tech, const char *value)
Adds an item to a tech.
Definition tech.c:468
int tech_addItem(const char *name, const char *value)
Adds an item to a tech.
Definition tech.c:434
Outfit ** tech_getOutfitArray(tech_group_t **tech, int num)
Gets the outfits from an array of techs.
Definition tech.c:753
Outfit ** tech_getOutfit(const tech_group_t *tech)
Gets all of the outfits associated to a tech group.
Definition tech.c:728
char ** tech_getItemNames(const tech_group_t *tech, int *n)
Gets the names of all techs within a given group.
Definition tech.c:686
char ** tech_getAllItemNames(int *n)
Gets the names of all techs.
Definition tech.c:706