naev 0.12.6
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 "land.h"
#include "log.h"
#include "map.h"
#include "naevpedia.h"
#include "nlua.h"
#include "nstring.h"
#include "outfit.h"
#include "pilot_outfit.h"
#include "player.h"
#include "player_gui.h"
#include "slots.h"
#include "space.h"
#include "toolkit.h"
#include "utf8.h"
Include dependency graph for land_outfits.c:

Go to the source code of this file.

Data Structures

struct  LandOutfitData
 Data for handling the widget. More...

Macros

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

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.
static void outfits_buy (unsigned int wid, const char *str)
 Attempts to buy the outfit that is selected.
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.
static void outfits_rmouse (unsigned int wid, const char *widget_name)
 Player right-clicks on an outfit.
static void outfits_naevpedia (unsigned int wid, const char *str)
 Starts the map find with outfit search selected.
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 outfit_Popdown (unsigned int wid, const char *str)
static void outfits_genList (unsigned int wid)
 Generates the outfit list.
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.
static void outfits_onClose (unsigned int wid, const char *str)
 For when the widget closes.
static void outfit_modifiers (unsigned int wid)
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_regenList (unsigned int wid, const char *str)
 Regenerates the outfit list.
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.
void outfits_updateEquipmentOutfits (void)
 Updates the outfitter and equipment outfit image arrays.
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.
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.
static void outfit_PopdownSelect (unsigned int wid, const char *str)
static void outfit_PopdownActivate (unsigned int wid, const char *str)
static int outfit_isSold (const Outfit *outfit, int wid)
int outfit_canBuy (const Outfit *outfit, int wid)
 Checks to see if the player can buy the outfit.
int outfit_canSell (const Outfit *outfit)
 Checks to see if the player can sell the selected outfit.
void outfits_cleanup (void)
 Cleans up outfit globals.

Variables

static iar_data_t iar_data [OUTFITS_NTABS]
static Outfit ** iar_outfits [OUTFITS_NTABS]
static int outfit_Mode = 0
static PlayerOutfit_toutfits_sold
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 41 of file land_outfits.c.

◆ OUTFITS_IAR

#define OUTFITS_IAR   "iarOutfits"

Definition at line 39 of file land_outfits.c.

◆ OUTFITS_NTABS

#define OUTFITS_NTABS   7

Definition at line 42 of file land_outfits.c.

◆ OUTFITS_TAB

#define OUTFITS_TAB   "tabOutfits"

Definition at line 40 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 775 of file land_outfits.c.

◆ outfit_canBuy()

int outfit_canBuy ( const Outfit * outfit,
int wid )

Checks to see if the player can buy the outfit.

Parameters
outfitOutfit to buy.
widWindow ID of the outfitter (or -1 to ignore).

Definition at line 936 of file land_outfits.c.

◆ outfit_canSell()

int outfit_canSell ( const Outfit * outfit)

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

Parameters
outfitOutfit to try to sell.

Definition at line 1139 of file land_outfits.c.

◆ outfit_events()

int outfit_events ( unsigned int wid,
SDL_Event * evt )
static

Used to force rerenders.

Definition at line 134 of file land_outfits.c.

◆ outfit_getPrice()

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

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

Definition at line 721 of file land_outfits.c.

◆ outfit_isSold()

int outfit_isSold ( const Outfit * outfit,
int wid )
static

Definition at line 914 of file land_outfits.c.

◆ outfit_modifiers()

void outfit_modifiers ( unsigned int wid)
static

Definition at line 111 of file land_outfits.c.

◆ outfit_Popdown()

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

Definition at line 883 of file land_outfits.c.

◆ outfit_PopdownActivate()

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

Definition at line 877 of file land_outfits.c.

◆ outfit_PopdownSelect()

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

Functions for the popdown menu (filter outfits by size)

Definition at line 867 of file land_outfits.c.

◆ outfitLand_filter()

int outfitLand_filter ( const Outfit * o)
static

Ad-hoc filter functions.

Definition at line 290 of file land_outfits.c.

◆ outfitLand_filterCore()

int outfitLand_filterCore ( const Outfit * o)
static

Definition at line 341 of file land_outfits.c.

◆ outfitLand_filterStructure()

int outfitLand_filterStructure ( const Outfit * o)
static

Definition at line 337 of file land_outfits.c.

◆ outfitLand_filterUtility()

int outfitLand_filterUtility ( const Outfit * o)
static

Definition at line 333 of file land_outfits.c.

◆ outfitLand_filterWeapon()

int outfitLand_filterWeapon ( const Outfit * o)
static

Definition at line 329 of file land_outfits.c.

◆ outfits_buy()

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 1047 of file land_outfits.c.

◆ outfits_changeTab()

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 646 of file land_outfits.c.

◆ outfits_cleanup()

void outfits_cleanup ( void )

Cleans up outfit globals.

Definition at line 1287 of file land_outfits.c.

◆ outfits_filter()

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.

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 681 of file land_outfits.c.

◆ outfits_genList()

void outfits_genList ( unsigned int wid)
static

Generates the outfit list.

Parameters
widWindow to generate the list on.

Definition at line 351 of file land_outfits.c.

◆ outfits_getMod()

int outfits_getMod ( void )
static

Gets the current modifier status.

Returns
The amount modifier when buying or selling outfits.

Definition at line 1273 of file land_outfits.c.

◆ outfits_getSize()

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 87 of file land_outfits.c.

◆ outfits_imageArrayCells()

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

Generates image array cells corresponding to outfits.

Definition at line 794 of file land_outfits.c.

◆ outfits_naevpedia()

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

Starts the map find with outfit search selected.

Parameters
widWindow buying outfit from.
strUnused.

Definition at line 711 of file land_outfits.c.

◆ outfits_onClose()

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

For when the widget closes.

Definition at line 145 of file land_outfits.c.

◆ outfits_open()

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

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.
blackmarketWhether or not the outfit seller is a black market.

Definition at line 163 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 252 of file land_outfits.c.

◆ outfits_rmouse()

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 1037 of file land_outfits.c.

◆ outfits_sell()

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 1187 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 484 of file land_outfits.c.

◆ outfits_updateEquipmentOutfits()

void outfits_updateEquipmentOutfits ( void )

Updates the outfitter and equipment outfit image arrays.

Definition at line 623 of file land_outfits.c.

Variable Documentation

◆ iar_data

iar_data_t iar_data[OUTFITS_NTABS]
static

Stored image array positions.

Definition at line 52 of file land_outfits.c.

◆ iar_outfits

Outfit* * iar_outfits[OUTFITS_NTABS]
static

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

Definition at line 54 of file land_outfits.c.

◆ outfit_Mode

int outfit_Mode = 0
static

Outfit mode for filtering.

Definition at line 56 of file land_outfits.c.

◆ outfits_mod

int outfits_mod = 1
static

Definition at line 61 of file land_outfits.c.

◆ outfits_sold

PlayerOutfit_t* outfits_sold
static
Initial value:
=
NULL

List of the outfits the player sold so they can buy them back.

Definition at line 57 of file land_outfits.c.