naev 0.10.4
gatherable.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "commodity.h"
7#include "pilot.h"
8
14typedef struct Gatherable_ {
15 const Commodity *type;
18 double timer;
19 double lifeleng;
21 int sx;
22 int sy;
23 unsigned int player_only;
25
26/*
27 * Init/cleanup.
28 */
29int gatherable_load (void);
30void gatherable_cleanup (void);
31
32/*
33 * Gatherable objects
34 */
35int gatherable_init( const Commodity* com, vec2 pos, vec2 vel, double lifeleng, int qtt, unsigned int player_only );
36void gatherable_render( void );
37int gatherable_getClosest( vec2 pos, double rad );
38int gatherable_getPos( vec2* pos, vec2* vel, int id );
39void gatherable_free( void );
40void gatherable_update( double dt );
41void gatherable_gather( Pilot *p );
int gatherable_getPos(vec2 *pos, vec2 *vel, int id)
Returns the position and velocity of a gatherable.
Definition: gatherable.c:146
void gatherable_free(void)
Frees all the gatherables.
Definition: gatherable.c:99
int gatherable_init(const Commodity *com, vec2 pos, vec2 vel, double lifeleng, int qtt, unsigned int player_only)
Initializes a gatherable object.
Definition: gatherable.c:52
void gatherable_gather(Pilot *p)
See if the pilot can gather anything.
Definition: gatherable.c:168
void gatherable_update(double dt)
Updates all gatherable objects.
Definition: gatherable.c:77
int gatherable_getClosest(vec2 pos, double rad)
Gets the closest gatherable from a given position, within a given radius.
Definition: gatherable.c:122
void gatherable_render(void)
Renders all the gatherables.
Definition: gatherable.c:107
Represents a commodity.
Definition: commodity.h:43
Represents stuff that can be gathered.
Definition: gatherable.h:14
vec2 pos
Definition: gatherable.h:16
double lifeleng
Definition: gatherable.h:19
double timer
Definition: gatherable.h:18
const Commodity * type
Definition: gatherable.h:15
unsigned int player_only
Definition: gatherable.h:23
int quantity
Definition: gatherable.h:20
vec2 vel
Definition: gatherable.h:17
The representation of an in-game pilot.
Definition: pilot.h:210
Represents a 2d vector.
Definition: vec2.h:32