naev 0.10.4
Data Structures | Macros | Functions | Variables
land_outfits.c File Reference

Handles all the landing menus and actions. More...

#include "land_outfits.h"
#include "array.h"
#include "cond.h"
#include "dialogue.h"
#include "equipment.h"
#include "hook.h"
#include "log.h"
#include "map.h"
#include "map_find.h"
#include "nstring.h"
#include "nlua.h"
#include "outfit.h"
#include "player.h"
#include "player_gui.h"
#include "slots.h"
#include "space.h"
#include "toolkit.h"
#include "utf8.h"

Go to the source code of this file.

Data Structures

struct  LandOutfitData
 

Macros

#define OUTFITS_IAR   "iarOutfits"
 
#define OUTFITS_TAB   "tabOutfits"
 
#define OUTFITS_FILTER   "inpFilterOutfits"
 
#define OUTFITS_NTABS   6
 

Functions

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. More...
 
static void outfits_buy (unsigned int wid, const char *str)
 Attempts to buy the outfit that is selected. More...
 
static void outfits_sell (unsigned int wid, const char *str)
 Attempts to sell the selected outfit the player has. More...
 
static int outfits_getMod (void)
 Gets the current modifier status. More...
 
static void outfits_renderMod (double bx, double by, double w, double h, void *data)
 Renders the outfit buying modifier. More...
 
static void outfits_rmouse (unsigned int wid, const char *widget_name)
 Player right-clicks on an outfit. More...
 
static void outfits_find (unsigned int wid, const char *str)
 Starts the map find with outfit search selected. More...
 
static const char * outfit_getPrice (const Outfit *outfit, credits_t *price, int *canbuy, int *cansell)
 Returns the price of an outfit (subject to quantity modifier) More...
 
static void outfit_Popdown (unsigned int wid, const char *str)
 
static void outfits_genList (unsigned int wid)
 Generates the outfit list. More...
 
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. More...
 
static void outfits_onClose (unsigned int wid, const char *str)
 For when the widget closes. More...
 
void outfits_open (unsigned int wid, const Outfit **outfits)
 Opens the outfit exchange center window. More...
 
void outfits_regenList (unsigned int wid, const char *str)
 Regenerates the outfit list. More...
 
static int outfitLand_filter (const Outfit *o)
 
static int outfitLand_filterWeapon (const Outfit *o)
 
static int outfitLand_filterUtility (const Outfit *o)
 
static int outfitLand_filterStructure (const Outfit *o)
 
static int outfitLand_filterCore (const Outfit *o)
 
void outfits_update (unsigned int wid, const char *str)
 Updates the outfits in the outfit window. More...
 
void outfits_updateEquipmentOutfits (void)
 Updates the outfitter and equipment outfit image arrays. More...
 
int outfits_filter (const Outfit **outfits, int n, int(*filter)(const Outfit *o), const char *name)
 Applies a filter function and string to a list of outfits. More...
 
int outfit_altText (char *buf, int n, const Outfit *o, const Pilot *plt)
 Computes the alt text for an outfit. More...
 
ImageArrayCell * outfits_imageArrayCells (const Outfit **outfits, int *noutfits, const Pilot *p)
 Generates image array cells corresponding to outfits. More...
 
static void outfit_PopdownSelect (unsigned int wid, const char *str)
 
static void outfit_PopdownActivate (unsigned int wid, const char *str)
 
int outfit_canBuy (const char *name, const Spob *spob)
 Checks to see if the player can buy the outfit. More...
 
int outfit_canSell (const char *name)
 Checks to see if the player can sell the selected outfit. More...
 
void outfits_cleanup (void)
 Cleans up outfit globals. More...
 

Variables

static iar_data_t * iar_data = NULL
 
static Outfit *** iar_outfits = NULL
 
static int outfit_Mode = 0
 
static int outfits_mod = 1
 

Detailed Description

Handles all the landing menus and actions.

Definition in file land_outfits.c.

Macro Definition Documentation

◆ OUTFITS_FILTER

#define OUTFITS_FILTER   "inpFilterOutfits"

Definition at line 39 of file land_outfits.c.

◆ OUTFITS_IAR

#define OUTFITS_IAR   "iarOutfits"

Definition at line 37 of file land_outfits.c.

◆ OUTFITS_NTABS

#define OUTFITS_NTABS   6

Definition at line 40 of file land_outfits.c.

◆ OUTFITS_TAB

#define OUTFITS_TAB   "tabOutfits"

Definition at line 38 of file land_outfits.c.

Function Documentation

◆ outfit_altText()

int outfit_altText ( char *  buf,
int  n,
const Outfit o,
const Pilot plt 
)

Computes the alt text for an outfit.

Definition at line 655 of file land_outfits.c.

◆ outfit_canBuy()

int outfit_canBuy ( const char *  name,
const Spob spob 
)

Checks to see if the player can buy the outfit.

Parameters
nameOutfit to buy.
spobWhere the player is shopping.

Definition at line 794 of file land_outfits.c.

◆ outfit_canSell()

int outfit_canSell ( const char *  name)

Checks to see if the player can sell the selected outfit.

Parameters
nameOutfit to try to sell.

Definition at line 935 of file land_outfits.c.

◆ outfit_getPrice()

static const char * outfit_getPrice ( const Outfit outfit,
credits_t *  price,
int *  canbuy,
int *  cansell 
)
static

Returns the price of an outfit (subject to quantity modifier)

Definition at line 618 of file land_outfits.c.

◆ outfit_Popdown()

static void outfit_Popdown ( unsigned int  wid,
const char *  str 
)
static

Definition at line 759 of file land_outfits.c.

◆ outfit_PopdownActivate()

static void outfit_PopdownActivate ( unsigned int  wid,
const char *  str 
)
static

Definition at line 753 of file land_outfits.c.

◆ outfit_PopdownSelect()

static void outfit_PopdownSelect ( unsigned int  wid,
const char *  str 
)
static

Functions for the popdown menu (filter outfits by size)

Definition at line 743 of file land_outfits.c.

◆ outfitLand_filter()

static int outfitLand_filter ( const Outfit o)
static

Ad-hoc filter functions.

Definition at line 255 of file land_outfits.c.

◆ outfitLand_filterCore()

static int outfitLand_filterCore ( const Outfit o)
static

Definition at line 302 of file land_outfits.c.

◆ outfitLand_filterStructure()

static int outfitLand_filterStructure ( const Outfit o)
static

Definition at line 299 of file land_outfits.c.

◆ outfitLand_filterUtility()

static int outfitLand_filterUtility ( const Outfit o)
static

Definition at line 296 of file land_outfits.c.

◆ outfitLand_filterWeapon()

static int outfitLand_filterWeapon ( const Outfit o)
static

Definition at line 293 of file land_outfits.c.

◆ outfits_buy()

static void outfits_buy ( unsigned int  wid,
const char *  str 
)
static

Attempts to buy the outfit that is selected.

Parameters
widWindow buying outfit from.
strUnused.

Definition at line 869 of file land_outfits.c.

◆ outfits_changeTab()

static void outfits_changeTab ( unsigned int  wid,
const char *  wgt,
int  old,
int  tab 
)
static

Ensures the tab's selected item is reflected in the ship slot list.

Parameters
widUnused.
wgtUnused.
oldTab changed from.
tabTab changed to.

Definition at line 547 of file land_outfits.c.

◆ outfits_cleanup()

void outfits_cleanup ( void  )

Cleans up outfit globals.

Definition at line 1082 of file land_outfits.c.

◆ outfits_filter()

int outfits_filter ( const Outfit **  outfits,
int  n,
int(*)(const Outfit *o)  filter,
const char *  name 
)

Applies a filter function and string to a list of outfits.

Parameters
outfitsArray of outfits to filter.
nNumber of outfits in the array.
filterFilter function to run on each outfit.
nameName fragment that each outfit name must contain.
Returns
Number of outfits.

Definition at line 585 of file land_outfits.c.

◆ outfits_find()

static void outfits_find ( unsigned int  wid,
const char *  str 
)
static

Starts the map find with outfit search selected.

Parameters
widWindow buying outfit from.
strUnused.

Definition at line 609 of file land_outfits.c.

◆ outfits_genList()

static void outfits_genList ( unsigned int  wid)
static

Generates the outfit list.

Parameters
widWindow to generate the list on.

Definition at line 311 of file land_outfits.c.

◆ outfits_getMod()

static int outfits_getMod ( void  )
static

Gets the current modifier status.

Returns
The amount modifier when buying or selling outfits.

Definition at line 1042 of file land_outfits.c.

◆ outfits_getSize()

static void outfits_getSize ( unsigned int  wid,
int *  w,
int *  h,
int *  iw,
int *  ih,
int *  bw,
int *  bh 
)
static

Gets the size of the outfits window.

Definition at line 73 of file land_outfits.c.

◆ outfits_imageArrayCells()

ImageArrayCell * outfits_imageArrayCells ( const Outfit **  outfits,
int *  noutfits,
const Pilot p 
)

Generates image array cells corresponding to outfits.

Definition at line 687 of file land_outfits.c.

◆ outfits_onClose()

static void outfits_onClose ( unsigned int  wid,
const char *  str 
)
static

For when the widget closes.

Definition at line 100 of file land_outfits.c.

◆ outfits_open()

void outfits_open ( unsigned int  wid,
const Outfit **  outfits 
)

Opens the outfit exchange center window.

Parameters
widWindow ID to open at.
outfitsArray (array.h): Outfits to sell. Will be freed. Set to NULL if this is the landed player store.

Definition at line 117 of file land_outfits.c.

◆ outfits_regenList()

void outfits_regenList ( unsigned int  wid,
const char *  str 
)

Regenerates the outfit list.

Parameters
widWindow to generate the list on.
strUnused.

Definition at line 217 of file land_outfits.c.

◆ outfits_renderMod()

static void outfits_renderMod ( double  bx,
double  by,
double  w,
double  h,
void *  data 
)
static

Renders the outfit buying modifier.

Parameters
bxBase X position to render at.
byBase Y position to render at.
wWidth to render at.
hHeight to render at.
dataUnused.

Definition at line 1061 of file land_outfits.c.

◆ outfits_rmouse()

static void outfits_rmouse ( unsigned int  wid,
const char *  widget_name 
)
static

Player right-clicks on an outfit.

Parameters
widWindow player is buying ship from.
widget_nameName of the window. (unused)

Definition at line 859 of file land_outfits.c.

◆ outfits_sell()

static void outfits_sell ( unsigned int  wid,
const char *  str 
)
static

Attempts to sell the selected outfit the player has.

Parameters
widWindow selling outfits from.
strUnused.

Definition at line 982 of file land_outfits.c.

◆ outfits_update()

void outfits_update ( unsigned int  wid,
const char *  str 
)

Updates the outfits in the outfit window.

Parameters
widWindow to update the outfits in.
strUnused.

Definition at line 405 of file land_outfits.c.

◆ outfits_updateEquipmentOutfits()

void outfits_updateEquipmentOutfits ( void  )

Updates the outfitter and equipment outfit image arrays.

Definition at line 523 of file land_outfits.c.

Variable Documentation

◆ iar_data

iar_data_t* iar_data = NULL
static

Stored image array positions.

Definition at line 46 of file land_outfits.c.

◆ iar_outfits

Outfit*** iar_outfits = NULL
static

C-array of Arrays: Outfits associated with the image array cells.

Definition at line 47 of file land_outfits.c.

◆ outfit_Mode

int outfit_Mode = 0
static

Outfit mode for filtering.

Definition at line 48 of file land_outfits.c.

◆ outfits_mod

int outfits_mod = 1
static

Definition at line 51 of file land_outfits.c.