naev 0.10.4
Macros | Functions | Variables
land_shipyard.c File Reference

Handles the shipyard at land. More...

#include "land_shipyard.h"
#include "array.h"
#include "cond.h"
#include "dialogue.h"
#include "hook.h"
#include "log.h"
#include "map_find.h"
#include "ndata.h"
#include "nstring.h"
#include "player.h"
#include "player_fleet.h"
#include "space.h"
#include "tk/toolkit_priv.h"
#include "toolkit.h"

Go to the source code of this file.

Macros

#define SHIP_GFX_W   256
 
#define SHIP_GFX_H   256
 

Functions

static int shipyard_canAcquire (const Ship *ship, const Spob *spob, credits_t price)
 
static void shipyard_buy (unsigned int wid, const char *str)
 Player attempts to buy a ship. More...
 
static void shipyard_trade (unsigned int wid, const char *str)
 Player attempts to buy a ship, trading the current ship in. More...
 
static void shipyard_rmouse (unsigned int wid, const char *widget_name)
 Player right-clicks on a ship. More...
 
static void shipyard_renderSlots (double bx, double by, double bw, double bh, void *data)
 Custom widget render function for the slot widget. More...
 
static void shipyard_renderSlotsRow (double bx, double by, double bw, const char *str, ShipOutfitSlot *s)
 Renders a row of ship slots. More...
 
static void shipyard_find (unsigned int wid, const char *str)
 Starts the map find with ship search selected. More...
 
void shipyard_open (unsigned int wid)
 Opens the shipyard window. More...
 
void shipyard_update (unsigned int wid, const char *str)
 Updates the ships in the shipyard window. More...
 
void shipyard_cleanup (void)
 Cleans up shipyard data. More...
 
int shipyard_canBuy (const char *shipname, const Spob *spob)
 Makes sure it's valid to buy a ship. More...
 
int can_sell (const char *shipname)
 Makes sure it's valid to sell a ship. More...
 
int can_swap (const char *shipname)
 Makes sure it's valid to change ships. More...
 
int shipyard_canTrade (const char *shipname, const Spob *spob)
 Makes sure it's valid to buy a ship, trading the old one in simultaneously. More...
 

Variables

static Ship ** shipyard_list = NULL
 
static Shipshipyard_selected = NULL
 
static glTextureshipyard_comm = NULL
 

Detailed Description

Handles the shipyard at land.

Definition in file land_shipyard.c.

Macro Definition Documentation

◆ SHIP_GFX_H

#define SHIP_GFX_H   256

Definition at line 35 of file land_shipyard.c.

◆ SHIP_GFX_W

#define SHIP_GFX_W   256

Definition at line 34 of file land_shipyard.c.

Function Documentation

◆ can_sell()

int can_sell ( const char *  shipname)

Makes sure it's valid to sell a ship.

Parameters
shipnameShip being sold.

Definition at line 477 of file land_shipyard.c.

◆ can_swap()

int can_swap ( const char *  shipname)

Makes sure it's valid to change ships.

Parameters
shipnameShip being changed to.

Definition at line 492 of file land_shipyard.c.

◆ shipyard_buy()

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

Player attempts to buy a ship.

Parameters
widWindow player is buying ship from.
strUnused.

Definition at line 391 of file land_shipyard.c.

◆ shipyard_canAcquire()

static int shipyard_canAcquire ( const Ship ship,
const Spob spob,
credits_t  price 
)
static

Definition at line 434 of file land_shipyard.c.

◆ shipyard_canBuy()

int shipyard_canBuy ( const char *  shipname,
const Spob spob 
)

Makes sure it's valid to buy a ship.

Parameters
shipnameShip being bought.
spobWhere the player is shopping.

Definition at line 466 of file land_shipyard.c.

◆ shipyard_canTrade()

int shipyard_canTrade ( const char *  shipname,
const Spob spob 
)

Makes sure it's valid to buy a ship, trading the old one in simultaneously.

Parameters
shipnameShip being bought.
spobWhere the player is shopping.

Definition at line 520 of file land_shipyard.c.

◆ shipyard_cleanup()

void shipyard_cleanup ( void  )

Cleans up shipyard data.

Definition at line 356 of file land_shipyard.c.

◆ shipyard_find()

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

Starts the map find with ship search selected.

Parameters
widWindow buying outfit from.
strUnused.

Definition at line 370 of file land_shipyard.c.

◆ shipyard_open()

void shipyard_open ( unsigned int  wid)

Opens the shipyard window.

Definition at line 58 of file land_shipyard.c.

◆ shipyard_renderSlots()

static void shipyard_renderSlots ( double  bx,
double  by,
double  bw,
double  bh,
void *  data 
)
static

Custom widget render function for the slot widget.

Definition at line 597 of file land_shipyard.c.

◆ shipyard_renderSlotsRow()

static void shipyard_renderSlotsRow ( double  bx,
double  by,
double  bw,
const char *  str,
ShipOutfitSlot s 
)
static

Renders a row of ship slots.

Definition at line 633 of file land_shipyard.c.

◆ shipyard_rmouse()

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

Player right-clicks on a ship.

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

Definition at line 381 of file land_shipyard.c.

◆ shipyard_trade()

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

Player attempts to buy a ship, trading the current ship in.

Parameters
widWindow player is buying ship from.
strUnused.

Definition at line 532 of file land_shipyard.c.

◆ shipyard_update()

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

Updates the ships in the shipyard window.

Parameters
widWindow to update the ships in.
strUnused.

Definition at line 171 of file land_shipyard.c.

Variable Documentation

◆ shipyard_comm

glTexture* shipyard_comm = NULL
static

Current comm image.

Definition at line 42 of file land_shipyard.c.

◆ shipyard_list

Ship** shipyard_list = NULL
static

Array (array.h): Available ships, valid when the shipyard image-array widget is.

Definition at line 40 of file land_shipyard.c.

◆ shipyard_selected

Ship* shipyard_selected = NULL
static

Currently selected shipyard ship.

Definition at line 41 of file land_shipyard.c.