naev 0.12.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_hasShip( const tech_group_t *tech, const Ship *s );
44int tech_hasOutfit( const tech_group_t *tech, const Outfit *o );
45int tech_hasCommodity( const tech_group_t *tech, const Commodity *c );
46int tech_getItemCount( const tech_group_t *tech );
47char **tech_getItemNames( const tech_group_t *tech, int *n );
48char **tech_getAllItemNames( int *n );
49Outfit **tech_getOutfit( const tech_group_t *tech );
50Outfit **tech_getOutfitArray( tech_group_t **tech, int num );
51Ship **tech_getShip( const tech_group_t *tech );
52Ship **tech_getShipArray( tech_group_t **tech, int num );
53Commodity **tech_getCommodity( const tech_group_t *tech );
54Commodity **tech_getCommodityArray( tech_group_t **tech, int num );
55
56/*
57 * Check.
58 */
59int tech_checkOutfit( const tech_group_t *tech, const Outfit *o );
static const double c[]
Definition rng.c:256
Represents a commodity.
Definition commodity.h:57
A ship outfit, depends radically on the type.
Definition outfit.h:372
Represents a space ship.
Definition ship.h:97
Group of tech items, basic unit of the tech trees.
Definition tech.c:59
void tech_free(void)
Cleans up after the tech stuff.
Definition tech.c:161
Ship ** tech_getShipArray(tech_group_t **tech, int num)
Gets the ships from an array of techs.
Definition tech.c:913
int tech_load(void)
Loads the tech information.
Definition tech.c:106
Commodity ** tech_getCommodity(const tech_group_t *tech)
Gets all of the ships associated to a tech group.
Definition tech.c:960
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:980
int tech_groupWrite(xmlTextWriterPtr writer, tech_group_t *grp)
Writes a group in an xml node.
Definition tech.c:239
int tech_hasShip(const tech_group_t *tech, const Ship *ship)
Checks to see whether a tech group contains a ship.
Definition tech.c:739
int tech_rmItemTech(tech_group_t *tech, const char *value)
Removes an item from a tech.
Definition tech.c:506
int tech_hasCommodity(const tech_group_t *tech, const Commodity *comm)
Checks to see whether a tech group contains a commodity.
Definition tech.c:771
tech_group_t * tech_groupCreate(void)
Creates a tech group.
Definition tech.c:196
int tech_getItemCount(const tech_group_t *tech)
Gets the number of techs within a given group.
Definition tech.c:785
int tech_rmItem(const char *name, const char *value)
Removes a tech item.
Definition tech.c:525
int tech_hasItem(const tech_group_t *tech, const char *item)
Checks whether a given tech group has the specified item.
Definition tech.c:680
tech_group_t * tech_groupCreateXML(xmlNodePtr node)
Creates a tech group from an XML node.
Definition tech.c:185
void tech_groupDestroy(tech_group_t *grp)
Frees a tech group.
Definition tech.c:205
Commodity ** tech_getCommodityArray(tech_group_t **tech, int num)
Gets the ships from an array of techs.
Definition tech.c:937
Ship ** tech_getShip(const tech_group_t *tech)
Gets all of the ships associated to a tech group.
Definition tech.c:887
int tech_addItemTech(tech_group_t *tech, const char *value)
Adds an item to a tech.
Definition tech.c:480
int tech_addItem(const char *name, const char *value)
Adds an item to a tech.
Definition tech.c:443
Outfit ** tech_getOutfitArray(tech_group_t **tech, int num)
Gets the outfits from an array of techs.
Definition tech.c:864
Outfit ** tech_getOutfit(const tech_group_t *tech)
Gets all of the outfits associated to a tech group.
Definition tech.c:839
char ** tech_getItemNames(const tech_group_t *tech, int *n)
Gets the names of all techs within a given group.
Definition tech.c:797
int tech_hasOutfit(const tech_group_t *tech, const Outfit *outfit)
Checks to see whether a tech group contains a outfit.
Definition tech.c:755
char ** tech_getAllItemNames(int *n)
Gets the names of all techs.
Definition tech.c:817