@@ -231,7 +231,6 @@ void hud_add_issued_order(const char *name, int order);
231231void hud_update_last_order (const char *target, int order_source, int special_index);
232232bool hud_squadmsg_is_target_order_valid (size_t order, ai_info *aip = nullptr );
233233bool hud_squadmsg_ship_valid (ship *shipp, object *objp = nullptr );
234- bool hud_squadmsg_ship_order_valid ( int shipnum, int order );
235234
236235// function to set up variables needed when messaging mode is started
237236void hud_squadmsg_start ()
@@ -1529,11 +1528,11 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message,
15291528 int ship_num;
15301529
15311530 // get a random ship in the wing to send the message to the player
1532- ship_num = ship_get_random_ship_in_wing ( wingnum, SHIP_GET_UNSILENCED );
1531+ ship_num = ship_get_random_ship_in_wing ( wingnum, SHIP_GET_UNSILENCED, 0.0 , 0 , command );
15331532
15341533 // in multiplayer, its possible that all ships in a wing are players. so we'll just send from a random ship
15351534 if (ship_num == -1 && (Game_mode & GM_MULTIPLAYER)){
1536- ship_num = ship_get_random_ship_in_wing (wingnum);
1535+ ship_num = ship_get_random_ship_in_wing (wingnum, SHIP_GET_ANY_SHIP, 0.0 , 0 , command );
15371536 }
15381537
15391538 // only send message if ship is found. There appear to be cases where all ships
@@ -2098,6 +2097,18 @@ void hud_squadmsg_wing_command()
20982097 if ( !hud_squadmsg_is_target_order_valid ((int )order_id, 0 ) )
20992098 MsgItems[Num_menu_items].active = 0 ;
21002099
2100+ // if no ship in the wing can depart then gray out the departure order
2101+ if (order_id == DEPART_ITEM) {
2102+ int active = 0 ;
2103+ for (int i = 0 ; i < wingp->current_count ; i++) {
2104+ if (hud_squadmsg_ship_order_valid (wingp->ship_index [i], (int )order_id)) {
2105+ active = 1 ;
2106+ break ;
2107+ }
2108+ }
2109+ MsgItems[Num_menu_items].active = active;
2110+ }
2111+
21012112 Num_menu_items++;
21022113
21032114 }
0 commit comments