string SupplyDrop::getExportLine() { string ret = "SupplyDrop():setFaction(\"" + getFaction() + "\"):setPosition(" + string(getPosition().x, 0) + ", " + string(getPosition().y, 0) + ")"; if (energy > 0) ret += ":setEnergy(" + string(energy, 0) + ")"; for(int n=0; n<MW_Count; n++) if (weapon_storage[n] > 0) ret += ":setWeaponStorage(\"" + getMissileWeaponName(EMissileWeapons(n)) + "\", " + string(weapon_storage[n]) + ")"; return ret; }
GuiShipTweakMissileWeapons::GuiShipTweakMissileWeapons(GuiContainer* owner) : GuiTweakPage(owner) { GuiAutoLayout* left_col = new GuiAutoLayout(this, "LEFT_LAYOUT", GuiAutoLayout::LayoutVerticalTopToBottom); left_col->setPosition(20, 20, ATopLeft)->setSize(300, GuiElement::GuiSizeMax); GuiAutoLayout* right_col = new GuiAutoLayout(this, "RIGHT_LAYOUT", GuiAutoLayout::LayoutVerticalTopToBottom); right_col->setPosition(-20, 20, ATopRight)->setSize(300, GuiElement::GuiSizeMax); (new GuiLabel(left_col, "", "Storage space:", 30))->setSize(GuiElement::GuiSizeMax, 50); for(int n=0; n<MW_Count; n++) { missile_storage_amount_selector[n] = new GuiSelector(left_col, "", [this, n](int index, string value) { target->weapon_storage_max[n] = index; target->weapon_storage[n] = std::min(target->weapon_storage[n], target->weapon_storage_max[n]); }); for(int m=0; m<50; m++) missile_storage_amount_selector[n]->addEntry(getMissileWeaponName(EMissileWeapons(n)) + ": " + string(m), ""); missile_storage_amount_selector[n]->setSize(GuiElement::GuiSizeMax, 50); } (new GuiLabel(left_col, "", "Tube count:", 30))->setSize(GuiElement::GuiSizeMax, 50); missile_tube_amount_selector = new GuiSelector(left_col, "", [this](int index, string value) { target->weapon_tube_count = index; }); for(int n=0; n<max_weapon_tubes; n++) missile_tube_amount_selector->addEntry(string(n), ""); missile_tube_amount_selector->setSize(GuiElement::GuiSizeMax, 50); (new GuiLabel(right_col, "", "Stored amount:", 30))->setSize(GuiElement::GuiSizeMax, 50); for(int n=0; n<MW_Count; n++) { missile_current_amount_selector[n] = new GuiSelector(right_col, "", [this, n](int index, string value) { target->weapon_storage[n] = std::min(index, int(target->weapon_storage_max[n])); }); for(int m=0; m<50; m++) missile_current_amount_selector[n]->addEntry(getMissileWeaponName(EMissileWeapons(n)) + ": " + string(m), ""); missile_current_amount_selector[n]->setSize(GuiElement::GuiSizeMax, 50); } }