// Set the secondary order state for all currently selected droids. And Factory (if one selected) // Returns true if successful. // static bool SetSecondaryState(SECONDARY_ORDER sec, unsigned State) { // This code is similar to kfsf_SetSelectedDroidsState() in keybind.cpp. Unfortunately, it seems hard to un-duplicate the code. for (unsigned i = 0; i < SelectedDroids.size(); ++i) { if (SelectedDroids[i]) { //Only set the state if it's not a transporter. if (!isTransporter(SelectedDroids[i])) { if (!secondarySetState(SelectedDroids[i], sec, (SECONDARY_STATE)State)) { return false; } } } } // set the Factory settings if (psSelectedFactory) { if (!setFactoryState(psSelectedFactory, sec, (SECONDARY_STATE)State)) { return false; } } return true; }
// Set the secondary order state for all currently selected droids. And Factory (if one selected) // Returns true if successful. // static bool SetSecondaryState(SECONDARY_ORDER sec, unsigned State) { for (unsigned i = 0; i < SelectedDroids.size(); ++i) { if (SelectedDroids[i]) { //Only set the state if it's not a transporter. if (SelectedDroids[i]->droidType != DROID_TRANSPORTER && SelectedDroids[i]->droidType != DROID_SUPERTRANSPORTER) { if (!secondarySetState(SelectedDroids[i], sec, (SECONDARY_STATE)State)) { return false; } } } } // set the Factory settings if (psSelectedFactory) { if (!setFactoryState(psSelectedFactory, sec, (SECONDARY_STATE)State)) { return false; } } return true; }