28#include "land_outfits.h"
38#include "player_fleet.h"
39#include "pilot_outfit.h"
42#include "tk/toolkit_priv.h"
48#define EQUIPMENT_SHIPS "iarAvailShips"
49#define EQUIPMENT_OUTFIT_TAB "tabOutfits"
50#define EQUIPMENT_OUTFITS "iarAvailOutfits"
51#define EQUIPMENT_FILTER "inpFilterOutfits"
55#define BUTTON_WIDTH 200
56#define BUTTON_HEIGHT 40
69static nlua_env autoequip_env = LUA_NOREF;
77 int *sw,
int *sh,
int *ow,
int *oh,
79 int *cw,
int *ch,
int *bw,
int *bh );
85static void equipment_toggleDeploy(
unsigned int wid,
const char *wgt );
98 double x,
double y,
double w,
double h,
double rx,
double ry,
void *data );
100static char eq_qCol(
double cur,
double base,
int inv );
112static void equipment_outfitPopdown(
unsigned int wid,
const char* str );
126 int id, active, minimal, n, nfits;
131 active = window_tabWinGetActive( wid, EQUIPMENT_OUTFIT_TAB );
132 id = toolkit_getImageArrayPos( wid, EQUIPMENT_OUTFITS );
144 case OUTFIT_SLOT_STRUCTURE:
147 case OUTFIT_SLOT_UTILITY:
150 case OUTFIT_SLOT_WEAPON:
161 for (
int i=0; i<n; i++) {
167 if (o->
slot.
size == OUTFIT_SLOT_SIZE_NA)
178 if (slots[minimal].outfit != NULL)
188 if (o->
limit != NULL) {
190 for (
int i=0; i<n; i++) {
196 if (o->
slot.
size == OUTFIT_SLOT_SIZE_NA)
200 if ((slots[i].outfit == NULL) || (slots[i].outfit->limit == NULL))
204 if (strcmp(slots[i].outfit->limit,o->
limit)!=0)
222 size = OUTFIT_SLOT_SIZE_NA;
224 for (
int i=0; i<n; i++) {
226 if (slots[i].outfit != NULL)
234 if (o->
slot.
size == OUTFIT_SLOT_SIZE_NA)
238 if ((size == OUTFIT_SLOT_SIZE_NA) || (slots[i].sslot->slot.size < size)){
257 int *sw,
int *sh,
int *ow,
int *oh,
259 int *cw,
int *ch,
int *bw,
int *bh )
266 ssw = 550 + (*w - LAND_WIDTH);
291 *bw = (*w - 20 - (sw!=NULL?*sw:0) - 40 - 20 - 60) / 5;
301 int w,h, sw,sh, ow,oh, bw,bh, ew,eh, cw,ch, x,y;
302 unsigned int *widptr;
308 land_tabGenerate(LAND_WINDOW_EQUIPMENT);
316 &ew, &eh, &cw, &ch, &bw, &bh );
321 window_addButtonKey( wid, x, y,
322 bw, bh,
"btnCloseEquipment",
325 window_addButtonKey( wid, x, y,
326 bw, bh,
"btnSellShip",
329 window_addButtonKey( wid, x, y,
330 bw, bh,
"btnChangeShip",
333 window_addButtonKey( wid, x, y,
334 bw, bh,
"btnUnequipShip",
337 window_addButtonKey( wid, x, y,
338 bw, bh,
"btnAutoequipShip",
342 for (
int i=0; i<OUTFIT_TABS; i++) {
343 toolkit_initImageArrayData( &
iar_data[i] );
358 window_addText( wid, x, y,
359 130, y-20+h-bh, 0,
"txtSDesc", &
gl_defFont, &cFontGrey, NULL );
360 window_addText( wid, x, y,
361 w-x-128-30, y-20+h-bh, 0,
"txtAcquired", &
gl_defFont, NULL, NULL );
363 window_addText( wid, x, y,
364 w-x-20-128-20, y-20+h-bh, 0,
"txtDDesc", &
gl_defFont, NULL, NULL );
367 window_addText( wid, 30, -20,
369 window_addText( wid, 30, -40-sh-20,
378 window_addCheckbox( wid, x, y, cw, 30,
"chkDeploy", _(
"Deployed"), equipment_toggleDeploy, 0 );
382 window_addButtonKey( wid, x, y, 128+8, bh,
"btnRenameShip",
385 window_addButtonKey( wid, x, y, 128+8, bh,
"btnShipMode",
400 window_addCust( wid, -20-(128-cw)/2, -20-150, cw, ch,
"cstMisc", 0,
405 widptr = malloc(
sizeof(
unsigned int));
407 window_addRect( wid, -20+4, -40+4, 128+8, 128+8,
"rctShip", &cBlack, 1 );
408 window_addCust( wid, -20, -40, 128, 128,
"cstShip", 0,
410 window_custSetDynamic( wid,
"cstShip", 1 );
412 window_custAutoFreeData( wid,
"cstShip" );
430 double x,
double y,
double w,
double h,
437 window_addCust( wid, x, y, w, h,
"cstEquipment", 0,
439 window_custSetClipping( wid,
"cstEquipment", 0 );
450 const glColour *
c, *dc, *rc;
458 if ((o != NULL) && (lst[0].sslot->slot.type == o->
slot.
type))
463 x-15., y+h+10.,
c, -1., txt );
471 if (lst[i].sslot->locked && (lst[i].
outfit == NULL))
502 if (lst[i].outfit != NULL) {
507 else if ((o != NULL) &&
508 (lst[i].sslot->slot.type == o->
slot.
type)) {
511 glUseProgram( shaders.status.program );
512 glUniform1f( shaders.status.paramf, ok );
519 if (lst[i].sslot->locked)
521 else if (lst[i].sslot->required)
523 else if (lst[i].sslot->exclusive)
525 else if (lst[i].sslot->slot.spid != 0)
536 icon =
sp_icon( lst[i].sslot->slot.spid );
543 if (icon->
flags & OPENGL_TEX_SDF)
566 double *w,
double *h,
int *n,
int *m )
573 th = bh / (double)tm;
575 s =
MIN( th, tw ) - 20.;
611 selected = wgt->
slot;
618 x = bx + (tw-w)/2 + 2*tw;
619 y = by + bh - (h+20) + (h+20-h)/2;
621 p->outfit_structure, _(
"Structure"),
622 selected, wgt->
outfit, p, wgt );
627 y = by + bh - (h+20) + (h+20-h)/2;
629 p->outfit_utility, _(
"Utility"),
630 selected, wgt->
outfit, p, wgt );
635 y = by + bh - (h+20) + (h+20-h)/2;
637 p->outfit_weapon, _(
"Weapon"),
638 selected, wgt->
outfit, p, wgt );
667 y = by + bh - 30 - h;
675 toolkit_drawRect( x + w * percent, y - 2, w * (1.-percent), h + 4, &cBlack, NULL );
686 percent = (p->cpu_max > 0) ?
CLAMP(0., 1., (
double)p->cpu / (
double)p->cpu_max) : 0.;
688 toolkit_drawRect( x + w * percent, y - 2, w * (1.-percent), h + 4, &cRed, NULL );
697 percent = (p->stats.engine_limit > 0) ?
CLAMP(0., 1.,
698 (p->stats.engine_limit - p->solid.mass) / p->stats.engine_limit) : 0.;
700 toolkit_drawRect( x + w * percent, y - 2, w * (1.-percent), h + 4, &cOrange, NULL );
703 &cFontWhite,
"%.0f / %.0f", p->stats.engine_limit - p->solid.mass, p->stats.engine_limit );
706 if (p->stats.engine_limit > 0. && p->solid.mass > p->stats.engine_limit) {
708 x, y, &cFontRed, _(
"!! %.0f%% Slower !!"),
709 (1. - p->speed / p->speed_base) * 100);
728 int text_width, yoff;
736 if (lst[i].sslot->locked && (lst[i].
outfit == NULL))
739 if (lst[i].outfit != NULL) {
747 if ((i==mover) || subtitle) {
751 if (lst[i].sslot->locked) {
753 display = _(
"Locked");
756 else if (lst[i].outfit != NULL) {
762 display = _(
"Right click to remove");
766 else if ((wgt->
outfit != NULL) &&
773 display = _(
"Right click to add");
778 else if (lst[i].outfit != NULL) {
782 if (display != NULL) {
842 x = bx + (tw-w)/2 + 2*tw;
843 y = by + bh - (h+20) + (h+20-h)/2;
845 p->outfit_structure, mover, wgt );
848 y = by + bh - (h+20) + (h+20-h)/2;
850 p->outfit_utility, mover, wgt );
853 y = by + bh - (h+20) + (h+20-h)/2;
855 p->outfit_weapon, mover, wgt );
876 pos +=
scnprintf( &alt[pos],
sizeof(alt)-pos, _(
"#%c%s #%c%s #0slot" ),
880 pos +=
scnprintf( &alt[pos],
sizeof(alt)-pos,
882 if (slot->
sslot->
locked && (pos < (
int)
sizeof(alt)))
883 pos +=
scnprintf( &alt[pos],
sizeof(alt)-pos,
884 "#r%s#0", _(
" [locked]") );
896 if (slot->
lua_mem != LUA_NOREF) {
897 size_t slen = strlen(alt);
915 double bw,
double bh,
void *data )
922 const unsigned int *wid = data;
931 unsigned int tick = SDL_GetTicks();
943 if (p->ship->gfx_space->sw > bw) {
948 pw = p->ship->gfx_space->sw;
949 ph = p->ship->gfx_space->sh;
958 if (debug_isFlag(DEBUG_MARK_EMITTER)) {
960 double dircos, dirsin;
964 for (i=0; i<
array_size(p->ship->trail_emitters); i++) {
965 v.x = p->ship->trail_emitters[i].x_engine * dircos -
966 p->ship->trail_emitters[i].y_engine * dirsin;
967 v.y = p->ship->trail_emitters[i].x_engine * dirsin +
968 p->ship->trail_emitters[i].y_engine * dircos +
969 p->ship->trail_emitters[i].h_engine;
970 v.x *= pw / p->ship->gfx_space->sw;
971 v.y *= ph / p->ship->gfx_space->sh;
972 if (p->ship->trail_emitters[i].trail_spec->nebula)
973 gl_renderCross(px + pw/2. + v.x, py + ph/2. + v.y*M_SQRT1_2, 2., &cFontBlue);
975 gl_renderCross(px + pw/2. + v.x, py + ph/2. + v.y*M_SQRT1_2, 4., &cInert);
986 v.x *= pw / p->ship->gfx_space->sw;
987 v.y *= ph / p->ship->gfx_space->sh;
990 glUseProgram(shaders.crosshairs.program);
991 glUniform1f(shaders.crosshairs.paramf, 2.);
992 gl_renderShader( px+v.x, py+v.y, 7., 7., 0., &shaders.crosshairs, &cRadar_player, 1 );
1008 if (lst[i].sslot->locked && (lst[i].
outfit == NULL))
1012 if ((my > y) && (my < y+h+20.))
1041 if (event->type == SDL_MOUSEBUTTONDOWN) {
1044 if (event->button.button == SDL_BUTTON_LEFT) {
1046 int sel = selected + ret;
1054 else if ((event->button.button == SDL_BUTTON_RIGHT) &&
1065 if (event->button.button == SDL_BUTTON_LEFT)
1067 else if (event->button.button == SDL_BUTTON_RIGHT)
1102 double mx,
double my,
double bw,
double bh,
1103 double rx,
double ry,
void *data )
1123 if ((event->type != SDL_MOUSEBUTTONDOWN) &&
1124 (event->type != SDL_MOUSEMOTION))
1135 tw = bw / (double)n;
1139 x = (tw-w)/2 + 2*tw;
1140 y = bh - (h+20) + (h+20-h)/2 - 10;
1141 if ((mx > x-10) && (mx < x+w+10)) {
1143 p->outfit_structure, p, selected, wgt );
1145 return !!(
event->type == SDL_MOUSEBUTTONDOWN);
1149 if ((mx > x-10) && (mx < x+w+10)) {
1151 p->outfit_utility, p, selected, wgt );
1153 return !!(
event->type == SDL_MOUSEBUTTONDOWN);
1157 if ((mx > x-10) && (mx < x+w+10)) {
1159 p->outfit_weapon, p, selected, wgt );
1161 return !!(
event->type == SDL_MOUSEBUTTONDOWN);
1182 if (slot->
outfit != NULL) {
1263 int nship = 0, noutfit = 0;
1264 double offship = 0, offoutfit = 0;
1265 char *selship = NULL;
1266 const char *s = NULL;
1286 noutfit = toolkit_getImageArrayPos( wid, EQUIPMENT_OUTFITS );
1287 offoutfit = toolkit_getImageArrayOffset( wid, EQUIPMENT_OUTFITS );
1291 nship = toolkit_getImageArrayPos( wid, EQUIPMENT_SHIPS );
1292 offship = toolkit_getImageArrayOffset( wid, EQUIPMENT_SHIPS );
1293 s = toolkit_getImageArray( wid, EQUIPMENT_SHIPS );
1294 selship = strdup( s );
1303 toolkit_setImageArrayPos( wid, EQUIPMENT_OUTFITS, noutfit );
1304 toolkit_setImageArrayOffset( wid, EQUIPMENT_OUTFITS, offoutfit );
1308 toolkit_setImageArrayPos( wid, EQUIPMENT_SHIPS, nship );
1309 toolkit_setImageArrayOffset( wid, EQUIPMENT_SHIPS, offship );
1311 s = toolkit_getImageArray( wid, EQUIPMENT_SHIPS );
1312 if ((s != NULL) && (strcmp(s,selship)!=0)) {
1313 int ret = toolkit_setImageArray( wid, EQUIPMENT_SHIPS, selship );
1315 toolkit_setImageArrayPos( wid, EQUIPMENT_SHIPS, nship );
1361 if (ship_isFlag( ps->
p->
ship, SHIP_NOPLAYER )) {
1362 land_errDialogueBuild( _(
"You can not pilot the %s! The ship can only be used as an escort."), shipname );
1367 if (ship_isFlag(
player.
p->
ship, SHIP_NOESCORT )) {
1380 "You have %d tonne more cargo than the new ship can hold.",
1381 "You have %d tonnes more cargo than the new ship can hold.",
1386 if (pilot_hasDeployed(
player.
p )) {
1387 if (!
dialogue_YesNo(_(
"Recall Fighters"), _(
"This action will recall your deployed fighters. Is that OK?"))) {
1444 _(
"%.2f DPS [%.2f EPS]\n"), dps, eps );
1456 int state = window_checkboxState( wid, wgt );
1457 const char *shipname = toolkit_getImageArray( wid, EQUIPMENT_SHIPS );
1470static void equipment_toggleDeploy(
unsigned int wid,
const char *wgt )
1472 int state = window_checkboxState( wid, wgt );
1473 const char *shipname = toolkit_getImageArray( wid, EQUIPMENT_SHIPS );
1482 if (state && ship_isFlag( ps->
p->
ship, SHIP_NOESCORT )) {
1483 dialogue_msg( _(
"Invalid Escort"), _(
"You can not set your ship '%s' as an escort!"), ps->
p->
name );
1490 window_checkboxSet( wid, wgt, 1 );
1513 ImageArrayCell *cships;
1524 NULL, NULL, NULL, NULL, NULL, NULL );
1530 if (spob_hasService(
land_spob, SPOB_SERVICE_SHIPYARD))
1534 cships = calloc( nships,
sizeof(ImageArrayCell) );
1539 t =
gl_newImage( OVERLAY_GFX_PATH
"active.webp", 0 );
1542 t =
gl_newImage( OVERLAY_GFX_PATH
"favourite.webp", 0 );
1546 snprintf( r,
sizeof(r), OVERLAY_GFX_PATH
"rarity_%d.webp",
player.
p->
ship->
rarity );
1550 if (spob_hasService(
land_spob, SPOB_SERVICE_SHIPYARD)) {
1554 cships[i].image =
gl_dupTexture( ps[i-1].p->ship->gfx_store );
1555 cships[i].caption = strdup( ps[i-1].p->name );
1557 if (ps[i-1].favourite) {
1558 t =
gl_newImage( OVERLAY_GFX_PATH
"favourite.webp", 0 );
1561 if (ps[i-1].deployed) {
1562 t =
gl_newImage( OVERLAY_GFX_PATH
"fleet.webp", 0 );
1565 if (ps[i-1].p->ship->rarity > 0) {
1566 snprintf( r,
sizeof(r), OVERLAY_GFX_PATH
"rarity_%d.webp", ps[i-1].p->ship->rarity );
1573 for (
int i=0; i<nships; i++) {
1576 cships[i].alt = malloc( STRMAX );
1577 l = snprintf( &cships[i].alt[0], STRMAX, _(
"Ship Stats\n") );
1580 free( cships[i].alt );
1581 cships[i].alt = NULL;
1588 if (toolkit_simImageArrayVisibleElements(sw,sh,iconsize,iconsize) < nships)
1590 if (toolkit_simImageArrayVisibleElements(sw,sh,iconsize,iconsize) < nships)
1593 window_addImageArray( wid, 20, -40,
1594 sw, sh, EQUIPMENT_SHIPS, iconsize, iconsize,
1601static int equipment_filter(
const Outfit *o ) {
1620 const Pilot *pp = ps[j].
p;
1631 for (
int i=0; i <
array_size(p->outfits); i++) {
1638 return (o->
slot.
size==OUTFIT_SLOT_SIZE_LIGHT);
1640 return (o->
slot.
size==OUTFIT_SLOT_SIZE_MEDIUM);
1642 return (o->
slot.
size==OUTFIT_SLOT_SIZE_HEAVY);
1646static int equipment_filterWeapon(
const Outfit *o ) {
1647 return equipment_filter(o) && outfit_filterWeapon(o);
1649static int equipment_filterUtility(
const Outfit *o ) {
1650 return equipment_filter(o) && outfit_filterUtility(o);
1652static int equipment_filterStructure(
const Outfit *o ) {
1653 return equipment_filter(o) && outfit_filterStructure(o);
1655static int equipment_filterCore(
const Outfit *o ) {
1656 return equipment_filter(o) && outfit_filterCore(o);
1665 int x, y, w, h, ow, oh;
1666 int ix, iy, iw, ih, barw;
1667 const char *filtertext;
1668 int (*tabfilters[])(
const Outfit *o ) = {
1670 equipment_filterWeapon,
1671 equipment_filterUtility,
1672 equipment_filterStructure,
1673 equipment_filterCore,
1675 const char *tabnames[] = {
1676 _(
"All"), _(OUTFIT_LABEL_WEAPON), _(OUTFIT_LABEL_UTILITY), _(OUTFIT_LABEL_STRUCTURE), _(OUTFIT_LABEL_CORE)
1678 int noutfits, active;
1679 ImageArrayCell *coutfits;
1685 NULL, NULL, NULL, NULL, NULL, NULL );
1696 window_addTabbedWindow( wid, x, y + oh - 30, ow, 30,
1697 EQUIPMENT_OUTFIT_TAB, OUTFIT_TABS, tabnames, 1 );
1699 barw = window_tabWinGetBarWidth( wid, EQUIPMENT_OUTFIT_TAB );
1701 iw =
CLAMP(0, 150, ow - barw - 30);
1705 iy = y + oh - 25 - 1;
1709 WARN(_(
"Very little space on equipment outfit tabs!"));
1713 window_addButton( wid, ix+iw-30, iy, 30, 30,
"btnOutfitFilter", NULL, equipment_outfitPopdown );
1714 window_buttonCustomRender( wid,
"btnOutfitFilter", window_buttonCustomRenderGear );
1718 window_addInput( wid, ix, iy, iw, ih, EQUIPMENT_FILTER, 32, 1, NULL );
1719 inp_setEmptyText( wid, EQUIPMENT_FILTER, _(
"Filter…") );
1724 active = window_tabWinGetActive(
equipment_wid, EQUIPMENT_OUTFIT_TAB );
1737 filtertext = window_getInput(
equipment_wid, EQUIPMENT_FILTER );
1738 if (strlen(filtertext) == 0)
1751 if (toolkit_simImageArrayVisibleElements(iw,ih,iconsize,iconsize) < noutfits)
1753 if (toolkit_simImageArrayVisibleElements(iw,ih,iconsize,iconsize) < noutfits)
1756 window_addImageArray( wid, x + 4, y + 3, iw, ih,
1757 EQUIPMENT_OUTFITS, iconsize, iconsize,
1771static char eq_qCol(
double cur,
double base,
int inv )
1774 return (inv) ?
'r' :
'g';
1775 else if (cur < 0.8*base)
1776 return (inv) ?
'g' :
'r';
1783static const char*
eq_qSym(
double cur,
double base,
int inv )
1786 return (inv) ?
"!! " :
"";
1787 else if (cur < 0.8*base)
1788 return (inv) ?
"" :
"!! ";
1792#define EQ_COMP( cur, base, inv ) \
1793eq_qCol( cur, base, inv ), eq_qSym( cur, base, inv ), cur
1794#define EQ_COMP_I( cur, base, inv ) \
1795eq_qCol( cur, base, inv ), eq_qSym( cur, base, inv )
1804 char buf[STRMAX], buf_price[ECON_CRED_STRLEN];
1805 char errorReport[STRMAX_SHORT], tbuf[64];
1806 const char *shipname, *acquired;
1807 char scargo[NUM2STRLEN];
1811 int onboard, cargo, jumps, favourite, deployed, x, h, spaceworthy;
1812 int ww, wh, sw, sh, bw, bh, hacquired, hname;
1816 equipment_getDim( wid, &ww, &wh, &sw, &sh, NULL, NULL, NULL, NULL, NULL, NULL, &bw, &bh );
1824 shipname = toolkit_getImageArray( wid, EQUIPMENT_SHIPS );
1851 x = 20+sw+20+180+10;
1852 acquired = (ps->
acquired) ? ps->
acquired : _(
"You do not remember how you acquired this ship.");
1865 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"%s", _(
"Name:") );
1866 for (
int i=0; i<hname-1; i++)
1867 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1868 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Model:") );
1869 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Class:") );
1870 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Acquired Date:") );
1871 for (
int i=0; i<hacquired+1; i++)
1872 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1874 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Value:") );
1876 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Fleet Capacity:") );
1877 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Crew:") );
1878 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Mass:") );
1879 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Jump Time:") );
1880 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Accel:") );
1881 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Speed:") );
1882 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Turn:") );
1883 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Time Constant:") );
1884 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Detected at:") );
1885 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Signature:") );
1886 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Stealth at:") );
1887 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Scanning time:") );
1888 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1889 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Absorption:") );
1890 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Shield:") );
1891 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Armour:") );
1892 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Energy:") );
1893 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Cargo Space:") );
1894 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Fuel:") );
1895 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1896 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Ship Status:") );
1899 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Time Flown:") );
1900 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Jumped Times:") );
1901 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Landed Times:") );
1902 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Damage Done:") );
1903 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Damage Taken:") );
1904 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", _(
"Ships Destroyed:") );
1905 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n\n%s", _(
"Intrinsic Outfits:") );
1907 window_modifyText( wid,
"txtSDesc", buf );
1916 snprintf( tbuf,
sizeof(tbuf), _(
"Unknown") );
1919 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", tbuf );
1923 window_modifyText( wid,
"txtAcquired", acquired );
1925 for (
int i=0; i<hacquired+1; i++)
1926 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1929 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n%s", buf_price );
1932 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n#%c%s%d#0", EQ_COMP( (
int)floor(ship->
crew), ship->
ship->
crew, 0 ) );
1934 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1935 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"%s average"), nt );
1936 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1937 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"#%c%s%.0f#0 %s"),
1939 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"\n#%c%s%.0f#0 %s (max #%c%s%.0f#0 %s)"),
1943 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"\n#%c%s%.0f#0 %s"),
1944 EQ_COMP( ship->
turn*180./M_PI, ship->
ship->
turn*180./M_PI, 0 ), UNIT_ROTATION );
1950 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n\n" );
1953 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"#%c%s%s#0 %s"),
1955 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
" (#%c%s%s#0 %s)"),
1957 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1958 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"#%c%s%s#0 %s"),
1960 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
" (#%c%s%s#0 %s)"),
1962 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1963 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"#%c%s%s#0 %s"),
1965 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
" (#%c%s%s#0 %s)"),
1967 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1969 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"%s / #%c%s%s#0 %s"),
1971 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1972 l +=
scnprintf( &buf[l],
sizeof(buf)-l, _(
"%s %s (%d %s)"),
1973 num2strU(ship->
fuel_max,0), UNIT_UNIT, jumps, n_(
"jump",
"jumps", jumps ) );
1974 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1975 scnprintf( &buf[l],
sizeof(buf)-l,
"\n#%c%s#0", spaceworthy ?
'0' :
'r', errorReport );
1979 for (
int i=0; i<SHIP_CLASS_TOTAL; i++)
1981 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1985 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1987 l +=
scnprintf( &buf[l],
sizeof(buf)-l,
"\n" );
1991 window_modifyText( wid,
"txtDDesc", buf );
1996 ImageArrayCell *cells;
1999 for (
int i=0; i<ncells; i++)
2006 ty = -40-window_getTextHeight( wid,
"txtSDesc" )-10;
2007 window_addImageArray( wid, tx, ty, ww-x-128-30-10, ty-20+wh-bh-30,
"iarIntrinsic",
2008 64, 64, cells, ncells, NULL, NULL, NULL );
2017 window_checkboxSet( wid,
"chkFav", favourite );
2019 window_checkboxSet( wid,
"chkDeploy", deployed );
2023 window_disableButton( wid,
"btnSellShip" );
2024 window_disableButton( wid,
"btnChangeShip" );
2027 window_enableButton( wid,
"btnChangeShip" );
2028 window_enableButton( wid,
"btnSellShip" );
2047 active = window_tabWinGetActive( wid, EQUIPMENT_OUTFIT_TAB );
2048 i = toolkit_getImageArrayPos( wid, EQUIPMENT_OUTFITS );
2074 int m = toolkit_getListPos( wid, str );
2083static void equipment_outfitPopdownActivate(
unsigned int wid,
const char *str )
2089static void equipment_outfitPopdown(
unsigned int wid,
const char* str )
2091 const char *name =
"lstOutfitPopdown";
2092 const char *modes[] = {
2093 N_(
"Show all outfits"),
2094 N_(
"Show only outfits equipable on any of your ships"),
2095 N_(
"Show only outfits equipable on current ship"),
2096 N_(
"Show only light outfits"),
2097 N_(
"Show only medium outfits"),
2098 N_(
"Show only heavy outfits"),
2101 const size_t n =
sizeof(modes) /
sizeof(
const char*);
2109 modelist = malloc(
sizeof(modes));
2110 for (
size_t i=0; i<n; i++)
2111 modelist[i] = strdup( _(modes[i]) );
2115 window_addList( wid, x+w, y-120+h, 350, 120, name, modelist, n,
equipment_outfitMode,
equipment_outfitPopdownSelect, equipment_outfitPopdownActivate );
2130 iar_data_t old_data;
2132 toolkit_saveImageArrayData( wid, EQUIPMENT_OUTFITS, &
iar_data[old] );
2139 window_setInput(wid, EQUIPMENT_FILTER, NULL);
2146 toolkit_loadImageArrayData( wid, EQUIPMENT_OUTFITS, &old_data );
2157 const char *shipname = toolkit_getImageArray( wid, str );
2172 if (!ps->
deployed && ship_isFlag( ps->
p->
ship, SHIP_NOESCORT )) {
2173 dialogue_msg( _(
"Invalid Escort"), _(
"You can not set your ship '%s' as an escort!"), ps->
p->
name );
2182 window_checkboxSet( wid,
"chkDeploy", ps->
deployed );
2207 const char *shipname, *filtertext;
2211 shipname = toolkit_getImageArray( wid, EQUIPMENT_SHIPS );
2224 i = window_tabWinGetActive( wid, EQUIPMENT_OUTFIT_TAB );
2225 toolkit_saveImageArrayData( wid, EQUIPMENT_OUTFITS, &
iar_data[i] );
2227 filtertext = window_getInput(
equipment_wid, EQUIPMENT_FILTER );
2242 window_tabWinSetActive( wid, EQUIPMENT_OUTFIT_TAB, i );
2243 toolkit_loadImageArrayData( wid, EQUIPMENT_OUTFITS, &
iar_data[i] );
2245 window_setInput(wid, EQUIPMENT_FILTER, filtertext);
2251 toolkit_setImageArrayPos( wid, EQUIPMENT_SHIPS, 0 );
2252 toolkit_setImageArrayOffset( wid, EQUIPMENT_SHIPS, 0. );
2273 dialogue_alert( _(
"You can't unequip your ship when you have more cargo than it can hold without modifications!") );
2277 _(
"Are you sure you want to remove all equipment from your ship?"))==0)
2279 if (pilot_hasDeployed( ship )) {
2280 if (!
dialogue_YesNo(_(
"Recall Fighters"), _(
"This action will recall your deployed fighters. Is that OK?")))
2339 const char *curship;
2340 const char *file = AUTOEQUIP_PATH;
2352 if (autoequip_env == LUA_NOREF) {
2357 WARN( _(
"File '%s' not found!"), file );
2361 autoequip_env = nlua_newEnv();
2364 if (nlua_dobufenv(autoequip_env, buf, bufsize, file) != 0) {
2365 WARN(_(
"Failed to run '%s': %s"), file, lua_tostring(naevL,-1));
2368 goto autoequip_cleanup;
2375 nlua_getenv( naevL, autoequip_env,
"autoequip" );
2376 if (!lua_isfunction(naevL,-1)) {
2377 WARN(_(
"'%s' doesn't have valid required 'autoequip' function!"), file);
2379 goto autoequip_cleanup;
2382 if (nlua_pcall( autoequip_env, 1, 0 )) {
2383 WARN(_(
"'%s' failed to run required 'autoequip' function: %s"), file, lua_tostring(naevL,-1));
2385 goto autoequip_cleanup;
2407 char buf[ECON_CRED_STRLEN], *name;
2413 const char *shipname = toolkit_getImageArray( wid, EQUIPMENT_SHIPS );
2426 _(
"Are you sure you want to sell your ship %s for %s?"),
2442 name = strdup(shipname);
2451 _(
"You have sold your ship %s for %s."), name, buf );
2454 hparam[0].
type = HOOK_PARAM_SHIP;
2455 hparam[0].
u.
ship = s;
2456 hparam[1].
type = HOOK_PARAM_STRING;
2457 hparam[1].
u.
str = name;
2458 hparam[2].
type = HOOK_PARAM_SENTINEL;
2460 land_needsTakeoff( 1 );
2473 const char *shipname = toolkit_getImageArray( wid, EQUIPMENT_SHIPS );
2476 _(
"Please enter a new name for your %s:"), _(ship->
ship->
name) );
2479 if (newname == NULL)
2485 _(
"Please do not give the ship the same name as another of your ships."));
2491 ship->
name = newname;
2521 if (outfit_isProp(o,OUTFIT_PROP_UNIQUE))
2532 for (
int i=0; i<OUTFIT_TABS; i++)
Provides macros to work with dynamic arrays.
#define array_free(ptr_array)
Frees memory allocated and sets array to NULL.
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
#define array_push_back(ptr_array, element)
Adds a new element at the end of the array.
#define array_create(basic_type)
Creates a new dynamic array of ‘basic_type’.
void credits2str(char *str, credits_t credits, int decimals)
Converts credits to a usable string for displaying.
void dialogue_alert(const char *fmt,...)
Displays an alert popup with only an ok button and a message.
char * dialogue_input(const char *title, int min, int max, const char *fmt,...)
Creates a dialogue that allows the player to write a message.
void dialogue_msg(const char *caption, const char *fmt,...)
Opens a dialogue window with an ok button and a message.
int dialogue_YesNo(const char *caption, const char *fmt,...)
Runs a dialogue with both yes and no options.
void equipment_slotDeselect(CstSlotWidget *wgt)
Deselects equipment stuff.
static int equipment_creating
static const char * eq_qSym(double cur, double base, int inv)
Gets the symbol for comparing a current value vs a ship base value.
static void equipment_rightClickShips(unsigned int wid, const char *str)
Toggles deployed status.
static double equipment_dir
static int equipment_mouseInColumn(const PilotOutfitSlot *lst, double y, double h, double my)
Handles a mouse press in column.
static CstSlotWidget eq_wgt
static int equipment_playerAddOutfit(const Outfit *o, int quantity)
Wrapper to only add unique outfits.
static void equipment_shipMode(unsigned int wid, const char *str)
Toggles the ship visualization mode.
static void equipment_changeTab(unsigned int wid, const char *wgt, int old, int tab)
Ensures the tab's selected item is reflected in the ship slot list.
static iar_data_t iar_data[OUTFIT_TABS]
static void equipment_sellShip(unsigned int wid, const char *str)
Player tries to sell a ship.
static int equipment_playerRmOutfit(const Outfit *o, int quantity)
Wrapper to only remove unique outfits.
static void equipment_getDim(unsigned int wid, int *w, int *h, int *sw, int *sh, int *ow, int *oh, int *ew, int *eh, int *cw, int *ch, int *bw, int *bh)
Gets the window dimensions.
static void equipment_renderColumn(double x, double y, double w, double h, const PilotOutfitSlot *lst, const char *txt, int selected, Outfit *o, Pilot *p, const CstSlotWidget *wgt)
Renders an outfit column.
static void equipment_outfitPopdownSelect(unsigned int wid, const char *str)
void equipment_regenLists(unsigned int wid, int outfits, int ships)
Regenerates the equipment window lists.
static void equipment_renameShip(unsigned int wid, const char *str)
Renames the selected ship.
static void equipment_renderOverlayColumn(double x, double y, double h, PilotOutfitSlot *lst, int mover, CstSlotWidget *wgt)
Renders an outfit column.
void equipment_cleanup(void)
Cleans up after the equipment stuff.
static void equipment_filterOutfits(unsigned int wid, const char *str)
Handles text input in the filter input widget.
static int equipment_outfitMode
static void equipment_genLists(unsigned int wid)
Generates a new ship/outfit lists if needed.
static void equipment_rightClickOutfits(unsigned int wid, const char *str)
Handles right-click on unequipped outfit.
void equipment_updateOutfits(unsigned int wid, const char *str)
Updates the player's outfit list.
static void equipment_transChangeShip(unsigned int wid, const char *str)
Changes ship.
static void equipment_genOutfitList(unsigned int wid)
Generates the outfit list.
static void equipment_toggleFav(unsigned int wid, const char *wgt)
Handles toggling of the favourite checkbox.
static void equipment_autoequipShip(unsigned int wid, const char *str)
Does the autoequip magic on the player's ship.
void equipment_slotWidget(unsigned int wid, double x, double y, double w, double h, CstSlotWidget *data)
Creates the slot widget and initializes it.
void equipment_updateShips(unsigned int wid, const char *str)
Updates the player's ship window.
static void equipment_renderShip(double bx, double by, double bw, double bh, void *data)
Renders the ship in the equipment window.
static void equipment_calculateSlots(const Pilot *p, double bw, double bh, double *w, double *h, int *n, int *m)
Calculates the size the slots need to be for a given window.
static int equipment_mouseColumn(unsigned int wid, const SDL_Event *event, double mx, double my, double y, double h, PilotOutfitSlot *os, Pilot *p, int selected, CstSlotWidget *wgt)
Handles a mouse press in a column.
static void equipment_renderMisc(double bx, double by, double bw, double bh, void *data)
Renders the custom equipment widget.
int equipment_canSwapPlayerShip(const char *shipname)
Makes sure it's valid to change ships in the equipment view.
int equipment_shipStats(char *buf, int max_len, const Pilot *s, int dpseps, int name)
Creates and allocates a string containing the ship stats.
void equipment_addAmmo(void)
Adds all the ammo it can to the player.
static int equipment_swapSlot(unsigned int wid, Pilot *p, PilotOutfitSlot *slot)
Swaps an equipment slot.
static char eq_qCol(double cur, double base, int inv)
Gets the colour for comparing a current value vs a ship base value.
static void equipment_changeShip(unsigned int wid)
Player attempts to change ship.
int equipment_canSellPlayerShip(const char *shipname)
Makes sure it's valid to sell a ship.
static int equipment_mouseSlots(unsigned int wid, const SDL_Event *event, double x, double y, double w, double h, double rx, double ry, void *data)
Does mouse input for the custom equipment widget.
static void equipment_unequipShip(unsigned int wid, const char *str)
Unequips the player's ship.
static unsigned int equipment_wid
void equipment_open(unsigned int wid)
Opens the player's equipment window.
static Outfit ** iar_outfits[OUTFIT_TABS]
static void equipment_renderSlots(double bx, double by, double bw, double bh, void *data)
Renders the equipment slots.
static void equipment_genShipList(unsigned int wid)
Generates the ship list.
static unsigned int equipment_lastick
static void equipment_renderOverlaySlots(double bx, double by, double bw, double bh, void *data)
Renders the equipment overlay.
int escort_clearDeployed(Pilot *p)
Clears deployed escorts of a pilot.
int gl_printHeightRaw(const glFont *ft_font, const int width, const char *text)
Gets the height of a non-formatted string.
int gl_printWidthRaw(const glFont *ft_font, const char *text)
Gets the width that it would take to print some text.
int gl_printMidRaw(const glFont *ft_font, int width, double x, double y, const glColour *c, double outlineR, const char *text)
Displays text centered in position and width.
int gl_printLinesRaw(const glFont *ft_font, const int width, const char *text)
Gets the number of lines of a non-formatted string.
int gl_printMaxRaw(const glFont *ft_font, const int max, double x, double y, const glColour *c, double outlineR, const char *text)
Behaves like gl_printRaw but stops displaying text after a certain distance.
int gl_printMid(const glFont *ft_font, const int width, double x, double y, const glColour *c, const char *fmt,...)
Displays text centered in position and width.
void gui_setShip(void)
Player just upgraded their ship or modified it.
int hooks_runParam(const char *stack, const HookParam *param)
Runs all the hooks of stack.
int hooks_run(const char *stack)
Runs all the hooks of stack.
void land_errDialogueBuild(const char *fmt,...)
Generates error dialogues used by several landing tabs.
void land_errClear(void)
Clear error dialogues.
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.
int land_errDisplay(void)
Displays an error if applicable.
int outfit_altText(char *buf, int n, const Outfit *o, const Pilot *plt)
Computes the alt text for an outfit.
ImageArrayCell * outfits_imageArrayCells(const Outfit **outfits, int *noutfits, const Pilot *p, int store)
Generates image array cells corresponding to outfits.
void outfits_updateEquipmentOutfits(void)
Updates the outfitter and equipment outfit image arrays.
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 nlua_loadStandard(nlua_env env)
Loads the standard Naev Lua API.
LuaPilot * lua_pushpilot(lua_State *L, LuaPilot pilot)
Pushes a pilot on the stack.
int nlua_loadTk(nlua_env env)
Loads the Toolkit Lua library.
int num2str(char dest[NUM2STRLEN], double n, int decimals)
Converts a numeric value to a string.
int scnprintf(char *text, size_t maxlen, const char *fmt,...)
Like snprintf(), but returns the number of characters ACTUALLY "printed" into the buffer....
const char * num2strU(double n, int decimals)
Unsafe version of num2str that uses an internal buffer. Every call overwrites the return value.
char * ntime_pretty(ntime_t t, int d)
Gets the time in a pretty human readable format.
void ntime_prettyBuf(char *str, int max, ntime_t t, int d)
Gets the time in a pretty human readable format filling a preset buffer.
void gl_renderShader(double x, double y, double w, double h, double r, const SimpleShader *shd, const glColour *c, int center)
Renders a simple shader.
void gl_renderRect(double x, double y, double w, double h, const glColour *c)
Renders a rectangle.
void gl_renderSDF(const glTexture *texture, double x, double y, double w, double h, const glColour *c, double angle, double outline)
SDF Texture blitting backend.
void gl_renderScale(const glTexture *texture, double bx, double by, double bw, double bh, const glColour *c)
Blits a texture scaling it.
void gl_renderScaleSprite(const glTexture *sprite, double bx, double by, int sx, int sy, double bw, double bh, const glColour *c)
Blits a scaled sprite, position is in absolute screen coordinates.
void gl_renderScaleAspect(const glTexture *texture, double bx, double by, double bw, double bh, const glColour *c)
Blits a texture scaling it to fit a rectangle, but conserves aspect ratio.
void gl_renderCross(double x, double y, double r, const glColour *c)
Renders a cross at a given position.
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_copyTexArray(glTexture **tex)
Copy a texture array.
glTexture * gl_newImage(const char *path, const unsigned int flags)
Loads an image as a texture.
void gl_getSpriteFromDir(int *x, int *y, const glTexture *t, const double dir)
Sets x and y to be the appropriate sprite for glTexture using dir.
int outfit_isLauncher(const Outfit *o)
Checks if outfit is a weapon launcher.
char outfit_slotTypeColourFont(const OutfitSlot *os)
Gets a font colour character that roughly matches an outfit slot type colour.
int outfit_fitsSlot(const Outfit *o, const OutfitSlot *s)
Checks to see if an outfit fits a slot.
int outfit_isFighterBay(const Outfit *o)
Checks if outfit is a fighter bay.
char outfit_slotSizeColourFont(const OutfitSlot *os)
Gets a font colour character that roughly matches an outfit slot size colour.
int outfit_amount(const Outfit *o)
Gets the amount an outfit can hold.
const char * slotName(const OutfitSlotType type)
const char * slotSize(const OutfitSlotSize o)
Gets the slot size as a string.
const glColour * outfit_slotSizeColour(const OutfitSlot *os)
Gets the slot size colour for an outfit slot.
ntime_t pilot_hyperspaceDelay(const Pilot *p)
Calculates the hyperspace delay for a pilot.
void pilot_dpseps(const Pilot *p, double *pdps, double *peps)
Calculates the dps and eps of a pilot.
int pilot_cargoFree(const Pilot *p)
Gets the pilot's free cargo space.
int pilot_cargoUsedMission(const Pilot *p)
Gets how much mission cargo ship has on board.
int pilot_cargoUsed(const Pilot *p)
Gets how much cargo ship has on board.
double pilot_ewScanTime(const Pilot *p)
Gets the time it takes to scan a pilot.
int pilot_getMount(const Pilot *p, const PilotOutfitSlot *w, vec2 *v)
Gets the mount position of a pilot.
int pilot_rmOutfit(Pilot *pilot, PilotOutfitSlot *s)
Removes an outfit from the pilot.
void pilot_healLanded(Pilot *pilot)
Cures the pilot as if he was landed.
int pilot_maxAmmoO(const Pilot *p, const Outfit *o)
Gets the maximum available ammo for a pilot for a specific outfit.
int pilot_slotIsToggleable(const PilotOutfitSlot *o)
Checks to see if a slot has an active outfit that can be toggleable.
void pilot_calcStats(Pilot *pilot)
Recalculates the pilot's stats based on his outfits.
void pilot_fillAmmo(Pilot *pilot)
Fills pilot's ammo completely.
int pilot_rmOutfitRaw(Pilot *pilot, PilotOutfitSlot *s)
Removes an outfit from the pilot without doing any checks.
int pilot_reportSpaceworthy(const Pilot *p, char *buf, int bufSize)
Pilot safety report - makes sure stats are safe.
int pilot_rmAmmo(Pilot *pilot, PilotOutfitSlot *s, int quantity)
Removes some ammo from the pilot stock.
const char * pilot_canEquip(const Pilot *p, const PilotOutfitSlot *s, const Outfit *o)
Checks to see if can equip/remove an outfit from a slot.
int pilot_addOutfitRaw(Pilot *pilot, const Outfit *outfit, PilotOutfitSlot *s)
Adds an outfit to the pilot, ignoring CPU or other limits.
void pilot_outfitLInitAll(Pilot *pilot)
Runs the pilot's Lua outfits init script.
void pilot_weaponSafe(Pilot *p)
Sets the weapon set as safe.
void pilot_weapSetRm(Pilot *p, int id, const PilotOutfitSlot *o)
Removes a slot from a weapon set.
void ws_copy(PilotWeaponSet dest[PILOT_WEAPON_SETS], const PilotWeaponSet src[PILOT_WEAPON_SETS])
Copies a weapon set over.
int pilot_weapSetInSet(Pilot *p, int id, const PilotOutfitSlot *o)
Checks to see if a slot is in a weapon set.
int pilot_weapSetCheck(Pilot *p, int id, const PilotOutfitSlot *o)
Checks to see if a slot is in a weapon set and usable.
void pilot_weaponAuto(Pilot *p)
Tries to automatically set and create the pilot's weapon set.
void pilot_weapSetAdd(Pilot *p, int id, const PilotOutfitSlot *o, int level)
Adds an outfit to a weapon set.
int player_nships(void)
Gets the amount of ships player has in storage.
int player_rmOutfit(const Outfit *o, int quantity)
Remove an outfit from the player's outfit stack.
int player_getOutfitsFiltered(const Outfit ***outfits, int(*filter)(const Outfit *o), const char *name)
Prepares two arrays for displaying in an image array.
void player_swapShip(const char *shipname, int move_cargo)
Swaps player's current ship with their ship named shipname.
int player_addOutfit(const Outfit *o, int quantity)
Adds an outfit to the player outfit stack.
int player_numOutfits(void)
Gets the amount of different outfits in the player outfit stack.
credits_t player_shipPrice(const char *shipname, int count_unique)
Calculates the price of one of the player's ships.
const PlayerShip_t * player_getShipStack(void)
Gets the array (array.h) of the player's ships.
void player_rmShip(const char *shipname)
Removes one of the player's ships.
PlayerShip_t * player_getPlayerShip(const char *shipname)
Gets a specific ship.
credits_t player_modCredits(credits_t amount)
Modifies the amount of credits the player has.
int player_hasShip(const char *shipname)
Sees if player has a ship of a name.
void player_shipsSort(void)
Sorts the players ships.
int player_outfitOwned(const Outfit *o)
Gets how many of the outfit the player owns.
Pilot * player_getShip(const char *shipname)
Gets a specific ship.
int pfleet_toggleDeploy(PlayerShip_t *ps, int deploy)
Toggles a player ship as deployed.
int pfleet_cargoFree(void)
Gets the total amount of free cargo space in the player's fleet.
const char * ship_classDisplay(const Ship *s)
Gets the ship's display class in human readable form.
int ss_statsListDesc(const ShipStatList *ll, char *buf, int len, int newline)
Writes the ship statistics description.
int ss_statsDesc(const ShipStats *s, char *buf, int len, int newline)
Writes the ship statistics description.
const char * sp_description(unsigned int spid)
Gets the description of a slot property (in English).
const glTexture * sp_icon(unsigned int spid)
Gets the icon associated with the slot.
const char * sp_display(unsigned int spid)
Gets the display name of a slot property (in English).
The actual hook parameter.
A ship outfit, depends radically on the type.
Stores an outfit the pilot has.
The representation of an in-game pilot.
PilotWeaponSet weapon_sets[PILOT_WEAPON_SETS]
PilotOutfitSlot * outfit_structure
PilotOutfitSlot ** outfits
PilotOutfitSlot * outfit_utility
PilotOutfitSlot * outfit_intrinsic
PilotOutfitSlot * outfit_weapon
unsigned int landed_times
unsigned int ships_destroyed[SHIP_CLASS_TOTAL]
unsigned int jumped_times
PilotWeaponSet weapon_sets[PILOT_WEAPON_SETS]
glTexture ** gfx_overlays
Abstraction for rendering sprite sheets.