/** * @brief Checks if should add the refuel button and does if needed. */ void land_checkAddRefuel (void) { char buf[ECON_CRED_STRLEN], cred[ECON_CRED_STRLEN]; unsigned int w; /* Check to see if fuel conditions are met. */ if (!planet_hasService(land_planet, PLANET_SERVICE_REFUEL)) { if (!widget_exists( land_windows[0], "txtRefuel" )) window_addText( land_windows[0], -20, 20 + (LAND_BUTTON_HEIGHT + 20) + 20, 200, gl_defFont.h, 1, "txtRefuel", &gl_defFont, &cBlack, "No refueling services." ); return; } /* Full fuel. */ if (player.p->fuel >= player.p->fuel_max) { if (widget_exists( land_windows[0], "btnRefuel" )) window_destroyWidget( land_windows[0], "btnRefuel" ); if (widget_exists( land_windows[0], "txtRefuel" )) window_destroyWidget( land_windows[0], "txtRefuel" ); return; } /* Autorefuel. */ if (conf.autorefuel) { spaceport_refuel( land_windows[0], "btnRefuel" ); w = land_getWid( LAND_WINDOW_EQUIPMENT ); if (w > 0) equipment_updateShips( w, NULL ); /* Must update counter. */ if (player.p->fuel >= player.p->fuel_max) return; } /* Just enable button if it exists. */ if (widget_exists( land_windows[0], "btnRefuel" )) { window_enableButton( land_windows[0], "btnRefuel"); credits2str( cred, player.p->credits, 2 ); snprintf( buf, sizeof(buf), "Credits: %s", cred ); window_modifyText( land_windows[0], "txtRefuel", buf ); } /* Else create it. */ else { /* Refuel button. */ credits2str( cred, refuel_price(), 2 ); snprintf( buf, sizeof(buf), "Refuel %s", cred ); window_addButton( land_windows[0], -20, 20 + (LAND_BUTTON_HEIGHT + 20), LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT, "btnRefuel", buf, spaceport_refuel ); /* Player credits. */ credits2str( cred, player.p->credits, 2 ); snprintf( buf, sizeof(buf), "Credits: %s", cred ); window_addText( land_windows[0], -20, 20 + 2*(LAND_BUTTON_HEIGHT + 20), LAND_BUTTON_WIDTH, gl_smallFont.h, 1, "txtRefuel", &gl_smallFont, &cBlack, buf ); } /* Make sure player can click it. */ if (!player_hasCredits( refuel_price() )) window_disableButton( land_windows[0], "btnRefuel" ); }
/** * @brief Player attempts to buy a ship, trading the current ship in. * @param wid Window player is buying ship from. * @param str Unused. */ static void shipyard_trade( unsigned int wid, char* str ) { (void)str; char *shipname, buf[ECON_CRED_STRLEN], buf2[ECON_CRED_STRLEN], buf3[ECON_CRED_STRLEN], buf4[ECON_CRED_STRLEN]; Ship* ship; shipname = toolkit_getImageArray( wid, "iarShipyard" ); if (strcmp(shipname, "None") == 0) return; ship = ship_get( shipname ); credits_t targetprice = ship_buyPrice(ship); credits_t playerprice = player_shipPrice(player.p->name); if (land_errDialogue( shipname, "tradeShip" )) return; credits2str( buf, targetprice, 2 ); credits2str( buf2, playerprice, 2 ); credits2str( buf3, targetprice - playerprice, 2 ); credits2str( buf4, playerprice - targetprice, 2 ); /* Display the correct dialogue depending on the new ship's price versus the player's. */ if ( targetprice == playerprice ) { if (dialogue_YesNo("Are you sure?", /* confirm */ "Your %s is worth %s, exactly as much as the new ship, so no credits need be exchanged. Are you sure you want to trade your ship in?", player.p->ship->name, buf2)==0) return; } else if ( targetprice < playerprice ) { if (dialogue_YesNo("Are you sure?", /* confirm */ "Your %s is worth %s credits, more than the new ship. For your ship, you will get the new %s and %s credits. Are you sure you want to trade your ship in?", player.p->ship->name, buf2, ship->name, buf4)==0) return; } else if ( targetprice > playerprice ) { if (dialogue_YesNo("Are you sure?", /* confirm */ "Your %s is worth %s, so the new ship will cost %s credits. Are you sure you want to trade your ship in?", player.p->ship->name, buf2, buf3)==0) return; } /* player just got a new ship */ if (player_newShip( ship, NULL, 1, 0 ) == NULL) return; /* Player aborted the naming process. */ player_modCredits( playerprice - targetprice ); /* Modify credits by the difference between ship values. */ land_refuel(); /* The newShip call will trigger a loadGUI that will recreate the land windows. Therefore the land ID will * be void. We must reload in in order to properly update it again.*/ wid = land_getWid(LAND_WINDOW_SHIPYARD); /* Update shipyard. */ shipyard_update(wid, NULL); }
/** * @brief Player attempts to buy a ship, trading the current ship in. * @param wid Window player is buying ship from. * @param str Unused. */ static void shipyard_trade( unsigned int wid, char* str ) { (void)str; char *shipname, buf[ECON_CRED_STRLEN], buf2[ECON_CRED_STRLEN], buf3[ECON_CRED_STRLEN], buf4[ECON_CRED_STRLEN]; Ship* ship; shipname = toolkit_getImageArray( wid, "iarShipyard" ); ship = ship_get( shipname ); credits_t targetprice = ship->price; credits_t playerprice = player_shipPrice(player.p->name); if (land_errDialogue( shipname, "trade" )) return; credits2str( buf, targetprice, 2 ); credits2str( buf2, playerprice, 2 ); credits2str( buf3, targetprice - playerprice, 2 ); credits2str( buf4, playerprice - targetprice, 2 ); /* Display the correct dialogue depending on the new ship's price versus the player's. */ if ( targetprice == playerprice ) { if (dialogue_YesNo("Are you sure?", /* confirm */ "Your %s is worth %s, exactly as much as the new ship, so no credits need be exchanged. Are you sure you want to trade your ship in?", player.p->ship->name, buf2)==0) return; } else if ( targetprice < playerprice ) { if (dialogue_YesNo("Are you sure?", /* confirm */ "Your %s is worth %s credits, more than the new ship. For your ship, you will get the new %s and %s credits. Are you sure you want to trade your ship in?", player.p->ship->name, buf2, ship->name, buf4)==0) return; } else if ( targetprice > playerprice ) { if (dialogue_YesNo("Are you sure?", /* confirm */ "Your %s is worth %s, so the new ship will cost %s credits. Are you sure you want to trade your ship in?", player.p->ship->name, buf2, buf3)==0) return; } /* player just got a new ship */ if (player_newShip( ship, NULL, 1, 0 ) == NULL) return; /* Player aborted the naming process. */ player_modCredits( playerprice - targetprice ); /* Modify credits by the difference between ship values. */ land_checkAddRefuel(); /* Update shipyard. */ shipyard_update(wid, NULL); }
/** * @brief Makes sure it's sane to buy a ship, trading the old one in simultaneously. * @param shipname Ship being bought. */ int shipyard_canTrade( char* shipname ) { int failure = 0; Ship* ship; ship = ship_get( shipname ); credits_t price; price = ship_buyPrice( ship ); /* Must have the necessary license, enough credits, and be able to swap ships. */ if (!player_hasLicense(ship->license)) { land_errDialogueBuild( "You lack the %s.", ship->license ); failure = 1; } if (!player_hasCredits( price - player_shipPrice(player.p->name))) { credits_t creditdifference = price - (player_shipPrice(player.p->name) + player.p->credits); char buf[ECON_CRED_STRLEN]; credits2str( buf, creditdifference, 2 ); land_errDialogueBuild( "You need %s more credits.", buf); failure = 1; } if (!can_swap( shipname )) failure = 1; return !failure; }
/** * @brief Player attempts to buy a ship. * @param wid Window player is buying ship from. * @param str Unused. */ static void shipyard_buy( unsigned int wid, char* str ) { (void)str; char *shipname, buf[ECON_CRED_STRLEN]; Ship* ship; shipname = toolkit_getImageArray( wid, "iarShipyard" ); if (strcmp(shipname, "None") == 0) return; ship = ship_get( shipname ); credits_t targetprice = ship_buyPrice(ship); if (land_errDialogue( shipname, "buyShip" )) return; credits2str( buf, targetprice, 2 ); if (dialogue_YesNo("Are you sure?", /* confirm */ "Do you really want to spend %s on a new ship?", buf )==0) return; /* player just got a new ship */ if (player_newShip( ship, NULL, 0, 0 ) == NULL) { /* Player actually aborted naming process. */ return; } player_modCredits( -targetprice ); /* ouch, paying is hard */ /* Update shipyard. */ shipyard_update(wid, NULL); }
/** * @brief Adds the "Buy Local Map" button if needed. */ void land_checkAddMap (void) { char buf[ECON_CRED_STRLEN], cred[ECON_CRED_STRLEN]; Outfit *o; /* Maps are only offered if the planet provides fuel. */ if (!planet_hasService(land_planet, PLANET_SERVICE_REFUEL)) return; o = outfit_get( LOCAL_MAP_NAME ); if (o == NULL) { WARN("Outfit '%s' does not exist!", LOCAL_MAP_NAME); return; } /* Just enable button if it exists. */ if (widget_exists( land_windows[0], "btnMap" )) window_enableButton( land_windows[0], "btnMap"); /* Else create it. */ else { /* Refuel button. */ credits2str( cred, o->price, 2 ); nsnprintf( buf, sizeof(buf), "Buy Local Map (%s)", cred ); window_addButtonKey( land_windows[0], -20, 20 + (LAND_BUTTON_HEIGHT + 20), LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT, "btnMap", buf, spaceport_buyMap, SDLK_b ); } /* Make sure player can click it. */ if (!outfit_canBuy(LOCAL_MAP_NAME, land_planet)) window_disableButtonSoft( land_windows[0], "btnMap" ); }
/** * @brief Updates the boarding window fields. * * @param wdw Window to update. */ static void board_update( unsigned int wdw ) { int i, j; char str[PATH_MAX]; char cred[10]; Pilot* p; p = pilot_get(player->target); j = 0; /* Credits. */ credits2str( cred, p->credits, 2 ); j += snprintf( &str[j], PATH_MAX-j, "%s\n", cred ); /* Commodities. */ if (p->ncommodities==0) j += snprintf( &str[j], PATH_MAX-j, "none\n" ); else { for (i=0; i<p->ncommodities; i++) j += snprintf( &str[j], PATH_MAX-j, "%d %s\n", p->commodities[i].quantity, p->commodities[i].commodity->name ); } /* Fuel. */ if (p->fuel <= 0.) j += snprintf( &str[j], PATH_MAX-j, "none\n" ); else j += snprintf( &str[j], PATH_MAX-j, "%.0f Units\n", p->fuel ); window_modifyText( wdw, "txtData", str ); }
/** * @brief Opens the main info window. */ static void info_openMain( unsigned int wid ) { char str[128], **buf, creds[ECON_CRED_STRLEN]; char **licenses; int nlicenses; int i; char *nt; int w, h; /* Get the dimensions. */ window_dimWindow( wid, &w, &h ); /* pilot generics */ nt = ntime_pretty( ntime_get(), 2 ); window_addText( wid, 40, 20, 120, h-80, 0, "txtDPilot", &gl_smallFont, &cDConsole, "Pilot:\n" "Date:\n" "Combat Rating:\n" "\n" "Money:\n" "Ship:\n" "Fuel:" ); credits2str( creds, player.p->credits, 2 ); snprintf( str, 128, "%s\n" "%s\n" "%s\n" "\n" "%s Credits\n" "%s\n" "%.0f (%d Jumps)", player.name, nt, player_rating(), creds, player.p->name, player.p->fuel, pilot_getJumps(player.p) ); window_addText( wid, 140, 20, 200, h-80, 0, "txtPilot", &gl_smallFont, &cBlack, str ); free(nt); /* menu */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", info_close ); /* List. */ buf = player_getLicenses( &nlicenses ); licenses = malloc(sizeof(char*)*nlicenses); for (i=0; i<nlicenses; i++) licenses[i] = strdup(buf[i]); window_addText( wid, -20, -40, w-80-200-40, 20, 1, "txtList", NULL, &cDConsole, "Licenses" ); window_addList( wid, -20, -70, w-80-200-40, h-110-BUTTON_HEIGHT, "lstLicenses", licenses, nlicenses, 0, NULL ); }
/** * @brief Makes sure it's sane to buy a ship. * @param shipname Ship being bought. */ int shipyard_canBuy ( char *shipname ) { Ship* ship; ship = ship_get( shipname ); int failure = 0; /* Must have enough credits and the necessary license. */ if (!player_hasLicense(ship->license)) { land_errDialogueBuild( "You lack the %s.", ship->license ); failure = 1; } if (!player_hasCredits( ship->price )) { char buf[ECON_CRED_STRLEN]; credits2str( buf, ship->price - player.p->credits, 2 ); land_errDialogueBuild( "You need %s more credits.", buf); failure = 1; } return !failure; }
/** * @brief Gets how many credits the player has on him. * * @usage monies = player.credits() * @usage monies, readable = player.credits( 2 ) * * @luaparam decimal Optional argument that makes it return human readable form with so many decimals. * @luareturn The amount of credits the player has on him in both numerical and human-readable form. * @luafunc credits( decimal ) */ static int playerL_credits( lua_State *L ) { char buf[ ECON_CRED_STRLEN ]; int has_dec, decimals; /* Parse parameters. */ if (lua_isnumber(L,1)) { has_dec = 1; decimals = lua_tointeger(L,1); } else has_dec = 0; /* Push return. */ lua_pushnumber(L, player.p->credits); if (has_dec) { credits2str( buf, player.p->credits, decimals ); lua_pushstring(L, buf); } return 1 + has_dec; }
/** * @brief Makes sure it's sane to buy a ship. * @param shipname Ship being bought. */ int shipyard_canBuy ( char *shipname, Planet *planet ) { Ship* ship; ship = ship_get( shipname ); int failure = 0; credits_t price; price = ship_buyPrice(ship); /* Must have enough credits and the necessary license. */ if ((!player_hasLicense(ship->license)) && ((planet == NULL) || (!planet_isBlackMarket(planet)))) { land_errDialogueBuild( "You lack the %s.", ship->license ); failure = 1; } if (!player_hasCredits( price )) { char buf[ECON_CRED_STRLEN]; credits2str( buf, price - player.p->credits, 2 ); land_errDialogueBuild( "You need %s more credits.", buf); failure = 1; } return !failure; }
static int commodity_canBuy( char *name ) { int failure; unsigned int q, price; Commodity *com; char buf[ECON_CRED_STRLEN]; failure = 0; q = commodity_getMod(); com = commodity_get( name ); price = planet_commodityPrice( land_planet, com ) * q; if (!player_hasCredits( price )) { credits2str( buf, price - player.p->credits, 2 ); land_errDialogueBuild("You need %s more credits.", buf ); failure = 1; } if (pilot_cargoFree(player.p) <= 0) { land_errDialogueBuild("No cargo space available!"); failure = 1; } return !failure; }
/** * @brief Updates the ships in the shipyard window. * @param wid Window to update the ships in. * @param str Unused. */ void shipyard_update( unsigned int wid, char* str ) { (void)str; char *shipname, *license_text; Ship* ship; char buf[PATH_MAX], buf2[ECON_CRED_STRLEN], buf3[ECON_CRED_STRLEN]; size_t len; shipname = toolkit_getImageArray( wid, "iarShipyard" ); /* No ships */ if (strcmp(shipname,"None")==0) { window_modifyImage( wid, "imgTarget", NULL, 0, 0 ); window_disableButton( wid, "btnBuyShip"); window_disableButton( wid, "btnTradeShip"); nsnprintf( buf, PATH_MAX, "None\n" "NA\n" "NA\n" "NA\n" "\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" ); window_modifyImage( wid, "imgTarget", NULL, 0, 0 ); window_modifyText( wid, "txtStats", NULL ); window_modifyText( wid, "txtDescription", NULL ); window_modifyText( wid, "txtDDesc", buf ); return; } ship = ship_get( shipname ); shipyard_selected = ship; /* update image */ window_modifyImage( wid, "imgTarget", ship->gfx_store, 0, 0 ); /* update text */ window_modifyText( wid, "txtStats", ship->desc_stats ); window_modifyText( wid, "txtDescription", ship->description ); price2str( buf2, ship_buyPrice(ship), player.p->credits, 2 ); credits2str( buf3, player.p->credits, 2 ); /* Remove the word " License". It's redundant and makes the text overflow into another text box */ license_text = ship->license; if (license_text) { len = strlen(ship->license); if (strcmp(" License", ship->license + len - 8) == 0) { license_text = malloc(len - 7); assert(license_text); memcpy(license_text, ship->license, len - 8); license_text[len - 8] = '\0'; } } nsnprintf( buf, PATH_MAX, "%s\n" "%s\n" "%s\n" "%d\n" "\n" "%.0f teraflops\n" "%.0f tons\n" "%.0f kN/ton\n" "%.0f m/s\n" "%.0f deg/s\n" "\n" "%.0f%% damage\n" "%.0f MJ (%.1f MW)\n" "%.0f MJ (%.1f MW)\n" "%.0f MJ (%.1f MW)\n" "%.0f tons\n" "%d units\n" "%.0f units\n" "%s credits\n" "%s credits\n" "%s\n", ship->name, ship_class(ship), ship->fabricator, ship->crew, /* Weapons & Manoeuvrability */ ship->cpu, ship->mass, ship->thrust, ship->speed, ship->turn*180/M_PI, /* Misc */ ship->dmg_absorb*100., ship->shield, ship->shield_regen, ship->armour, ship->armour_regen, ship->energy, ship->energy_regen, ship->cap_cargo, ship->fuel, ship->fuel_consumption, buf2, buf3, (license_text != NULL) ? license_text : "None" ); window_modifyText( wid, "txtDDesc", buf ); if (license_text != ship->license) free(license_text); if (!shipyard_canBuy( shipname, land_planet )) window_disableButtonSoft( wid, "btnBuyShip"); else window_enableButton( wid, "btnBuyShip"); if (!shipyard_canTrade( shipname )) window_disableButtonSoft( wid, "btnTradeShip"); else window_enableButton( wid, "btnTradeShip"); }
/** * @brief Updates the outfits in the outfit window. * @param wid Window to update the outfits in. * @param str Unused. */ void outfits_update( unsigned int wid, char* str ) { (void)str; char *outfitname; Outfit* outfit; char buf[PATH_MAX], buf2[ECON_CRED_STRLEN], buf3[ECON_CRED_STRLEN]; double th; int iw, ih; int w, h; /* Get dimensions. */ outfits_getSize( wid, &w, &h, &iw, &ih, NULL, NULL ); /* Get and set parameters. */ outfitname = toolkit_getImageArray( wid, "iarOutfits" ); if (strcmp(outfitname,"None")==0) { /* No outfits */ window_modifyImage( wid, "imgOutfit", NULL, 0, 0 ); window_disableButton( wid, "btnBuyOutfit" ); window_disableButton( wid, "btnSellOutfit" ); snprintf( buf, PATH_MAX, "NA\n" "\n" "NA\n" "NA\n" "NA\n" "\n" "NA\n" "NA\n" "NA\n" ); window_modifyText( wid, "txtDDesc", buf ); window_modifyText( wid, "txtOutfitName", "None" ); window_modifyText( wid, "txtDescShort", NULL ); /* Reposition. */ window_moveWidget( wid, "txtSDesc", 20+iw+20, -60 ); window_moveWidget( wid, "txtDDesc", 20+iw+20+60, -60 ); window_moveWidget( wid, "txtDescription", 20+iw+40, -240 ); return; } outfit = outfit_get( outfitname ); /* new image */ window_modifyImage( wid, "imgOutfit", outfit->gfx_store, 0, 0 ); if (outfit_canBuy(outfit,1,0) > 0) window_enableButton( wid, "btnBuyOutfit" ); else window_disableButton( wid, "btnBuyOutfit" ); /* gray out sell button */ if (outfit_canSell(outfit,1,0) > 0) window_enableButton( wid, "btnSellOutfit" ); else window_disableButton( wid, "btnSellOutfit" ); /* new text */ window_modifyText( wid, "txtDescription", outfit->description ); credits2str( buf2, outfit->price, 2 ); credits2str( buf3, player.p->credits, 2 ); snprintf( buf, PATH_MAX, "%d\n" "\n" "%s\n" "%s\n" "%.0f tons\n" "\n" "%s credits\n" "%s credits\n" "%s\n", player_outfitOwned(outfit), outfit_slotName(outfit), outfit_slotSize(outfit), outfit->mass, buf2, buf3, (outfit->license != NULL) ? outfit->license : "None" ); window_modifyText( wid, "txtDDesc", buf ); window_modifyText( wid, "txtOutfitName", outfit->name ); window_modifyText( wid, "txtDescShort", outfit->desc_short ); th = MAX( 128, gl_printHeightRaw( &gl_smallFont, 320, outfit->desc_short ) ); window_moveWidget( wid, "txtSDesc", 40+iw+20, -60-th-20 ); window_moveWidget( wid, "txtDDesc", 40+iw+20+60, -60-th-20 ); th += gl_printHeightRaw( &gl_smallFont, 250, buf ); window_moveWidget( wid, "txtDescription", 20+iw+40, -60-th-20 ); }
/** * @brief Updates the ships in the shipyard window. * @param wid Window to update the ships in. * @param str Unused. */ void shipyard_update( unsigned int wid, char* str ) { (void)str; char *shipname; Ship* ship; char buf[PATH_MAX], buf2[ECON_CRED_STRLEN], buf3[ECON_CRED_STRLEN]; shipname = toolkit_getImageArray( wid, "iarShipyard" ); /* No ships */ if (strcmp(shipname,"None")==0) { window_modifyImage( wid, "imgTarget", NULL, 0, 0 ); window_disableButton( wid, "btnBuyShip"); window_disableButton( wid, "btnTradeShip"); snprintf( buf, PATH_MAX, "None\n" "NA\n" "NA\n" "NA\n" "\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" "NA\n" ); window_modifyImage( wid, "imgTarget", NULL, 0, 0 ); window_modifyText( wid, "txtStats", NULL ); window_modifyText( wid, "txtDescription", NULL ); window_modifyText( wid, "txtDDesc", buf ); return; } ship = ship_get( shipname ); shipyard_selected = ship; /* update image */ window_modifyImage( wid, "imgTarget", ship->gfx_store, 0, 0 ); /* update text */ window_modifyText( wid, "txtStats", ship->desc_stats ); window_modifyText( wid, "txtDescription", ship->description ); credits2str( buf2, ship->price, 2 ); credits2str( buf3, player.p->credits, 2 ); snprintf( buf, PATH_MAX, "%s\n" "%s\n" "%s\n" "%d\n" "\n" "%.0f teraflops\n" "%.0f tons\n" "%.1f STU average\n" "%.0f kN/ton\n" "%.0f m/s\n" "%.0f deg/s\n" "\n" "%.0f%% damage\n" "%.0f MJ (%.1f MW)\n" "%.0f MJ (%.1f MW)\n" "%.0f MJ (%.1f MW)\n" "%.0f tons\n" "%d units\n" "%s credits\n" "%s credits\n" "%s\n", ship->name, ship_class(ship), ship->fabricator, ship->crew, /* Weapons & Manoeuvrability */ ship->cpu, ship->mass, pow( ship->mass, 1./2.5 ) / 5. * (ship->stats_array.jump_delay/100.+1.), /**< @todo make this more portable. */ ship->thrust / ship->mass, ship->speed, ship->turn*180/M_PI, /* Misc */ ship->dmg_absorb*100., ship->shield, ship->shield_regen, ship->armour, ship->armour_regen, ship->energy, ship->energy_regen, ship->cap_cargo, ship->fuel, buf2, buf3, (ship->license != NULL) ? ship->license : "None" ); window_modifyText( wid, "txtDDesc", buf ); if (!shipyard_canBuy( shipname )) window_disableButton( wid, "btnBuyShip"); else window_enableButton( wid, "btnBuyShip"); if (!shipyard_canTrade( shipname )) window_disableButton( wid, "btnTradeShip"); else window_enableButton( wid, "btnTradeShip"); }