[Change] Some cosmetic changes to Shipyard.
This commit is contained in:
parent
1a994d60ad
commit
d9c0459f4b
25
src/land.c
25
src/land.c
@ -514,6 +514,10 @@ static void shipyard_update(char* str) {
|
|||||||
|
|
||||||
window_modifyText(secondary_wid, "txtDDesc", buf);
|
window_modifyText(secondary_wid, "txtDDesc", buf);
|
||||||
|
|
||||||
|
if(ship->price > player->credits)
|
||||||
|
window_disableButton(secondary_wid, "btnBuyShip");
|
||||||
|
else window_enableButton(secondary_wid, "btnBuyShip");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shipyard_info(char* str) {
|
static void shipyard_info(char* str) {
|
||||||
@ -539,6 +543,10 @@ static void shipyard_buy(char* str) {
|
|||||||
|
|
||||||
player_newShip(ship, player->solid->pos.x, player->solid->pos.y,
|
player_newShip(ship, player->solid->pos.x, player->solid->pos.y,
|
||||||
0., 0., player->solid->dir);
|
0., 0., player->solid->dir);
|
||||||
|
|
||||||
|
player->credits -= ship->price; // Auch! Paying is hard!
|
||||||
|
|
||||||
|
shipyard_update(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shipyard_yours(char* str) {
|
static void shipyard_yours(char* str) {
|
||||||
@ -610,16 +618,19 @@ static void shipyard_yoursUpdate(char* str) {
|
|||||||
char* shipname;
|
char* shipname;
|
||||||
Pilot* ship;
|
Pilot* ship;
|
||||||
char* loc;
|
char* loc;
|
||||||
|
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) return; // No ships.
|
||||||
ship = player_getShip(shipname);
|
ship = player_getShip(shipname);
|
||||||
loc = player_getLoc(ship->name);
|
loc = player_getLoc(ship->name);
|
||||||
|
price = shipyard_yoursTransportPrice(shipname);
|
||||||
|
|
||||||
// Update the image.
|
// Update the image.
|
||||||
window_modifyImage(terciary_wid, "imgTarget", ship->ship->gfx_target);
|
window_modifyImage(terciary_wid, "imgTarget", ship->ship->gfx_target);
|
||||||
|
|
||||||
credits2str(buf2, shipyard_yoursTransportPrice(shipname), 2); // Transport.
|
// Update text.
|
||||||
|
credits2str(buf2, price, 2); // Transport.
|
||||||
|
|
||||||
credits2str(buf3, 0, 2); // Sell price.
|
credits2str(buf3, 0, 2); // Sell price.
|
||||||
snprintf(buf, 256,
|
snprintf(buf, 256,
|
||||||
@ -647,6 +658,18 @@ static void shipyard_yoursUpdate(char* str) {
|
|||||||
buf4 = pilot_getOutfits(ship);
|
buf4 = pilot_getOutfits(ship);
|
||||||
window_modifyText(terciary_wid, "txtDOutfits", buf4);
|
window_modifyText(terciary_wid, "txtDOutfits", buf4);
|
||||||
free(buf4);
|
free(buf4);
|
||||||
|
|
||||||
|
// Button disabling.
|
||||||
|
if(strcmp(land_planet->name, loc)) {
|
||||||
|
// Ship not here.
|
||||||
|
window_disableButton(terciary_wid, "btnChangeShip");
|
||||||
|
if(price > player->credits)
|
||||||
|
window_disableButton(terciary_wid, "btnTransportShip");
|
||||||
|
else window_enableButton(terciary_wid, "btnTransportShip");
|
||||||
|
} else {
|
||||||
|
window_enableButton(terciary_wid, "btnChangeShip");
|
||||||
|
window_disableButton(terciary_wid, "btnTransportShip");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shipyard_yoursChange(char* str) {
|
static void shipyard_yoursChange(char* str) {
|
||||||
|
Loading…
Reference in New Issue
Block a user