31#include "land_outfits.h"
32#include "land_shipyard.h"
33#include "land_trade.h"
48#include "player_fleet.h"
58#define VISITED_LAND (1<<0)
59#define VISITED_COMMODITY (1<<1)
60#define VISITED_BAR (1<<2)
61#define VISITED_OUTFITS (1<<3)
62#define VISITED_SHIPYARD (1<<4)
63#define VISITED_EQUIPMENT (1<<5)
64#define VISITED_MISSION (1<<6)
65#define visited(f) (land_visited |= (f))
66#define has_visited(f) (land_visited & (f))
70unsigned int land_generated = 0;
105static char errorlist[STRMAX_SHORT];
106static char errorreason[STRMAX_SHORT];
107static int errorappend;
108static char *errorlist_ptr;
119static int land_gc(
void *unused );
120static int land_hasLocalMap (
void);
124static void land_changeTab(
unsigned int wid,
const char *wgt,
int old,
int tab );
126static void bar_getDim(
int wid,
int *w,
int *h,
int *iw,
int *ih,
int *bw,
int *bh );
127static void bar_open(
unsigned int wid );
129static void bar_update(
unsigned int wid,
const char *str );
130static void bar_close(
unsigned int wid,
const char *str );
131static void bar_approach(
unsigned int wid,
const char *str );
134static void misn_open(
unsigned int wid );
135static void misn_autonav(
unsigned int wid,
const char *str );
136static void misn_accept(
unsigned int wid,
const char *str );
138static void misn_update(
unsigned int wid,
const char *str );
149void land_needsTakeoff(
int delay )
156static int land_hasLocalMap (
void)
158 if (!spob_hasService(
land_spob, SPOB_SERVICE_REFUEL ))
169 if (player_isFlag( PLAYER_NOSAVE ))
180 if (spob_hasService(p,SPOB_SERVICE_REFUEL) && p->can_land)
201 errorlist_ptr = NULL;
215 vsnprintf(errorreason,
sizeof(errorreason), fmt, ap);
218 if (errorlist_ptr == NULL)
219 errorappend =
scnprintf( errorlist,
sizeof(errorlist),
"%s", errorreason );
221 scnprintf( &errorlist[errorappend],
sizeof(errorlist)-errorappend,
"\n%s", errorreason );
222 errorlist_ptr = errorlist;
230 if (errorlist_ptr != NULL) {
241 int *w,
int *h,
int *iw,
int *ih,
int *bw,
int *bh )
247 *iw = 704 + (*w - LAND_WIDTH);
251 *bw = (*w - *iw - 80)/2;
252 *bh = LAND_BUTTON_HEIGHT;
259 int w, h, iw, ih, bw, bh, dh, th;
263 land_tabGenerate(LAND_WINDOW_BAR);
270 bar_getDim( wid, &w, &h, &iw, &ih, &bw, &bh );
277 window_addButtonKey( wid, -20, 20,
278 bw, bh,
"btnCloseBar",
280 window_addButtonKey( wid, -20 - bw - 20, 20,
281 bw, bh,
"btnApproach",
285 window_addText( wid, iw + 40, -40, w - iw - 60, dh, 0,
290 window_addText( wid, iw + 40, th,
295 th -= 20 + PORTRAIT_HEIGHT + 20 + 20;
296 window_addText( wid, iw + 60, th,
297 w - iw - 100, h + th - (2*bh+60), 0,
311 ImageArrayCell *portraits;
312 int w, h, iw, ih, bw, bh;
320 bar_getDim( wid, &w, &h, &iw, &ih, &bw, &bh );
325 pos = toolkit_getImageArrayPos( wid,
"iarMissions" );
341 portraits = calloc(1,
sizeof(ImageArrayCell));
343 portraits[0].caption = strdup(_(
"News"));
347 portraits = calloc(n,
sizeof(ImageArrayCell));
349 portraits[0].caption = strdup(_(
"News"));
351 ImageArrayCell *p = &portraits[i+1];
364 window_addImageArray( wid, 20, -40,
365 iw, ih,
"iarMissions", 128, 96,
369 toolkit_setImageArrayPos( wid,
"iarMissions", pos );
399 int w, h, iw, ih, bw, bh, dh;
402 bar_getDim( wid, &w, &h, &iw, &ih, &bw, &bh );
406 pos = toolkit_getImageArrayPos( wid,
"iarMissions" );
421 window_disableButton( wid,
"btnApproach" );
424 window_modifyText( wid,
"txtPortrait", NULL );
425 window_modifyText( wid,
"txtMission", NULL );
429 w - iw - 100, h - 40 - (dh+20) - 40 - bh - 20 );
442 window_addImage( wid, iw + 40 + (w-iw-60-PORTRAIT_WIDTH)/2,
443 -(40 + dh + 40 +
gl_defFont.
h + 20 + PORTRAIT_HEIGHT),
444 0, 0,
"imgPortraitBG", NULL, 1 );
446 window_addImage( wid, iw + 40 + (w-iw-60-PORTRAIT_WIDTH)/2,
447 -(40 + dh + 40 +
gl_defFont.
h + 20 + PORTRAIT_HEIGHT),
448 0, 0,
"imgPortrait", NULL, 1 );
451 window_enableButton( wid,
"btnApproach" );
454 window_modifyText( wid,
"txtPortrait",
npc_getName( pos ) );
456 PORTRAIT_WIDTH, PORTRAIT_HEIGHT );
458 PORTRAIT_WIDTH, PORTRAIT_HEIGHT );
461 window_modifyText( wid,
"txtMission",
npc_getDesc( pos ));
468static void bar_close(
unsigned int wid,
const char *name )
491 pos = toolkit_getImageArrayPos( wid,
"iarMissions" );
509 toolkit_setImageArrayPos( wid,
"iarMissions", 0 );
515 land_needsTakeoff( 0 );
537 land_tabGenerate(LAND_WINDOW_MISSION);
543 window_addButtonKey( wid, -20, 20,
544 LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT,
"btnCloseMission",
546 window_addButtonKey( wid, -20, 40+LAND_BUTTON_HEIGHT,
547 LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT,
"btnAcceptMission",
549 window_addButtonKey( wid, -20, 60+2*LAND_BUTTON_HEIGHT,
550 LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT,
"btnAutonavMission",
555 window_addText( wid, w/2 + 10, y,
557 "txtSDate", NULL, &cFontGrey,
560 window_addText( wid, w/2 + 110, y,
562 "txtDate", NULL, NULL, NULL );
564 window_addText( wid, w/2 + 10, y,
568 window_addText( wid, w/2 + 10, y,
569 w/2 - 30, y - 40 + h - 2*LAND_BUTTON_HEIGHT, 0,
573 map_show( wid, 20, 20, w/2 - 30, h/2 - 35, 0.75, 0., 0. );
586 const StarSystem *sys;
610 const char *misn_name = toolkit_getList( wid,
"lstMission" );
613 if (strcmp(misn_name,_(
"No Missions"))==0)
617 _(
"Are you sure you want to accept this mission?"))) {
619 int pos = toolkit_getListPos( wid,
"lstMission" );
626 if ((ret==2) || (ret==3))
638 toolkit_setListPos( wid,
"lstMission", pos-1 );
674 misn_names = malloc(
sizeof(
char*));
675 misn_names[0] = strdup(_(
"No Missions"));
678 window_addList( wid, 20, -40,
693 const char *active_misn;
695 const StarSystem *sys;
696 char txt[STRMAX_SHORT], *buf;
703 snprintf( txt,
sizeof(txt), n_(
707 window_modifyText( wid,
"txtDate", txt );
709 active_misn = toolkit_getList( wid,
"lstMission" );
710 if (strcmp(active_misn,_(
"No Missions"))==0) {
711 window_modifyText( wid,
"txtHeader", NULL );
712 window_modifyText( wid,
"txtDesc",
713 _(
"There are no missions available here.") );
714 window_disableButton( wid,
"btnAcceptMission" );
715 window_disableButton( wid,
"btnAutonavMission" );
722 map_center( wid, sys->name );
723 snprintf( txt,
sizeof(txt), _(
"%s\n#nReward:#0 %s"), misn->
title, misn->
reward );
724 window_modifyText( wid,
"txtHeader", txt );
725 window_modifyText( wid,
"txtDesc", misn->
desc );
726 window_enableButton( wid,
"btnAcceptMission" );
727 window_enableButton( wid,
"btnAutonavMission" );
742 if (!spob_hasService(
land_spob, SPOB_SERVICE_REFUEL))
763 WARN( _(
"Outfit '%s' does not exist!"), LOCAL_MAP_NAME);
793 char buf[STRMAX], cred[ECON_CRED_STRLEN], tons[STRMAX_SHORT];
801 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
803 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s",
806 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n\n%s", tons );
807 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", cred );
810 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
818 if (!land_hasLocalMap())
823 WARN( _(
"Outfit '%s' does not exist!"), LOCAL_MAP_NAME);
834 snprintf( buf,
sizeof(buf), _(
"Buy Local Map (%s)"), cred );
835 window_addButtonKey(
land_windows[0], -20, 20 + (LAND_BUTTON_HEIGHT + 20),
836 LAND_BUTTON_WIDTH, LAND_BUTTON_HEIGHT,
"btnMap",
856 takeoff( 1, player_isFlag(PLAYER_NOSAVE) );
902 const char *names[LAND_NUMWINDOWS];
909 for (
int i=0; i<LAND_NUMWINDOWS; i++)
916 names[j++] = _(
"Landing Main");
918 if (spob_hasService(
land_spob, SPOB_SERVICE_BAR)) {
920 names[j++] = _(
"Spaceport Bar");
923 if (spob_hasService(
land_spob, SPOB_SERVICE_MISSIONS)) {
925 names[j++] = _(
"Missions");
928 if (spob_hasService(
land_spob, SPOB_SERVICE_OUTFITS)) {
930 names[j++] = _(
"Outfits");
933 if (spob_hasService(
land_spob, SPOB_SERVICE_SHIPYARD)) {
935 names[j++] = _(
"Shipyard");
938 if (spob_hasService(
land_spob, SPOB_SERVICE_OUTFITS) ||
939 spob_hasService(
land_spob, SPOB_SERVICE_SHIPYARD)) {
941 names[j++] = p_(
"service",
"Equipment");
944 if (spob_hasService(
land_spob, SPOB_SERVICE_COMMODITY)) {
946 names[j++] = _(
"Commodity");
962 unsigned int pntservices;
977 pntservices = p->services;
980 if (SCREEN_W < LAND_WIDTH || SCREEN_H < LAND_HEIGHT) {
985 w = LAND_WIDTH + 0.5 * (SCREEN_W - LAND_WIDTH);
986 h = LAND_HEIGHT + 0.5 * (SCREEN_H - LAND_HEIGHT);
1034 if (spob_hasService(
land_spob, SPOB_SERVICE_BAR))
1036 if (spob_hasService(
land_spob, SPOB_SERVICE_MISSIONS))
1039 MIS_AVAIL_COMPUTER );
1043#define should_open(s, w) \
1044 (spob_hasService(land_spob, s) && (!land_tabGenerated(w)))
1052 if (should_open( SPOB_SERVICE_BAR, LAND_WINDOW_BAR ))
1054 if (should_open( SPOB_SERVICE_MISSIONS, LAND_WINDOW_MISSION ))
1057 if (should_open( SPOB_SERVICE_OUTFITS, LAND_WINDOW_OUTFITS ))
1060 if (should_open( SPOB_SERVICE_SHIPYARD, LAND_WINDOW_SHIPYARD ))
1063 if ((spob_hasService(
land_spob, SPOB_SERVICE_OUTFITS) ||
1064 spob_hasService(
land_spob, SPOB_SERVICE_SHIPYARD)) &&
1065 !land_tabGenerated( LAND_WINDOW_EQUIPMENT ))
1068 if (should_open( SPOB_SERVICE_COMMODITY, LAND_WINDOW_COMMODITY ))
1137 pilot_rmFlag(
player.
p, PILOT_COOLDOWN_BRAKE);
1138 pilot_rmFlag(
player.
p, PILOT_COOLDOWN );
1167 if (spob_hasService(
land_spob, SPOB_SERVICE_BAR))
1171 economy_averageSeenPrices( p );
1186 land_needsTakeoff( 0 );
1195 lua_gc( naevL, LUA_GCCOLLECT, 0 );
1208 char buf[STRMAX_SHORT];
1221 int logow = logo->
w * (double)FACTION_LOGO_SM /
MAX( logo->
w, logo->
h );
1222 int logoh = logo->
h * (double)FACTION_LOGO_SM /
MAX( logo->
w, logo->
h );
1223 window_addImage( wid, 440 + (w-460-logow)/2, -20,
1224 logow, logoh,
"imgFaction", logo, 0 );
1225 offset += FACTION_LOGO_SM;
1232 window_addImage( wid, 20, -40, 400, 400,
"imgSpob",
gfx_exterior, 1 );
1234 window_addText( wid, 440, -20-offset,
1235 w-460, h-20-offset-60-LAND_BUTTON_HEIGHT*2, 0,
1239 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"#n%s", _(
"Stationed at:") );
1240 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Class:") );
1241 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Faction:") );
1242 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Population:") );
1243 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n\n%s", _(
"Free Space:") );
1244 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Money:") );
1246 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Tags:") );
1248 window_addText( wid, 20, 20, 200, th,
1250 window_addText( wid, 20+120, 20, w - 20 - (20+200) - LAND_BUTTON_WIDTH,
1251 th, 0,
"txtDInfo", &
gl_defFont, NULL, NULL );
1257 window_addButtonKey( wid, -20, 20,
1258 LAND_BUTTON_WIDTH, LAND_BUTTON_HEIGHT,
"btnTakeoff",
1264 y = 20 + (LAND_BUTTON_HEIGHT + 20) + 20;
1265 if (land_hasLocalMap())
1266 y += LAND_BUTTON_HEIGHT + 20;
1268 if (!spob_hasService(
land_spob, SPOB_SERVICE_REFUEL))
1269 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"No refueling services.") );
1272 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1273 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"#r%s#0", _(
"Game will not be saved.") );
1297 const char *torun_hook = NULL;
1298 unsigned int to_visit = 0;
1305 for (
int i=0; i<LAND_NUMWINDOWS; i++) {
1313 case LAND_WINDOW_MAIN:
1316 case LAND_WINDOW_OUTFITS:
1319 torun_hook =
"outfits";
1321 case LAND_WINDOW_SHIPYARD:
1324 torun_hook =
"shipyard";
1326 case LAND_WINDOW_BAR:
1331 case LAND_WINDOW_MISSION:
1334 torun_hook =
"mission";
1336 case LAND_WINDOW_COMMODITY:
1339 torun_hook =
"commodity";
1341 case LAND_WINDOW_EQUIPMENT:
1345 torun_hook =
"equipment";
1353 if (i != LAND_WINDOW_MISSION)
1363 if (torun_hook != NULL)
1370 land_needsTakeoff( 1 );
1391 char badfleet_ships[STRMAX_SHORT];
1399 badfleet_ships[0] =
'\0';
1406 l +=
scnprintf( &badfleet_ships[l],
sizeof(badfleet_ships)-l,
"\n%s", pe->
p->
name );
1413 if (!spob_hasService(
land_spob, SPOB_SERVICE_SHIPYARD)) {
1418 dialogue_msgRaw( _(
"Fleet not fit for flight"), _(
"You lack the fleet capacity to take off with all selected ships.") );
1423 if (!
dialogue_YesNo( _(
"Fleet not fit for flight"),
"%s\n%s", _(
"The following ships in your fleet are not space worthy, are you sure you want to take off without them?"), badfleet_ships ))
1431 char message[STRMAX_SHORT];
1455 a = RNGF() * 2. * M_PI;
1459 player_rmFlag(PLAYER_LANDACK);
1460 pilot_rmFlag(
player.
p,PILOT_LANDING);
1484 dialogue_alert( _(
"Failed to save game! You should exit and check the log to see what happened and then file a bug report!") );
1520 if (pilot_isFlag(p,PILOT_DELETE))
1530 if (!pilot_isWithPlayer( p ))
1537 p->ptimer = p->landing_delay;
1538 pilot_setFlag( p, PILOT_TAKEOFF );
1558 if (!PHYSFS_exists(RESCUE_PATH))
1571 WARN( _(
"File '%s' not found!"), RESCUE_PATH );
1574 if (nlua_dobufenv(
rescue_env, buf, bufsize, RESCUE_PATH) != 0) {
1575 WARN( _(
"Error loading file: %s\n"
1577 "Most likely Lua file has improper syntax, please check"),
1578 RESCUE_PATH, lua_tostring(naevL,-1));
1588 WARN( _(
"Rescue: 'rescue' : '%s'"), lua_tostring(naevL,-1));
1647 commodity_exchange_cleanup();
Provides macros to work with dynamic arrays.
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
void cam_setTargetPilot(unsigned int follow, int soft_over)
Sets the target to follow.
void credits2str(char *str, credits_t credits, int decimals)
Converts credits to a usable string for displaying.
void tonnes2str(char *str, int tonnes)
Converts tonnes to a usable string for displaying.
void dialogue_alert(const char *fmt,...)
Displays an alert popup with only an ok button and a message.
void dialogue_msgRaw(const char *caption, const char *msg)
Opens a dialogue window with an ok button and a fixed message.
int dialogue_YesNo(const char *caption, const char *fmt,...)
Runs a dialogue with both yes and no options.
void effect_clear(Effect **efxlist)
Clears an effect list, removing all active effects.
void equipment_slotDeselect(CstSlotWidget *wgt)
Deselects equipment stuff.
void equipment_cleanup(void)
Cleans up after the equipment stuff.
void equipment_updateOutfits(unsigned int wid, const char *str)
Updates the player's outfit list.
void equipment_updateShips(unsigned int wid, const char *str)
Updates the player's ship window.
void equipment_open(unsigned int wid)
Opens the player's equipment window.
void events_trigger(EventTrigger_t trigger)
Runs all the events matching a trigger.
const glTexture * faction_logo(int f)
Gets the faction's logo (ideally 256x256).
const char * faction_name(int f)
Gets a factions "real" (internal) name.
int gl_printHeightRaw(const glFont *ft_font, const int width, const char *text)
Gets the height of a non-formatted string.
void gui_setSystem(void)
Player just changed their system.
void gui_setNav(void)
Player just changed their nav computer target.
void player_message(const char *fmt,...)
Adds a mesg to the queue to be displayed on screen.
int hooks_run(const char *stack)
Runs all the hooks of stack.
unsigned int hook_addFunc(int(*func)(void *), void *data, const char *stack)
Adds a function hook to be run.
void bar_regen(void)
Regenerates the bar list.
static void land_changeTab(unsigned int wid, const char *wgt, int old, int tab)
Saves the last place the player was.
void land_queueTakeoff(void)
Queue a takeoff.
static int land_takeoff_nosave
static int land_windowsMap[LAND_NUMWINDOWS]
void takeoff(int delay, int nosave)
Makes the player take off if landed.
static void misn_autonav(unsigned int wid, const char *str)
Autonav to selected mission.
static void land_cleanupWindow(unsigned int wid, const char *name)
Cleans up the land window.
static void bar_close(unsigned int wid, const char *str)
Closes the mission computer window.
#define VISITED_EQUIPMENT
static unsigned int * land_windows
static void bar_update(unsigned int wid, const char *str)
Updates the missions in the spaceport bar.
static int mission_ncomputer
int land_setWindow(int window)
Sets the land window tab.
static void bar_approach(unsigned int wid, const char *str)
Approaches guy in mission computer.
unsigned int land_getWid(int window)
Gets the WID of a window by type.
static void land_stranded(void)
Runs the rescue script if players are stuck.
static void spaceport_buyMap(unsigned int wid, const char *str)
Buys a local system map.
#define VISITED_COMMODITY
static void misn_open(unsigned int wid)
Opens the mission computer window.
void land_cleanup(void)
Cleans up some land-related variables.
static Mission * mission_computer
int land_doneLoading(void)
Check to see if finished loading.
void land(Spob *p, int load)
Opens up all the land dialogue stuff.
static int bar_genList(unsigned int wid)
Generates the mission list for the bar.
void land_errDialogueBuild(const char *fmt,...)
Generates error dialogues used by several landing tabs.
static int news_load(void)
Loads the news.
void land_exit(void)
Exits all the landing stuff.
static void bar_getDim(int wid, int *w, int *h, int *iw, int *ih, int *bw, int *bh)
Gets the dimensions of the spaceport bar window.
void land_genWindows(int load)
Recreates the land windows.
void land_updateMainTab(void)
Adds the "Buy Local Map" button if needed and updates info.
static unsigned int land_visited
static void bar_open(unsigned int wid)
Opens the spaceport bar window.
void land_errClear(void)
Clear error dialogues.
int land_canSave(void)
Whether or not the player can save.
static glTexture * mission_portrait
static void land_setupTabs(void)
Sets up the tabs for the window.
void land_buttonTakeoff(unsigned int wid, const char *unused)
Wrapper for takeoff mission button.
void land_refuel(void)
Refuels the player's current ship, if possible.
static glTexture * gfx_exterior
static void misn_update(unsigned int wid, const char *str)
Updates the mission list.
int land_errDisplay(void)
Displays an error if applicable.
static int land_gc(void *unused)
Runs Lua garbage collection.
static void misn_accept(unsigned int wid, const char *str)
Accepts the selected mission.
static void land_createMainTab(unsigned int wid)
Creates the main tab.
static void misn_genList(unsigned int wid, int first)
Generates the mission list.
static nlua_env rescue_env
void outfits_regenList(unsigned int wid, const char *str)
Regenerates the outfit list.
int outfit_canBuy(const Outfit *outfit, int wid)
Checks to see if the player can buy the outfit.
void outfits_cleanup(void)
Cleans up outfit globals.
void outfits_open(unsigned int wid, const Outfit **outfits, int blackmarket)
Opens the outfit exchange center window.
void outfits_update(unsigned int wid, const char *str)
Updates the outfits in the outfit window.
void shipyard_open(unsigned int wid)
Opens the shipyard window.
void shipyard_cleanup(void)
Cleans up shipyard data.
void shipyard_update(unsigned int wid, const char *str)
Updates the ships in the shipyard window.
void commodity_exchange_open(unsigned int wid)
Opens the local market window.
void commodity_update(unsigned int wid, const char *str)
Updates the commodity window.
int mission_accept(Mission *mission)
Small wrapper for misn_run.
Mission * missions_genList(int *n, int faction, const Spob *pnt, const StarSystem *sys, MissionAvailability loc)
Generates a mission list. This runs create() so won't work with all missions.
void mission_cleanup(Mission *misn)
Cleans up a mission.
const StarSystem * mission_sysComputerMark(const Mission *misn)
Marks the system of the computer mission to reflect where it will head to.
void mission_sysMark(void)
Marks all active systems that need marking.
void missions_run(MissionAvailability loc, int faction, const Spob *pnt, const StarSystem *sys)
Runs missions matching location, all Lua side and one-shot.
int music_choose(const char *situation)
Actually runs the music stuff, based on situation.
int naev_isQuit(void)
Get if Naev is trying to quit.
Header file with generic functions and naev-specifics.
void * ndata_read(const char *path, size_t *filesize)
Reads a file from the ndata (will be NUL terminated).
int * generate_news(int faction)
Generates news from newslist from specific faction AND Generic news.
void news_widget(unsigned int wid, int x, int y, int w, int h)
Creates a news widget.
int nlua_loadStandard(nlua_env env)
Loads the standard Naev Lua API.
int nlua_loadTk(nlua_env env)
Loads the Toolkit Lua library.
const char * npc_getDesc(int i)
Gets the NPC description.
void npc_generateMissions(void)
Generates the bar missions.
glTexture * npc_getTexture(int i)
Get the texture of an NPC.
int npc_approach(int i)
Approaches the NPC.
void npc_clear(void)
Cleans up the spaceport bar NPC.
int npc_getArraySize(void)
Get the size of the npc array.
glTexture * npc_getBackground(int i)
Get the background of an NPC.
int npc_isImportant(int i)
Checks to see if the NPC is important or not.
const char * npc_getName(int i)
Get the name of an NPC.
void npc_sort(void)
Sorts the NPCs.
int scnprintf(char *text, size_t maxlen, const char *fmt,...)
Like snprintf(), but returns the number of characters ACTUALLY "printed" into the buffer....
ntime_t ntime_create(int scu, int stp, int stu)
Creates a time structure.
char * ntime_pretty(ntime_t t, int d)
Gets the time in a pretty human readable format.
void ntime_inc(ntime_t t)
Sets the time relatively.
glTexture * gl_dupTexture(const glTexture *texture)
Duplicates a texture.
glTexture ** gl_addTexArray(glTexture **tex, glTexture *t)
Adds an element to a texture array.
glTexture * gl_newImage(const char *path, const unsigned int flags)
Loads an image as a texture.
void gl_freeTexture(glTexture *texture)
Frees a texture.
const Outfit * outfit_get(const char *name)
Gets an outfit by name.
void pilots_clean(int persist)
Cleans up the pilot stack - leaves the player.
void pilot_setAccel(Pilot *p, double accel)
Sets the pilot's accel.
void pilot_setTurn(Pilot *p, double turn)
Sets the pilot's turn.
Pilot *const * pilot_getAll(void)
Gets the pilot stack.
void pilot_heatReset(Pilot *p)
Resets a pilot's heat.
void pilot_healLanded(Pilot *pilot)
Cures the pilot as if he was landed.
void pilot_outfitLOntakeoff(Pilot *pilot)
Runs Lua outfits when pilot takes off from a spob.
void pilot_calcStats(Pilot *pilot)
Recalculates the pilot's stats based on his outfits.
int pilot_reportSpaceworthy(const Pilot *p, char *buf, int bufSize)
Pilot safety report - makes sure stats are safe.
void pilot_outfitLOnland(Pilot *pilot)
Runs Lua outfits when pilot lands on a spob.
int pilot_isSpaceworthy(const Pilot *p)
Pilot safety check - makes sure stats are safe.
void pilot_outfitLInitAll(Pilot *pilot)
Runs the pilot's Lua outfits init script.
int player_addOutfit(const Outfit *o, int quantity)
Adds an outfit to the player outfit stack.
void player_warp(double x, double y)
Warps the player to the new position.
const PlayerShip_t * player_getShipStack(void)
Gets the array (array.h) of the player's ships.
void player_hyperspacePreempt(int preempt)
Enables or disables jump points preempting spobs in autoface and target clearing.
double player_dt_default(void)
Returns the player's total default time delta based on time dilation stuff.
int player_addEscorts(void)
Adds the player's escorts.
void player_soundStop(void)
Stops playing player sounds.
credits_t player_modCredits(credits_t amount)
Modifies the amount of credits the player has.
void player_targetSpobSet(int id)
Sets the player's target spob.
void player_autonavResetSpeed(void)
Resets the game speed.
void player_autonavStart(void)
Starts autonav.
void pfleet_update(void)
Updates the used fleet capacity of the player.
int save_all(void)
Saves the current game.
void sound_stopAll(void)
Stops all the playing voices.
void space_init(const char *sysname, int do_simulate)
Initializes the system.
void spob_updateLand(Spob *p)
Updates the land possibilities of 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.
Represents an active mission.
A ship outfit, depends radically on the type.
The representation of an in-game pilot.
unsigned int landed_times
unsigned int landed_times
Represents a Space Object (SPOB), including and not limited to planets, stations, wormholes,...
Abstraction for rendering sprite sheets.