17#include "land_outfits.h"
31#include "pilot_outfit.h"
33#include "player_gui.h"
39#define OUTFITS_IAR "iarOutfits"
40#define OUTFITS_TAB "tabOutfits"
41#define OUTFITS_FILTER "inpFilterOutfits"
42#define OUTFITS_NTABS 7
46typedef struct LandOutfitData_ {
61static int outfits_mod = 1;
66static void outfits_getSize(
unsigned int wid,
int *w,
int *h,
int *iw,
int *ih,
68static void outfits_buy(
unsigned int wid,
const char *str );
69static void outfits_sell(
unsigned int wid,
const char *str );
71static void outfits_rmouse(
unsigned int wid,
const char *widget_name );
74 int *canbuy,
int *cansell,
76static void outfit_Popdown(
unsigned int wid,
const char *str );
81static void outfit_modifiers(
unsigned int wid );
97 *iw = 680 + ( *w - LAND_WIDTH );
102 padding = 40 + 20 * 4;
106 *bw = ( *w - ( iw != NULL ? *iw : 0 ) - padding ) / 4;
108 *bh = LAND_BUTTON_HEIGHT;
111static void outfit_modifiers(
unsigned int wid )
114 if ( q != outfits_mod ) {
118 window_buttonCaption( wid,
"btnBuyOutfit", _(
"Buy" ) );
119 window_buttonCaption( wid,
"btnSellOutfit", _(
"Sell" ) );
121 char buf[STRMAX_SHORT];
122 snprintf( buf,
sizeof( buf ), _(
"Buy (%dx)" ), q );
123 window_buttonCaption( wid,
"btnBuyOutfit", buf );
124 snprintf( buf,
sizeof( buf ), _(
"Sell (%dx)" ), q );
125 window_buttonCaption( wid,
"btnSellOutfit", buf );
137 if ( ( evt->type == SDL_KEYDOWN ) || ( evt->type == SDL_KEYUP ) )
138 outfit_modifiers( wid );
149 if ( data != NULL ) {
165 int w, h, iw, ih, bw, bh, off;
175 data->outfits = outfits;
176 data->blackmarket = blackmarket;
181 if ( outfits == NULL )
182 land_tabGenerate( LAND_WINDOW_OUTFITS );
188 for (
int i = 0; i < OUTFITS_NTABS; i++ ) {
189 toolkit_initImageArrayData( &
iar_data[i] );
203 if ( data->outfits == NULL ) {
204 window_addButtonKey( wid, off, 20, bw, bh,
"btnCloseOutfits",
207 window_addButtonKey( wid, off, 20, bw, bh,
"btnCloseOutfits",
211 window_addButtonKey( wid, off, 20, bw, bh,
"btnSellOutfit", _(
"Sell" ),
214 window_addButtonKey( wid, off, 20, bw, bh,
"btnBuyOutfit", _(
"Buy" ),
217 window_addButtonKey( wid, off, 20, bw, bh,
"btnNaevpediaOutfits",
221 window_addRect( wid, -40 + 4, -40 + 4, 264, 264,
"rctImage", &cBlack, 1 );
222 window_addImage( wid, -40, -40, 256, 256,
"imgOutfit", NULL, 0 );
225 window_addText( wid, 20 + iw + 20, -40, w - ( 20 + iw + 20 ) - 264 - 40, 160,
226 0,
"txtOutfitName", &
gl_defFont, NULL, NULL );
227 window_addText( wid, 20 + iw + 20, -40 -
gl_defFont.h * 2. - 30,
228 w - ( 20 + iw + 20 ) - 264 - 40, 400, 0,
"txtDescShort",
231 window_addText( wid, 20 + iw + 20, 0, 90, 160, 0,
"txtSDesc", &
gl_defFont,
233 window_addText( wid, 20 + iw + 20 + 90, 0, w - ( 20 + iw + 20 + 90 ), 160, 0,
235 window_addText( wid, 20 + iw + 20, 0, w - ( iw + 80 ),
237 0,
"txtDescription", &
gl_defFont, NULL, NULL );
263 if ( ( data->outfits == NULL ) &&
271 tab = window_tabWinGetActive( wid, OUTFITS_TAB );
272 toolkit_saveImageArrayData( wid, OUTFITS_IAR, &
iar_data[tab] );
278 toolkit_loadImageArrayData( wid, OUTFITS_IAR, &
iar_data[tab] );
301 for (
int j = 0; j <
array_size( ps ); j++ ) {
303 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
314 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
321 return ( o->
slot.
size == OUTFIT_SLOT_SIZE_LIGHT );
323 return ( o->
slot.
size == OUTFIT_SLOT_SIZE_MEDIUM );
325 return ( o->
slot.
size == OUTFIT_SLOT_SIZE_HEAVY );
329static int outfitLand_filterWeapon(
const Outfit *o )
333static int outfitLand_filterUtility(
const Outfit *o )
337static int outfitLand_filterStructure(
const Outfit *o )
341static int outfitLand_filterCore(
const Outfit *o )
353 int ( *tabfilters[] )(
const Outfit *o ) = {
355 outfitLand_filterUtility, outfitLand_filterStructure,
356 outfitLand_filterCore, outfit_filterOther,
361 ImageArrayCell *coutfits;
364 const char *filtertext;
373 int fx, fy, fw, fh, barw;
374 const char *tabnames[] = {
376 _( OUTFIT_LABEL_WEAPON ),
377 _( OUTFIT_LABEL_UTILITY ),
378 _( OUTFIT_LABEL_STRUCTURE ),
379 _( OUTFIT_LABEL_CORE ),
384 window_addTabbedWindow( wid, 20, 20 + ih - 30, iw, 30, OUTFITS_TAB,
385 OUTFITS_NTABS, tabnames, 1 );
387 barw = window_tabWinGetBarWidth( wid, OUTFITS_TAB );
388 fw =
CLAMP( 0, 150, iw - barw - 30 );
392 fy = ih - 25 - 1 + 20;
397 window_addButton( wid, fx + fw - 30, fy, 30, 30,
"btnOutfitFilter",
398 NULL, outfit_Popdown );
399 window_buttonCustomRender( wid,
"btnOutfitFilter",
400 window_buttonCustomRenderGear );
404 window_addInput( wid, fx, fy, fw, fh, OUTFITS_FILTER, 32, 1,
406 inp_setEmptyText( wid, OUTFITS_FILTER, _(
"Filter…" ) );
412 active = window_tabWinGetActive( wid, OUTFITS_TAB );
420 filtertext = window_getInput( wid, OUTFITS_FILTER );
421 if ( strlen( filtertext ) == 0 )
439 for (
int j = 0; j <
array_size( po ); j++ ) {
440 if ( po[j].o == os->
o ) {
458 tabfilters[active], filtertext );
463 if ( !conf.big_icons ) {
464 if ( toolkit_simImageArrayVisibleElements( iw, ih - 34, iconsize,
465 iconsize ) < noutfits )
467 if ( toolkit_simImageArrayVisibleElements( iw, ih - 34, iconsize,
468 iconsize ) < noutfits )
471 window_addImageArray( wid, 20, 20, iw, ih - 34, OUTFITS_IAR, iconsize,
489 char buf[STRMAX], lbl[STRMAX], buf_credits[ECON_CRED_STRLEN],
490 buf_mass[ECON_MASS_STRLEN];
491 const char *buf_price, *summary;
494 int iw, ih, w, h, blackmarket, canbuy, cansell, sw, th;
503 blackmarket = data->blackmarket;
506 k +=
scnprintf( &lbl[k],
sizeof( lbl ) - k,
"%s", _(
"Owned:" ) );
507 k +=
scnprintf( &lbl[k],
sizeof( lbl ) - k,
"\n%s", _(
"Mass:" ) );
508 k +=
scnprintf( &lbl[k],
sizeof( lbl ) - k,
"\n%s", _(
"Price:" ) );
509 k +=
scnprintf( &lbl[k],
sizeof( lbl ) - k,
"\n%s", _(
"You have:" ) );
512 active = window_tabWinGetActive( wid, OUTFITS_TAB );
513 i = toolkit_getImageArrayPos( wid, OUTFITS_IAR );
515 window_modifyImage( wid,
"imgOutfit", NULL, 256, 256 );
516 window_disableButton( wid,
"btnBuyOutfit" );
517 window_disableButton( wid,
"btnSellOutfit" );
518 l +=
scnprintf( &buf[l],
sizeof( buf ) - l,
"%s", _(
"N/A" ) );
519 l +=
scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s", _(
"N/A" ) );
520 l +=
scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s", _(
"N/A" ) );
521 scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s", _(
"N/A" ) );
522 window_modifyText( wid,
"txtSDesc", buf );
523 window_modifyText( wid,
"txtDDesc", buf );
524 window_modifyText( wid,
"txtOutfitName", _(
"None" ) );
525 window_modifyText( wid,
"txtDescShort", NULL );
526 window_modifyText( wid,
"txtDescription", NULL );
531 -40 - th - 30 - 32 );
540 window_modifyImage( wid,
"imgOutfit", outfit->
gfx_store, 256, 256 );
543 if ( outfit->
slot.
type == OUTFIT_SLOT_INTRINSIC ) {
545 _(
"This is an intrinsic outfit that will be directly "
546 "equipped on the current ship and can not be moved." ) );
547 window_modifyText( wid,
"txtDescription", buf );
549 window_modifyText( wid,
"txtDescription", _( outfit->
desc_raw ) );
550 buf_price =
outfit_getPrice( outfit, &price, &canbuy, &cansell, &youhave );
555 window_enableButton( wid,
"btnSellOutfit" );
557 window_disableButtonSoft( wid,
"btnSellOutfit" );
560 window_enableButton( wid,
"btnBuyOutfit" );
562 window_disableButtonSoft( wid,
"btnBuyOutfit" );
572 window_modifyText( wid,
"txtOutfitName", buf );
576 l +=
scnprintf( &buf[l],
sizeof( buf ) - l,
"%d",
578 l +=
scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s", buf_mass );
579 l +=
scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s", buf_price );
580 l +=
scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s",
581 ( ( youhave ) != NULL ) ? youhave : buf_credits );
584 k +=
scnprintf( &lbl[k],
sizeof( lbl ) - k,
"\n%s", _(
"License:" ) );
586 l +=
scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s#0",
587 _(
"Not Necessary (Blackmarket)" ) );
589 l +=
scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s%s#0",
590 meets_reqs ?
"" :
"#r", _( outfit->
license ) );
592 if ( outfit->
cond ) {
596 scnprintf( &lbl[k],
sizeof( lbl ) - k,
"\n%s", _(
"Requires:" ) );
598 scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s#0",
599 _(
"Not Necessary (Blackmarket)" ) );
601 scnprintf( &buf[l],
sizeof( buf ) - l,
"\n%s%s#0",
602 meets_reqs ?
"" :
"#r", _( outfit->
condstr ) );
604 window_modifyText( wid,
"txtSDesc", lbl );
605 window_modifyText( wid,
"txtDDesc", buf );
607 window_modifyText( wid,
"txtDescShort", summary );
626 if ( spob_hasService(
land_spob, SPOB_SERVICE_OUTFITS ) ) {
629 }
else if ( !spob_hasService(
land_spob, SPOB_SERVICE_SHIPYARD ) )
652 toolkit_saveImageArrayData( wid, OUTFITS_IAR, &
iar_data[old] );
659 window_setInput( wid, OUTFITS_FILTER, NULL );
666 toolkit_loadImageArrayData( wid, OUTFITS_IAR, &old_data );
682 int ( *filter )(
const Outfit * ),
const char *name )
685 for (
int i = 0; i < n; i++ ) {
686 const Outfit *o = outfits[i];
689 if ( ( filter != NULL ) && !filter( outfits[i] ) )
693 if ( name != NULL ) {
694 if ( ( SDL_strcasestr( _( o->
name ), name ) == NULL ) &&
715 naevpedia_open(
"outfits" );
722 int *canbuy,
int *cansell,
725 static char pricestr[STRMAX_SHORT];
726 static char youhave[STRMAX_SHORT];
730 *price = outfit->
price * q;
733 if ( player_has != NULL )
740 lua_pushinteger(
naevL, q );
741 if ( nlua_pcall( outfit->
lua_env, 1, 4 ) ) {
742 WARN( _(
"Outfit '%s' failed to run '%s':\n%s" ), outfit->
name,
"price",
743 lua_tostring(
naevL, -1 ) );
747 if ( player_has != NULL )
753 str = luaL_checkstring(
naevL, -4 );
754 strncpy( pricestr, str,
sizeof( pricestr ) - 1 );
756 *canbuy = lua_toboolean(
naevL, -3 );
757 *cansell = lua_toboolean(
naevL, -2 );
758 if ( player_has != NULL ) {
759 str = luaL_optstring(
naevL, -1, NULL );
763 strncpy( youhave, str,
sizeof( youhave ) - 1 );
764 *player_has = youhave;
779 if ( outfit_isProp( o, OUTFIT_PROP_UNIQUE ) )
780 p +=
scnprintf( &buf[p], n - p,
"#o%s#0\n", _(
"Unique" ) );
781 if ( o->
limit != NULL )
782 p +=
scnprintf( &buf[p], n - p,
"#r%s#0\n",
783 _(
"Only 1 of type per ship" ) );
785 p +=
scnprintf( &buf[p], n - p,
"#o%s#0\n",
795 const Pilot *p,
int store )
797 ImageArrayCell *coutfits =
798 calloc(
MAX( 1, *noutfits ),
sizeof( ImageArrayCell ) );
800 if ( *noutfits == 0 ) {
802 coutfits[0].image = NULL;
803 coutfits[0].caption = strdup( _(
"None" ) );
807 for (
int i = 0; i < *noutfits; i++ ) {
809 if ( !outfit_gfxStoreLoaded( o ) ) {
810 outfit_setProp( o, OUTFIT_PROP_NEEDSGFX );
815 outfit_gfxStoreLoadNeeded();
820 for (
int i = 0; i < *noutfits; i++ ) {
823 const Outfit *o = outfits[i];
827 if ( !store && outfit_isProp( o, OUTFIT_PROP_UNIQUE ) )
828 coutfits[i].quantity = -1;
847 u8_inc(
typename, &sz );
848 coutfits[i].slottype = malloc( sz + 1 );
849 memcpy( coutfits[i].slottype,
typename, sz );
850 coutfits[i].slottype[sz] =
'\0';
869 int m = toolkit_getListPos( wid, str );
877static void outfit_PopdownActivate(
unsigned int wid,
const char *str )
883static void outfit_Popdown(
unsigned int wid,
const char *str )
885 const char *name =
"lstOutfitPopdown";
886 const char *modes[] = {
887 N_(
"Show all outfits" ),
888 N_(
"Show only outfits equipable on any of your ships" ),
889 N_(
"Show only outfits equipable on current ship" ),
890 N_(
"Show only light outfits" ),
891 N_(
"Show only medium outfits" ),
892 N_(
"Show only heavy outfits" ),
895 const size_t n =
sizeof( modes ) /
sizeof(
const char * );
903 modelist = malloc(
sizeof( modes ) );
904 for (
size_t i = 0; i < n; i++ )
905 modelist[i] = strdup( _( modes[i] ) );
909 window_addList( wid, x + w, y - 120 + h, 350, 120, name, modelist, n,
914static int outfit_isSold(
const Outfit *outfit,
int wid )
919 if ( ( data != NULL ) && ( data->outfits != NULL ) ) {
920 for (
int i = 0; i <
array_size( data->outfits ); i++ ) {
921 if ( data->outfits[i] == outfit )
938 int failure, canbuy, cansell;
943 int blackmarket = ( data != NULL ) ? data->blackmarket : 0;
951 if ( outfit != omap ) {
962 if ( !sold && !outfit_isSold( outfit, wid ) ) {
969 if ( outfit_isProp( outfit, OUTFIT_PROP_UNIQUE ) &&
976 if ( outfit->
slot.
type == OUTFIT_SLOT_INTRINSIC ) {
979 _(
"You can only equip one of this outfit type." ) );
985 if ( (
outfit_isMap( outfit ) && map_isUseless( outfit ) ) ||
988 _(
"You already know of everything this map contains." ) );
1004 char buf[ECON_CRED_STRLEN];
1012 _(
"You need the '%s' license to buy this outfit." ),
1017 if ( !blackmarket && ( outfit->
cond != NULL ) &&
1025 _(
"You lack the resources to buy this outfit." ) );
1056 active = window_tabWinGetActive( wid, OUTFITS_TAB );
1057 i = toolkit_getImageArrayPos( wid, OUTFITS_IAR );
1064 if ( outfit_isProp( outfit, OUTFIT_PROP_UNIQUE ) ||
1065 ( outfit->
slot.
type == OUTFIT_SLOT_INTRINSIC ) ||
1086 if ( outfit->
slot.
type == OUTFIT_SLOT_INTRINSIC )
1088 _(
"Buy Intrinsic Outfit?" ),
1089 _(
"Are you sure you wish to buy '%s'? It will be automatically "
1090 "equipped on your current ship '%s'." ),
1095 if ( outfit->
lua_buy != LUA_NOREF ) {
1096 lua_rawgeti(
naevL, LUA_REGISTRYINDEX, outfit->
lua_buy );
1097 lua_pushinteger(
naevL, q );
1098 if ( nlua_pcall( outfit->
lua_env, 1, 2 ) ) {
1099 WARN( _(
"Outfit '%s' failed to run '%s':\n%s" ), outfit->
name,
1100 "price", lua_tostring(
naevL, -1 ) );
1101 lua_pop(
naevL, 1 );
1104 int bought = lua_toboolean(
naevL, -2 );
1108 lua_pop(
naevL, 2 );
1111 q = luaL_checkinteger(
naevL, -1 );
1114 lua_pop(
naevL, 2 );
1120 hparam[0].
type = HOOK_PARAM_OUTFIT;
1122 hparam[1].
type = HOOK_PARAM_NUMBER;
1123 hparam[1].
u.
num = q;
1124 hparam[2].
type = HOOK_PARAM_SENTINEL;
1126 land_needsTakeoff( 1 );
1142 int canbuy, cansell;
1149 if ( outfit_isProp( outfit, OUTFIT_PROP_UNIQUE ) ) {
1195 active = window_tabWinGetActive( wid, OUTFITS_TAB );
1196 i = toolkit_getImageArrayPos( wid, OUTFITS_IAR );
1211 if ( outfit->
lua_sell != LUA_NOREF ) {
1213 lua_pushinteger(
naevL, q );
1214 if ( nlua_pcall( outfit->
lua_env, 1, 2 ) ) {
1215 WARN( _(
"Outfit '%s' failed to run '%s':\n%s" ), outfit->
name,
1216 "price", lua_tostring(
naevL, -1 ) );
1217 lua_pop(
naevL, 1 );
1220 int bought = lua_toboolean(
naevL, -2 );
1224 lua_pop(
naevL, 2 );
1227 q = luaL_checkinteger(
naevL, -1 );
1229 lua_pop(
naevL, 2 );
1236 hparam[0].
type = HOOK_PARAM_OUTFIT;
1238 hparam[1].
type = HOOK_PARAM_NUMBER;
1239 hparam[1].
u.
num = q;
1240 hparam[2].
type = HOOK_PARAM_SENTINEL;
1242 land_needsTakeoff( 1 );
1245 if ( !outfit_isSold( outfit, wid ) ) {
1251 if ( poi->
o == outfit ) {
1275 SDL_Keymod mods = SDL_GetModState();
1277 if ( mods & ( KMOD_LCTRL | KMOD_RCTRL ) )
1279 if ( mods & ( KMOD_LSHIFT | KMOD_RSHIFT ) )
1290 for (
int i = 0; i < OUTFITS_NTABS; i++ )
Provides macros to work with dynamic arrays.
#define array_free(ptr_array)
Frees memory allocated and sets array to NULL.
#define array_copy(basic_type, ptr_array)
Returns a shallow copy of the input array.
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 col_blend(glColour *blend, const glColour *fg, const glColour *bg, float alpha)
Blends two colours.
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 price2str(char *str, credits_t price, credits_t credits, int decimals)
Given a price and on-hand credits, outputs a colourized string.
int cond_check(const char *cond)
Checks to see if a condition is true.
void dialogue_alert(const char *fmt,...)
Displays an alert popup with only an ok button and a message.
int dialogue_YesNo(const char *caption, const char *fmt,...)
Runs a dialogue with both yes and no options.
static iar_data_t iar_data[OUTFIT_TABS]
void equipment_regenLists(unsigned int wid, int outfits, int ships)
Regenerates the equipment window lists.
void equipment_addAmmo(void)
Adds all the ammo it can to the player.
static Outfit ** iar_outfits[OUTFIT_TABS]
int gl_printHeightRaw(const glFont *ft_font, const int width, const char *text)
Gets the height of a non-formatted string.
int hooks_runParam(const char *stack, const HookParam *param)
Runs all the hooks of stack.
unsigned int land_getWid(int window)
Gets the WID of a window by type.
int land_doneLoading(void)
Check to see if finished loading.
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.
int land_errDisplay(void)
Displays an error if applicable.
static void outfits_sell(unsigned int wid, const char *str)
Attempts to sell the selected outfit the player has.
static int outfits_getMod(void)
Gets the current modifier status.
int outfit_altText(char *buf, int n, const Outfit *o, const Pilot *plt)
Computes the alt text for an outfit.
static void outfits_onClose(unsigned int wid, const char *str)
For when the widget closes.
static void outfits_genList(unsigned int wid)
Generates the outfit list.
static int outfitLand_filter(const Outfit *o)
void outfits_regenList(unsigned int wid, const char *str)
Regenerates the outfit list.
static void outfits_getSize(unsigned int wid, int *w, int *h, int *iw, int *ih, int *bw, int *bh)
Gets the size of the outfits window.
static void outfits_naevpedia(unsigned int wid, const char *str)
Starts the map find with outfit search selected.
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.
ImageArrayCell * outfits_imageArrayCells(const Outfit **outfits, int *noutfits, const Pilot *p, int store)
Generates image array cells corresponding to outfits.
static int outfit_events(unsigned int wid, SDL_Event *evt)
void outfits_open(unsigned int wid, const Outfit **outfits, int blackmarket)
Opens the outfit exchange center window.
void outfits_updateEquipmentOutfits(void)
Updates the outfitter and equipment outfit image arrays.
static void outfits_buy(unsigned int wid, const char *str)
Attempts to buy the outfit that is selected.
void outfits_update(unsigned int wid, const char *str)
Updates the outfits in the outfit window.
static PlayerOutfit_t * outfits_sold
int outfits_filter(const Outfit **outfits, int n, int(*filter)(const Outfit *), const char *name)
Applies a filter function and string to a list of outfits.
static void outfit_PopdownSelect(unsigned int wid, const char *str)
int outfit_canSell(const Outfit *outfit)
Checks to see if the player can sell the selected outfit.
static void outfits_rmouse(unsigned int wid, const char *widget_name)
Player right-clicks on an outfit.
static const char * outfit_getPrice(const Outfit *outfit, credits_t *price, int *canbuy, int *cansell, char **player_has)
Returns the price of an outfit (subject to quantity modifier)
static void outfits_changeTab(unsigned int wid, const char *wgt, int old, int tab)
Ensures the tab's selected item is reflected in the ship slot list.
Header file with generic functions and naev-specifics.
int scnprintf(char *text, size_t maxlen, const char *fmt,...)
Like snprintf(), but returns the number of characters ACTUALLY "printed" into the buffer....
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.
const char * outfit_shortname(const Outfit *o)
Gets the short name (translated) of an outfit.
const Outfit * outfit_get(const char *name)
Gets an outfit by name.
int outfit_isLauncher(const Outfit *o)
Checks if outfit is a weapon launcher.
int outfit_isLocalMap(const Outfit *o)
Checks if outfit is a local space map.
int outfit_compareTech(const void *outfit1, const void *outfit2)
Function meant for use with C89, C99 algorithm qsort().
size_t outfit_getNameWithClass(const Outfit *outfit, char *buf, size_t size)
Gets a brief name/class description suitable for the title section of an outfitter screen.
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.
int outfit_isMap(const Outfit *o)
Checks if outfit is a space map.
int outfit_isLicense(const Outfit *o)
Checks if outfit is a license.
int outfit_amount(const Outfit *o)
Gets the amount an outfit can hold.
const char * outfit_getType(const Outfit *o)
Gets the outfit's specific type.
int outfit_isGUI(const Outfit *o)
Checks if outfit is a GUI.
const char * outfit_slotName(const Outfit *o)
Gets the name of the slot type of an outfit.
glTexture * rarity_texture(int rarity)
const glColour * outfit_slotSizeColour(const OutfitSlot *os)
Gets the slot size colour for an outfit slot.
int pilot_hasOutfitLimit(const Pilot *p, const char *limit)
Checks to see if a pilot has an outfit with a specific outfit type.
int pilot_hasIntrinsic(const Pilot *pilot, const Outfit *outfit)
Gets how many copies of an intrinsic a pilot has.
const char * pilot_outfitSummary(const Pilot *p, const Outfit *o, int withname)
Gets the summary of an outfit for a give pilot.
int player_rmOutfit(const Outfit *o, int quantity)
Remove an outfit from the player's outfit stack.
int player_hasLicense(const char *license)
Checks to see if player has license.
int player_addOutfit(const Outfit *o, int quantity)
Adds an outfit to the player outfit stack.
const PlayerShip_t * player_getShipStack(void)
Gets the array (array.h) of the player's ships.
int player_outfitOwnedTotal(const Outfit *o)
credits_t player_modCredits(credits_t amount)
Modifies the amount of credits the player has.
int player_hasCredits(credits_t amount)
Checks to see if the player has enough credits.
int player_outfitOwned(const Outfit *o)
Gets how many of the outfit the player owns.
const PlayerOutfit_t * player_getOutfits(void)
Gets an array (array.h) of the player's outfits.
int player_guiCheck(const char *name)
Check if player has a GUI.
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.
union HookParam::@065274143236224234262250043114351136253171035204 u
Data for handling the widget.
A ship outfit, depends radically on the type.
union Outfit::@264277167364127137334024361374356236341374052147 u
glTexture ** gfx_overlays
The representation of an in-game pilot.
Abstraction for rendering sprite sheets.
int tech_checkOutfit(const tech_group_t *tech, const Outfit *o)
Checks to see if there is an outfit in the tech group.
Outfit ** tech_getOutfit(const tech_group_t *tech)
Gets all of the outfits associated to a tech group.