[Add] Documented board.c
This commit is contained in:
parent
4674fe7248
commit
81fd657540
45
src/board.c
45
src/board.c
@ -9,12 +9,12 @@
|
||||
#include "hook.h"
|
||||
#include "board.h"
|
||||
|
||||
#define BOARDING_WIDTH 300
|
||||
#define BOARDING_HEIGHT 200
|
||||
#define BOARDING_WIDTH 300 /** Boarding window width. */
|
||||
#define BOARDING_HEIGHT 200 /** boarding window height. */
|
||||
|
||||
extern unsigned int player_target;
|
||||
|
||||
static unsigned int board_wid = 0;
|
||||
static unsigned int board_wid = 0; /** Boarding window identifier. */
|
||||
|
||||
static void board_exit(char* str);
|
||||
static void board_stealCreds(char* str);
|
||||
@ -22,7 +22,13 @@ static void board_stealCargo(char* str);
|
||||
static int board_fail(void);
|
||||
static void board_update(void);
|
||||
|
||||
/* Attempt to board the players target. */
|
||||
/**
|
||||
* @fn void player_board(void)
|
||||
*
|
||||
* @brief Attempt to board the players target.
|
||||
*
|
||||
* Creates the window on success.
|
||||
*/
|
||||
void player_board(void) {
|
||||
Pilot* p;
|
||||
|
||||
@ -84,11 +90,23 @@ void player_board(void) {
|
||||
hook_runID(p->hook);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn void board_exit(char* str)
|
||||
*
|
||||
* @brief Closes the boarding window.
|
||||
* @param str Unused.
|
||||
*/
|
||||
static void board_exit(char* str) {
|
||||
(void)str;
|
||||
window_destroy(window_get("Boarding"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn static void board_stealCreds(char* str)
|
||||
*
|
||||
* @brief Attempt to steal the boarding ships credits.
|
||||
* @param str Unused.
|
||||
*/
|
||||
static void board_stealCreds(char* str) {
|
||||
(void)str;
|
||||
Pilot* p;
|
||||
@ -109,6 +127,12 @@ static void board_stealCreds(char* str) {
|
||||
player_message("You manage to steal the ship's Scred.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn static void board_stealCargo(char* str)
|
||||
*
|
||||
* @breif Attempt to steal the boarded ships cargo.
|
||||
* @param str Unused.
|
||||
*/
|
||||
static void board_stealCargo(char* str) {
|
||||
(void)str;
|
||||
int q;
|
||||
@ -141,7 +165,12 @@ static void board_stealCargo(char* str) {
|
||||
player_message("You manage to steal the ship's cargo.");
|
||||
}
|
||||
|
||||
/* Failed to board. */
|
||||
/**
|
||||
* @fn static int board_fail(void)
|
||||
*
|
||||
* @brief Check to see if the hijack attempt failed.
|
||||
* @return 1 on failure to board. Otherwise 0.
|
||||
*/
|
||||
static int board_fail(void) {
|
||||
Pilot* p;
|
||||
|
||||
@ -164,7 +193,11 @@ static int board_fail(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Update the cargo and credit fields. */
|
||||
/**
|
||||
* @fn static void board_update(void)
|
||||
*
|
||||
* @brief Updates the boarding window fields.
|
||||
*/
|
||||
static void board_update(void) {
|
||||
int i;
|
||||
char str[128], buf[32];
|
||||
|
Loading…
Reference in New Issue
Block a user