Index: code/ai/aicode.cpp
===================================================================
--- code/ai/aicode.cpp	(revision 9419)
+++ code/ai/aicode.cpp	(working copy)
@@ -65,6 +65,7 @@
 #include "network/multi.h"
 #include "ai/ai_profiles.h"
 #include "autopilot/autopilot.h"
+#include "mod_table/mod_table.h"
 #include <map>
 #include <limits.h>
 
@@ -12584,7 +12585,7 @@
 void ai_bay_depart()
 {
 	ai_info	*aip;
-	int anchor_shipnum;
+	int anchor_shipnum, wingnum;
 
 	aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
 
@@ -12613,7 +12614,13 @@
 	if (anchor_shipnum < 0)
 	{
 		aip->mode = AIM_NONE;
-		
+
+		wingnum = Ships[Pl_objp->instance].wingnum;
+		if ( Fixed_departure_settings && ( wingnum != -1 ) )
+		{
+			Wings[wingnum].flags &= ~WF_WING_DEPARTING;
+		}
+
 		Ships[Pl_objp->instance].flags &= ~SF_DEPART_DOCKBAY;
 		return;
 	}
Index: code/ai/aigoals.cpp
===================================================================
--- code/ai/aigoals.cpp	(revision 9419)
+++ code/ai/aigoals.cpp	(working copy)
@@ -23,8 +23,8 @@
 #include "weapon/weapon.h"
 #include "object/objectdock.h"
 #include "object/waypoint.h"
+#include "mod_table/mod_table.h"
 
-
 // all ai goals dealt with in this code are goals that are specified through
 // sexpressions in the mission file.  They are either specified as part of a
 // ships goals in the #Object section of the mission file, or are created (and
@@ -228,8 +228,15 @@
 	// only need to set the ai_mode for the particular goal to AI_GOAL_NONE
 	// reset ai mode to default behavior.  Might get changed next time through
 	// ai goal code look
-	Assert ( index >= 0 );			// must have a valid goal
+	Assert ( index >= 0 );			// must have a valid goal DEPART_AT_DOCK_BAY
 
+	if ( Fixed_departure_settings && ( aip->goals[index].ai_mode == AI_GOAL_WARP ) && ( aip->wing != -1 ) ) {
+		if ( Wings[aip->wing].flags & WF_WING_DEPARTING ) {
+			Wings[aip->wing].flags &= ~WF_WING_DEPARTING;
+			Ships[aip->shipnum].flags &= ~SF_DEPART_DOCKBAY;
+		}
+	}
+
 	aip->goals[index].ai_mode = AI_GOAL_NONE;
 	aip->goals[index].signature = -1;
 	aip->goals[index].priority = -1;
@@ -1158,12 +1165,23 @@
 // code to add ai goals to wings.
 void ai_remove_wing_goal_sexp(int sexp, int wingnum)
 {
-	int i;
+	int i, node, op;
+	char *text;
 	int goalindex = -1;
 	wing *wingp = &Wings[wingnum];
 
 	// add the ai goal for any ship that is currently arrived in the game (only if fred isn't running)
 	if ( !Fred_running ) {
+		if ( Fixed_departure_settings ) {
+			// remove departure settings for the wing
+			Assert ( Sexp_nodes[sexp].first != -1 );
+			node = Sexp_nodes[sexp].first;
+			text = CTEXT(node);
+			op = get_operator_const(text);
+			if ( ( op == OP_AI_WARP_OUT ) || ( op == OP_AI_WARP ) ) {
+				Wings[wingnum].flags &= ~WF_WING_DEPARTING;
+			}
+		}
 		for (i = 0; i < wingp->current_count; i++) {
 			int num = wingp->ship_index[i];
 			if ( num == -1 )			// ship must have been destroyed or departed
@@ -1193,11 +1211,22 @@
 // code to add ai goals to wings.
 void ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
 {
-	int i;
+	int i, op, node;
+	char *text;
 	wing *wingp = &Wings[wingnum];
 
 	// add the ai goal for any ship that is currently arrived in the game (only if fred isn't running)
 	if ( !Fred_running ) {
+		if ( Fixed_departure_settings ) {
+			// add departure settings for the wing
+			Assert ( Sexp_nodes[sexp].first != -1 );
+			node = Sexp_nodes[sexp].first;
+			text = CTEXT(node);
+			op = get_operator_const(text);
+			if ( ( op == OP_AI_WARP_OUT ) || ( op == OP_AI_WARP ) ) {
+				Wings[wingnum].flags |= WF_WING_DEPARTING;
+			}
+		}
 		for (i = 0; i < wingp->current_count; i++) {
 			int num = wingp->ship_index[i];
 			if ( num == -1 )			// ship must have been destroyed or departed
Index: code/hud/hudsquadmsg.cpp
===================================================================
--- code/hud/hudsquadmsg.cpp	(revision 9419)
+++ code/hud/hudsquadmsg.cpp	(working copy)
@@ -35,8 +35,8 @@
 #include "network/multiutil.h"
 #include "network/multi_pmsg.h"
 #include "parse/parselo.h"
+#include "mod_table/mod_table.h"
 
-
 // defines for different modes in the squad messaging system
 
 #define DEFAULT_MSG_TIMEOUT		(8 * 1000)		// number of seconds * 1000 to get milliseconds
@@ -1480,7 +1480,11 @@
 			ai_mode = AI_GOAL_WARP;
 			ai_submode = -1;
 			message = MESSAGE_WARP_OUT;
-			Wings[wingnum].flags |= WF_DEPARTURE_ORDERED;
+			if ( Fixed_departure_settings ) {
+				Wings[wingnum].flags |= WF_WING_DEPARTING;
+			} else {
+				Wings[wingnum].flags |= WF_DEPARTURE_ORDERED;
+			}
 			break;
 
 		case REARM_REPAIR_ME_ITEM:
Index: code/mission/missionparse.cpp
===================================================================
--- code/mission/missionparse.cpp	(revision 9419)
+++ code/mission/missionparse.cpp	(working copy)
@@ -72,6 +72,7 @@
 #include "popup/popupdead.h"
 #include "sound/sound.h"
 #include "sound/ds.h"
+#include "mod_table/mod_table.h"
 
 LOCAL struct {
 	char docker[NAME_LENGTH];
@@ -1895,9 +1896,15 @@
 	shipp->arrival_path_mask = p_objp->arrival_path_mask;
 	shipp->arrival_cue = p_objp->arrival_cue;
 	shipp->arrival_delay = p_objp->arrival_delay;
-	shipp->departure_location = p_objp->departure_location;
-	shipp->departure_anchor = p_objp->departure_anchor;
-	shipp->departure_path_mask = p_objp->departure_path_mask;
+	if ( Fixed_departure_settings && ( p_objp->wingnum != -1 ) ){
+		shipp->departure_location = Wings[p_objp->wingnum].departure_location;
+		shipp->departure_anchor = Wings[p_objp->wingnum].departure_anchor;
+		shipp->departure_path_mask = Wings[p_objp->wingnum].departure_path_mask;
+	} else {
+		shipp->departure_location = p_objp->departure_location;
+		shipp->departure_anchor = p_objp->departure_anchor;
+		shipp->departure_path_mask = p_objp->departure_path_mask;
+	}
 	shipp->departure_cue = p_objp->departure_cue;
 	shipp->departure_delay = p_objp->departure_delay;
 	shipp->wingnum = p_objp->wingnum;
@@ -6800,7 +6807,7 @@
 int mission_do_departure(object *objp)
 {
 	Assert (objp->type == OBJ_SHIP);
-	int location, anchor, path_mask;
+	int location, anchor, path_mask, wingnum;
 	ship *shipp = &Ships[objp->instance];
 
 	// Goober5000 - if this is a ship which has no subspace drive, departs to hyperspace, and belongs to a wing,
@@ -6847,6 +6854,11 @@
 		// make sure ship not dying or departing
 		if (Ships[anchor_shipnum].flags & (SF_DYING | SF_DEPARTING))
 		{
+			wingnum = shipp->wingnum;
+			if ( Fixed_departure_settings && ( wingnum != -1 ) )
+			{
+				Wings[wingnum].flags &= ~WF_WING_DEPARTING;
+			}
 			return 0;
 		}
 
Index: code/mod_table/mod_table.cpp
===================================================================
--- code/mod_table/mod_table.cpp	(revision 9419)
+++ code/mod_table/mod_table.cpp	(working copy)
@@ -24,6 +24,7 @@
 int Default_detail_level = 3; // "very high" seems a reasonable default in 2012 -zookeeper
 bool Full_color_head_anis = false;
 bool Weapons_inherit_parent_collision_group = false;
+bool Fixed_departure_settings = false;
 
 
 void parse_mod_table(char *filename)
@@ -192,6 +193,10 @@
 			mprintf(("Game Settings Table: Weapons inherit parent collision group\n"));
 	}
 
+	if (optional_string("$Fixed departure settings:")) {
+		stuff_boolean(&Fixed_departure_settings);
+	}
+
 	required_string("#END");
 
 	// close localization
Index: code/mod_table/mod_table.h
===================================================================
--- code/mod_table/mod_table.h	(revision 9419)
+++ code/mod_table/mod_table.h	(working copy)
@@ -21,5 +21,6 @@
 extern int Default_detail_level;
 extern bool Full_color_head_anis;
 extern bool Weapons_inherit_parent_collision_group;
+extern bool Fixed_departure_settings;
 
 void mod_table_init();
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp	(revision 9419)
+++ code/parse/sexp.cpp	(working copy)
@@ -9545,9 +9545,9 @@
 {
 	Assert( n >= 0 );
 	/* Grab the information that we need about this goal removal action */
-	int num, sindex;
+	int num, sindex, wingnum, node, op;
 	int goalindex;
-	char *name;
+	char *name, *op_text;
 
 	name = CTEXT(n);
 	sindex = CDR(n);
@@ -9557,8 +9557,20 @@
 	if ( (num = ship_name_lookup(name, 1)) != -1 )
 	{
 		goalindex = ai_remove_goal_sexp_sub( sindex, Ai_info[Ships[num].ai_index].goals );
+		
 		if ( goalindex >= 0 )
 		{
+			if ( Fixed_departure_settings )
+			{
+				node = Sexp_nodes[ sindex ].first;
+				op_text = CTEXT( node );
+				op = get_operator_const( op_text );
+				wingnum = wing_name_lookup(name);
+				if ( ( wingnum != -1 ) && ( ( op == OP_AI_WARP_OUT ) || ( op == OP_AI_WARP ) ) )
+				{
+					Wings[wingnum].flags &= ~WF_WING_DEPARTING;
+				}
+			}
 			if ( Ai_info[Ships[num].ai_index].active_goal == goalindex )
 				Ai_info[Ships[num].ai_index].active_goal = AI_GOAL_NONE;
 		}
