naev 0.12.6
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 "land.h"
#include "naevpedia.h"
#include "nstring.h"
#include "player.h"
#include "slots.h"
#include "space.h"
#include "tk/toolkit_priv.h"
#include "toolkit.h"
Include dependency graph for land_shipyard.c:

Go to the source code of this file.

Data Structures

struct  CstShipSlotWidget
struct  CstShipPreview

Macros

#define SHIP_GFX_SIZE   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.
static void shipyard_trade (unsigned int wid, const char *str)
 Player attempts to buy a ship, trading the current ship in.
static void shipyard_rmouse (unsigned int wid, const char *widget_name)
 Player right-clicks on a ship.
static void shipyard_renderSlots (double bx, double by, double bw, double bh, void *data)
 Custom widget render function for the slot widget.
static void shipyard_renderSlotsRow (double bx, double by, double bw, const char *str, ShipOutfitSlot *s)
 Renders a row of ship slots.
static int shipyard_mouseSlots (unsigned int wid, const SDL_Event *event, double x, double y, double w, double h, double rx, double ry, void *data)
static void shipyard_renderSlotsOver (double bx, double by, double bw, double bh, void *data)
static void shipyard_naevpedia (unsigned int wid, const char *str)
 Starts the map find with ship search selected.
static void preview_free (void *ptr)
static void preview_render (double x, double y, double w, double h, void *data)
static int preview_mouse (unsigned int wid, const SDL_Event *event, double x, double y, double w, double h, double rx, double ry, void *data)
static void preview_focusLose (unsigned int wid, const char *wgtname)
void shipyard_open (unsigned int wid)
 Opens the shipyard window.
void shipyard_update (unsigned int wid, const char *str)
 Updates the ships in the shipyard window.
void shipyard_cleanup (void)
 Cleans up shipyard data.
static int shipyard_naevpedia_hook (void *data)
int shipyard_canBuy (const Ship *ship, const Spob *spob)
 Makes sure it's valid to buy a ship.
int shipyard_canTrade (const Ship *ship, const Spob *spob)
 Makes sure it's valid to buy a ship, trading the old one in simultaneously.

Variables

static Ship ** shipyard_list
static Shipshipyard_selected = NULL

Detailed Description

Handles the shipyard at land.

Definition in file land_shipyard.c.

Macro Definition Documentation

◆ SHIP_GFX_SIZE

#define SHIP_GFX_SIZE   256

Size of the ship preview widget.

Definition at line 32 of file land_shipyard.c.

Function Documentation

◆ preview_focusLose()

void preview_focusLose ( unsigned int wid,
const char * wgtname )
static

Definition at line 935 of file land_shipyard.c.

◆ preview_free()

void preview_free ( void * ptr)
static

Definition at line 875 of file land_shipyard.c.

◆ preview_mouse()

int preview_mouse ( unsigned int wid,
const SDL_Event * event,
double x,
double y,
double w,
double h,
double rx,
double ry,
void * data )
static

Definition at line 898 of file land_shipyard.c.

◆ preview_render()

void preview_render ( double x,
double y,
double w,
double h,
void * data )
static

Definition at line 883 of file land_shipyard.c.

◆ shipyard_buy()

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 479 of file land_shipyard.c.

◆ shipyard_canAcquire()

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

Definition at line 526 of file land_shipyard.c.

◆ shipyard_canBuy()

int shipyard_canBuy ( const Ship * ship,
const Spob * spob )

Makes sure it's valid to buy a ship.

Parameters
shipShip being bought.
spobWhere the player is shopping.

Definition at line 562 of file land_shipyard.c.

◆ shipyard_canTrade()

int shipyard_canTrade ( const Ship * ship,
const Spob * spob )

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

Parameters
shipShip being bought.
spobWhere the player is shopping.

Definition at line 574 of file land_shipyard.c.

◆ shipyard_cleanup()

void shipyard_cleanup ( void )

Cleans up shipyard data.

Definition at line 439 of file land_shipyard.c.

◆ shipyard_mouseSlots()

int shipyard_mouseSlots ( unsigned int wid,
const SDL_Event * event,
double x,
double y,
double w,
double h,
double rx,
double ry,
void * data )
static

Definition at line 794 of file land_shipyard.c.

◆ shipyard_naevpedia()

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

Starts the map find with ship search selected.

Parameters
widWindow buying outfit from.
strUnused.

Definition at line 457 of file land_shipyard.c.

◆ shipyard_naevpedia_hook()

int shipyard_naevpedia_hook ( void * data)
static

Definition at line 446 of file land_shipyard.c.

◆ shipyard_open()

void shipyard_open ( unsigned int wid)

Opens the shipyard window.

Definition at line 93 of file land_shipyard.c.

◆ shipyard_renderSlots()

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 699 of file land_shipyard.c.

◆ shipyard_renderSlotsOver()

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

Definition at line 845 of file land_shipyard.c.

◆ shipyard_renderSlotsRow()

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

Renders a row of ship slots.

Definition at line 738 of file land_shipyard.c.

◆ shipyard_rmouse()

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 469 of file land_shipyard.c.

◆ shipyard_trade()

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 598 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 232 of file land_shipyard.c.

Variable Documentation

◆ shipyard_list

Ship** shipyard_list
static
Initial value:
=
NULL

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

Definition at line 58 of file land_shipyard.c.

◆ shipyard_selected

Ship* shipyard_selected = NULL
static

Currently selected shipyard ship.

Definition at line 61 of file land_shipyard.c.