6#include "space_fdecl.h"
11#include "mission_markers.h"
18#define SYSTEM_SIMULATE_TIME_PRE 25.
19#define SYSTEM_SIMULATE_TIME_POST 5.
20#define MAX_HYPERSPACE_VEL 25.
25#define SPOB_SERVICE_LAND (1<<0)
26#define SPOB_SERVICE_REFUEL (1<<1)
27#define SPOB_SERVICE_MISSIONS (1<<2)
28#define SPOB_SERVICE_COMMODITY (1<<3)
29#define SPOB_SERVICE_OUTFITS (1<<4)
30#define SPOB_SERVICE_SHIPYARD (1<<5)
31#define SPOB_SERVICE_BAR (1<<6)
32#define SPOB_SERVICE_INHABITED (1<<7)
33#define SPOB_SERVICE_BLACKMARKET (1<<8)
34#define SPOB_SERVICES_MAX (SPOB_SERVICE_BLACKMARKET<<1)
35#define spob_hasService(p,s) ((p)->services & s)
40#define SPOB_KNOWN (1<<0)
41#define SPOB_BLACKMARKET (1<<1)
42#define SPOB_NOMISNSPAWN (1<<2)
43#define SPOB_UNINHABITED (1<<3)
44#define SPOB_MARKED (1<<4)
45#define SPOB_NOLANES (1<<5)
46#define SPOB_RADIUS (1<<10)
47#define spob_isFlag(p,f) ((p)->flags & (f))
48#define spob_setFlag(p,f) ((p)->flags |= (f))
49#define spob_rmFlag(p,f) ((p)->flags &= ~(f))
50#define spob_isKnown(p) spob_isFlag(p,SPOB_KNOWN)
57typedef struct MapOverlayPos_ {
66typedef struct SpobPresence_ {
78typedef struct VirtualSpob_ {
155#define SYSTEM_KNOWN (1<<0)
156#define SYSTEM_MARKED (1<<1)
157#define SYSTEM_CMARKED (1<<2)
158#define SYSTEM_CLAIMED (1<<3)
159#define SYSTEM_DISCOVERED (1<<4)
160#define SYSTEM_HIDDEN (1<<5)
161#define SYSTEM_HAS_KNOWN_LANDABLE (1<<6)
162#define SYSTEM_HAS_LANDABLE (1<<7)
163#define SYSTEM_NOLANES (1<<8)
164#define SYSTEM_PMARKED (1<<9)
165#define SYSTEM_INTEREST (1<<10)
166#define sys_isFlag(s,f) ((s)->flags & (f))
167#define sys_setFlag(s,f) ((s)->flags |= (f))
168#define sys_rmFlag(s,f) ((s)->flags &= ~(f))
169#define sys_isKnown(s) (sys_isFlag((s),SYSTEM_KNOWN))
170#define sys_isMarked(s) sys_isFlag((s),SYSTEM_MARKED)
175typedef struct SystemPresence_ {
188#define JP_AUTOPOS (1<<0)
189#define JP_KNOWN (1<<1)
190#define JP_HIDDEN (1<<2)
191#define JP_EXITONLY (1<<3)
192#define JP_NOLANES (1<<4)
193#define jp_isFlag(j,f) ((j)->flags & (f))
194#define jp_setFlag(j,f) ((j)->flags |= (f))
195#define jp_rmFlag(j,f) ((j)->flags &= ~(f))
196#define jp_isKnown(j) jp_isFlag(j,JP_KNOWN)
197#define jp_isUsable(j) (jp_isKnown(j) && !jp_isFlag(j,JP_EXITONLY))
226typedef struct MapShader_ {
307void space_init(
const char* sysname,
int do_simulate );
359JumpPoint*
jump_get(
const char* jumpname,
const StarSystem* sys );
360JumpPoint*
jump_getTarget(
const StarSystem* target,
const StarSystem* sys );
387void system_presenceCleanupAll (
void);
422 int (*filter)(
Spob *p));
423double system_getClosest(
const StarSystem *sys,
int *pnt,
int *jp,
int *ast,
int *fie,
double x,
double y );
424double system_getClosestAng(
const StarSystem *sys,
int *pnt,
int *jp,
int *ast,
int *fie,
double x,
double y,
double ang );
void space_reconstructPresences(void)
Reset the presence of all systems.
void space_init(const char *sysname, int do_simulate)
Initializes the system.
double system_getClosestAng(const StarSystem *sys, int *pnt, int *jp, int *ast, int *fie, double x, double y, double ang)
Gets the feature nearest to directly ahead of a position in the system.
int system_addJumpDiff(StarSystem *sys, xmlNodePtr node)
Adds a jump point to a star system from a diff.
void spob_averageSeenPricesAtTime(const Spob *p, const ntime_t tupdate)
Adds cost of commodities on spob p to known statistics at time t.
double system_getClosest(const StarSystem *sys, int *pnt, int *jp, int *ast, int *fie, double x, double y)
Gets the closest feature to a position in the system.
int spob_exists(const char *spobname)
Check to see if a spob exists.
void system_rmCurrentPresence(StarSystem *sys, int faction, double amount)
Removes active presence.
void space_gfxUnload(StarSystem *sys)
Unloads all the graphics for a star system.
int space_canHyperspace(const Pilot *p)
Checks to make sure if pilot is far enough away to hyperspace.
void space_render(const double dt)
Renders the system.
int spob_luaInit(Spob *spob)
Updatse the spob's internal Lua stuff.
void systems_reconstructJumps(void)
Reconstructs the jumps.
int space_jumpDistance(const Pilot *p, const JumpPoint *jp)
Distance at which a pilot can jump.
const glColour * spob_getColour(const Spob *p)
Gets the spob colour.
int space_rmMarker(int objid, MissionMarkerType type)
Removes a marker from a system.
int spob_averageSpobPrice(const Spob *p, const Commodity *c, credits_t *mean, double *std)
Gets the average price of a commodity at a spob that has been seen so far.
double system_getPresenceFull(const StarSystem *sys, int faction, double *base, double *bonus)
Get the presence of a faction in a system.
Spob * spob_getAll(void)
Gets an array (array.h) of all spobs.
int spob_rename(Spob *p, char *newname)
Renames a spob.
int spob_getService(const char *name)
Converts name to spob service flag.
void system_setFaction(StarSystem *sys)
Sets the system faction based on the spobs it has.
Spob * spob_get(const char *spobname)
Gets a spob based on its name.
void space_factionChange(void)
Mark when a faction changes.
int system_addVirtualSpob(StarSystem *sys, const char *spobname)
Adds a virtual spob to a system.
const char * space_getRndSpob(int landable, unsigned int services, int(*filter)(Spob *p))
Gets the name of a random spob.
int system_rmJump(StarSystem *sys, const char *jumpname)
Removes a jump point from a star system.
void space_update(double dt, double real_dt)
Controls fleet spawning.
StarSystem * system_getIndex(int id)
Get the system by its index.
int spob_index(const Spob *p)
Gets the ID of a spob.
int spob_hasSystem(const Spob *spb)
Get whether or not a spob has a system (i.e. is on the map).
const char * jump_getSymbol(const JumpPoint *jp)
Gets the jump point symbol.
const char * spob_getSymbol(const Spob *p)
Gets the spob symbol.
void space_renderOverlay(const double dt)
Renders the system overlay.
int spob_setFaction(Spob *p, int faction)
Changes the spobs faction.
char spob_getColourChar(const Spob *p)
Gets the spob colour char.
StarSystem * system_new(void)
Creates a new star system.
int space_sysReachable(const StarSystem *sys)
Sees if a system is reachable.
JumpPoint * jump_getTarget(const StarSystem *target, const StarSystem *sys)
Less safe version of jump_get that works with pointers.
const char * system_existsCase(const char *sysname)
Checks to see if a system exists case insensitively.
StarSystem * system_getAll(void)
Gets an array (array.h) of all star systems.
char ** spob_searchFuzzyCase(const char *spobname, int *n)
Does a fuzzy case matching. Searches spob_name() but returns internal names.
int space_sysReachableFromSys(const StarSystem *target, const StarSystem *sys)
Sees if a system is reachable from another system.
char ** system_searchFuzzyCase(const char *sysname, int *n)
Does a fuzzy case matching. Searches translated names but returns internal names.
StarSystem * system_get(const char *sysname)
Get the system from its name.
const char * spob_getSystem(const char *spobname)
Get the name of a system from a spobname.
int space_calcJumpInPos(const StarSystem *in, const StarSystem *out, vec2 *pos, vec2 *vel, double *dir, const Pilot *p)
Calculates the jump in pos for a pilot.
int spob_rmService(Spob *p, int service)
Removes a service from a spob.
void system_updateAsteroids(StarSystem *sys)
Updates some internal calculations about asteroids in a system.
void spob_setKnown(Spob *p)
Sets a spob's known status, if it's real.
void spobs_render(void)
Renders the current systems' spobs.
const char * spob_existsCase(const char *spobname)
Check to see if a spob exists (case insensitive).
int system_addSpob(StarSystem *sys, const char *spobname)
Adds a spob to a star system.
void space_exit(void)
Cleans up the system.
int space_addMarker(int objid, MissionMarkerType type)
Adds a marker to a system.
double system_getPresence(const StarSystem *sys, int faction)
Get the presence of a faction in a system.
void spob_updateLand(Spob *p)
Updates the land possibilities of a spob.
int space_sysReallyReachable(const char *sysname)
Sees if a system can be reached via jumping.
void spob_gfxLoad(Spob *spob)
Loads a spob's graphics (and radius).
int system_rmVirtualSpob(StarSystem *sys, const char *spobname)
Removes a virtual spob from a system.
void space_clearMarkers(void)
Clears all system markers.
VirtualSpob * virtualspob_getAll(void)
Gets all the virtual spobs.
Spob * spob_getIndex(int ind)
Gets spob by index.
void system_presenceAddSpob(StarSystem *sys, const SpobPresence *ap)
Adds (or removes) some presence to a system.
VirtualSpob * virtualspob_get(const char *name)
Gets a virtual spob by matching name.
void space_clearKnown(void)
Clears all system knowledge.
void system_addAllSpobsPresence(StarSystem *sys)
Go through all the spobs and call system_addPresence().
int spob_addCommodity(Spob *p, Commodity *c)
Adds a commodity to a spob.
int system_hasSpob(const StarSystem *sys)
See if the system has a spob.
int spob_addService(Spob *p, int service)
Removes a service from a spob.
const char * spob_name(const Spob *p)
Gets the translated name of a spob.
const char * spob_getClassName(const char *class)
Gets the long class name for a spob.
const char * space_populationStr(const Spob *spb)
Gets the population in an approximated string. Note this function changes the string value each call,...
void space_clearComputerMarkers(void)
Clears all the system computer markers.
void space_queueLand(Spob *pnt)
Cues a spob to be landed on. This is not done immediately, but when the engine thinks it is ok to do.
credits_t spob_commodityPrice(const Spob *p, const Commodity *c)
Gets the price of a commodity at a spob.
const char * spob_getServiceName(int service)
Gets the (English) name for a service code.
void systems_reconstructSpobs(void)
Updates the system spob pointers.
Spob * spob_new(void)
Creates a new spob.
int space_needsEffects(void)
returns whether or not we're simulating with effects.
char ** space_getFactionSpob(const int *factions, int landable)
Gets the name of all the spobs that belong to factions.
void spob_luaInitMem(const Spob *spob)
Initializes the memory fo a spob.
JumpPoint * jump_get(const char *jumpname, const StarSystem *sys)
Gets a jump point based on its target and system.
void space_checkLand(void)
Handles landing if necessary.
glTexture * jumppoint_gfx
void space_gfxLoad(StarSystem *sys)
Loads all the graphics for a star system.
int space_hyperspace(Pilot *p)
Tries to get the pilot into hyperspace.
int space_load(void)
Loads the entire universe into ram - pretty big feat eh?
int space_isSimulation(void)
returns whether we're just simulating.
credits_t spob_commodityPriceAtTime(const Spob *p, const Commodity *c, ntime_t t)
Gets the price of a commodity at a spob at given time.
int system_index(const StarSystem *sys)
Gets the index of a star system.
int system_rmSpob(StarSystem *sys, const char *spobname)
Removes a spob from a star system.
int space_loadLua(void)
initializes the Lua for all the spobs.
void system_reconstructJumps(StarSystem *sys)
Reconstructs the jumps for a single system.
Represents an asteroid field anchor.
Represents an asteroid exclusion zone.
Saves the layout decisions from positioning labeled objects on the overlay.
The representation of an in-game pilot.
Represents relative ship statistics as a linked list.
Represents the presence of a spob.
Represents a Space Object (SPOB), including and not limited to planets, stations, wormholes,...
const SimpleShader * marker
CommodityPrice * commodityPrice
Represents a star system.
AsteroidAnchor * asteroids
SystemPresence * presence
VirtualSpob ** spobs_virtual
AsteroidExclusion * astexclude
Represents presence in a system.
Basically modifies system parameters without creating any real objects.
Abstraction for rendering sprite sheets.