[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");
|
||||
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_modifyText(secondary_wid, "txtDescription", ship->description);
|
||||
|
||||
@ -625,7 +628,12 @@ static void shipyard_yoursUpdate(char* str) {
|
||||
int price;
|
||||
|
||||
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);
|
||||
loc = player_getLoc(ship->name);
|
||||
price = shipyard_yoursTransportPrice(shipname);
|
||||
|
@ -1309,6 +1309,11 @@ char** player_ships(int* nships) {
|
||||
return shipnames;
|
||||
}
|
||||
|
||||
// Return the amount of ships player has in storage.
|
||||
int player_nships(void) {
|
||||
return player_nstack;
|
||||
}
|
||||
|
||||
// Return a specific ship.
|
||||
Pilot* player_getShip(char* shipname) {
|
||||
int i;
|
||||
|
@ -48,7 +48,9 @@ const char* player_rating(void);
|
||||
int player_outfitOwned(const char* outfitname);
|
||||
int player_cargoOwned(const char* commodityname);
|
||||
|
||||
// Pilot ships.
|
||||
char** player_ships(int* nships);
|
||||
int player_nships(void);
|
||||
Pilot* player_getShip(char* shipname);
|
||||
char* player_getLoc(char* shipname);
|
||||
void player_setLoc(char* shipname, char* loc);
|
||||
|
@ -820,18 +820,16 @@ static void window_render(Window* w) {
|
||||
|
||||
// Renders a button.
|
||||
static void toolkit_renderButton(Widget* btn, double bx, double by) {
|
||||
glColour* c, *dc, *oc, *lc;
|
||||
glColour* c, *dc, *lc;
|
||||
double x, y;
|
||||
(void)oc;
|
||||
|
||||
x = bx + btn->x;
|
||||
y = by + btn->y;
|
||||
|
||||
if(btn->dat.btn.disabled == 1) {
|
||||
lc = &cGrey50;
|
||||
c = &cGrey30;
|
||||
dc = &cGrey30;
|
||||
oc = &cGrey10;
|
||||
lc = &cGrey60;
|
||||
c = &cGrey20;
|
||||
dc = &cGrey40;
|
||||
} else {
|
||||
switch(btn->status) {
|
||||
// Set the color.
|
||||
@ -839,19 +837,16 @@ static void toolkit_renderButton(Widget* btn, double bx, double by) {
|
||||
lc = &cGrey80;
|
||||
c = &cGrey60;
|
||||
dc = &cGrey40;
|
||||
oc = &cGrey20;
|
||||
break;
|
||||
case WIDGET_STATUS_MOUSEOVER:
|
||||
lc = &cWhite;
|
||||
c = &cGrey80;
|
||||
dc = &cGrey60;
|
||||
oc = &cGrey40;
|
||||
break;
|
||||
case WIDGET_STATUS_MOUSEDOWN:
|
||||
lc = &cGreen;
|
||||
c = &cGreen;
|
||||
dc = &cGrey40;
|
||||
oc = &cGrey20;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -859,8 +854,13 @@ static void toolkit_renderButton(Widget* btn, double bx, double by) {
|
||||
}
|
||||
|
||||
// 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+0.6*btn->h, btn->w, 0.4*btn->h, c, NULL);
|
||||
}
|
||||
|
||||
// Inner outline.
|
||||
toolkit_drawOutline(x, y, btn->w, btn->h, 0., lc, c);
|
||||
|
Loading…
Reference in New Issue
Block a user