[Change] Improved shipyard ui.
This commit is contained in:
parent
80ad3081f0
commit
6f7f889160
10
src/land.c
10
src/land.c
@ -497,6 +497,9 @@ static void shipyard_update(char* str) {
|
|||||||
shipname = toolkit_getList(secondary_wid, "lstShipyard");
|
shipname = toolkit_getList(secondary_wid, "lstShipyard");
|
||||||
ship = ship_get(shipname);
|
ship = ship_get(shipname);
|
||||||
|
|
||||||
|
if(player_nships()==0) window_disableButton(secondary_wid, "btnYourShips");
|
||||||
|
else window_enableButton(secondary_wid, "btnYourShips");
|
||||||
|
|
||||||
window_modifyImage(secondary_wid, "imgTarget", ship->gfx_target);
|
window_modifyImage(secondary_wid, "imgTarget", ship->gfx_target);
|
||||||
window_modifyText(secondary_wid, "txtDescription", ship->description);
|
window_modifyText(secondary_wid, "txtDescription", ship->description);
|
||||||
|
|
||||||
@ -625,7 +628,12 @@ static void shipyard_yoursUpdate(char* str) {
|
|||||||
int price;
|
int price;
|
||||||
|
|
||||||
shipname = toolkit_getList(terciary_wid, "lstYourShips");
|
shipname = toolkit_getList(terciary_wid, "lstYourShips");
|
||||||
if(strcmp(shipname, "None")==0) return; // No ships.
|
if(strcmp(shipname, "None")==0) {
|
||||||
|
// No ships.
|
||||||
|
window_disableButton(terciary_wid, "btnChangeShip");
|
||||||
|
window_disableButton(terciary_wid, "btnTransportShip");
|
||||||
|
return;
|
||||||
|
}
|
||||||
ship = player_getShip(shipname);
|
ship = player_getShip(shipname);
|
||||||
loc = player_getLoc(ship->name);
|
loc = player_getLoc(ship->name);
|
||||||
price = shipyard_yoursTransportPrice(shipname);
|
price = shipyard_yoursTransportPrice(shipname);
|
||||||
|
@ -1309,6 +1309,11 @@ char** player_ships(int* nships) {
|
|||||||
return shipnames;
|
return shipnames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return the amount of ships player has in storage.
|
||||||
|
int player_nships(void) {
|
||||||
|
return player_nstack;
|
||||||
|
}
|
||||||
|
|
||||||
// Return a specific ship.
|
// Return a specific ship.
|
||||||
Pilot* player_getShip(char* shipname) {
|
Pilot* player_getShip(char* shipname) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -48,7 +48,9 @@ const char* player_rating(void);
|
|||||||
int player_outfitOwned(const char* outfitname);
|
int player_outfitOwned(const char* outfitname);
|
||||||
int player_cargoOwned(const char* commodityname);
|
int player_cargoOwned(const char* commodityname);
|
||||||
|
|
||||||
|
// Pilot ships.
|
||||||
char** player_ships(int* nships);
|
char** player_ships(int* nships);
|
||||||
|
int player_nships(void);
|
||||||
Pilot* player_getShip(char* shipname);
|
Pilot* player_getShip(char* shipname);
|
||||||
char* player_getLoc(char* shipname);
|
char* player_getLoc(char* shipname);
|
||||||
void player_setLoc(char* shipname, char* loc);
|
void player_setLoc(char* shipname, char* loc);
|
||||||
|
@ -820,18 +820,16 @@ static void window_render(Window* w) {
|
|||||||
|
|
||||||
// Renders a button.
|
// Renders a button.
|
||||||
static void toolkit_renderButton(Widget* btn, double bx, double by) {
|
static void toolkit_renderButton(Widget* btn, double bx, double by) {
|
||||||
glColour* c, *dc, *oc, *lc;
|
glColour* c, *dc, *lc;
|
||||||
double x, y;
|
double x, y;
|
||||||
(void)oc;
|
|
||||||
|
|
||||||
x = bx + btn->x;
|
x = bx + btn->x;
|
||||||
y = by + btn->y;
|
y = by + btn->y;
|
||||||
|
|
||||||
if(btn->dat.btn.disabled == 1) {
|
if(btn->dat.btn.disabled == 1) {
|
||||||
lc = &cGrey50;
|
lc = &cGrey60;
|
||||||
c = &cGrey30;
|
c = &cGrey20;
|
||||||
dc = &cGrey30;
|
dc = &cGrey40;
|
||||||
oc = &cGrey10;
|
|
||||||
} else {
|
} else {
|
||||||
switch(btn->status) {
|
switch(btn->status) {
|
||||||
// Set the color.
|
// Set the color.
|
||||||
@ -839,19 +837,16 @@ static void toolkit_renderButton(Widget* btn, double bx, double by) {
|
|||||||
lc = &cGrey80;
|
lc = &cGrey80;
|
||||||
c = &cGrey60;
|
c = &cGrey60;
|
||||||
dc = &cGrey40;
|
dc = &cGrey40;
|
||||||
oc = &cGrey20;
|
|
||||||
break;
|
break;
|
||||||
case WIDGET_STATUS_MOUSEOVER:
|
case WIDGET_STATUS_MOUSEOVER:
|
||||||
lc = &cWhite;
|
lc = &cWhite;
|
||||||
c = &cGrey80;
|
c = &cGrey80;
|
||||||
dc = &cGrey60;
|
dc = &cGrey60;
|
||||||
oc = &cGrey40;
|
|
||||||
break;
|
break;
|
||||||
case WIDGET_STATUS_MOUSEDOWN:
|
case WIDGET_STATUS_MOUSEDOWN:
|
||||||
lc = &cGreen;
|
lc = &cGreen;
|
||||||
c = &cGreen;
|
c = &cGreen;
|
||||||
dc = &cGrey40;
|
dc = &cGrey40;
|
||||||
oc = &cGrey20;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -859,8 +854,13 @@ static void toolkit_renderButton(Widget* btn, double bx, double by) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Shaded base.
|
// Shaded base.
|
||||||
|
if(btn->dat.btn.disabled == 1) {
|
||||||
|
toolkit_drawRect(x, y, btn->w, 0.4*btn->h, dc, NULL);
|
||||||
|
toolkit_drawRect(x, y+0.4*btn->h, btn->w, 0.6*btn->h, dc, c);
|
||||||
|
} else {
|
||||||
toolkit_drawRect(x, y, btn->w, 0.6*btn->h, dc, c);
|
toolkit_drawRect(x, y, btn->w, 0.6*btn->h, dc, c);
|
||||||
toolkit_drawRect(x, y+0.6*btn->h, btn->w, 0.4*btn->h, c, NULL);
|
toolkit_drawRect(x, y+0.6*btn->h, btn->w, 0.4*btn->h, c, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
// Inner outline.
|
// Inner outline.
|
||||||
toolkit_drawOutline(x, y, btn->w, btn->h, 0., lc, c);
|
toolkit_drawOutline(x, y, btn->w, btn->h, 0., lc, c);
|
||||||
|
Loading…
Reference in New Issue
Block a user