Index: code/ai/aicode.cpp
===================================================================
--- code/ai/aicode.cpp	(revision 8915)
+++ code/ai/aicode.cpp	(working copy)
@@ -10589,9 +10589,8 @@
 	case AIS_DOCK_4A:
 	{
 		if (aigp == NULL) {	//	Can happen for initially docked ships.
-			// Goober5000 - if we just "sit and wait for further orders", then we're not doing any behavior, grrr...
-			// (commenting out a retail bug)
-			//ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] );		// do the default behavior
+			// this now "just sits here" for docked ships
+			ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] );		// do the default behavior
 		} else {
 			mission_log_add_entry(LOG_SHIP_DOCKED, shipp->ship_name, goal_shipp->ship_name);
 
@@ -13585,6 +13584,12 @@
 
 	Assert((aip->mode != AIM_WAYPOINTS) || (aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC));
 
+	if (!stricmp(shipp->ship_name, "GTF Ulysses 2")) {
+		mprintf(("ship 2\n"));
+	} else if (!stricmp(shipp->ship_name, "GTF Ulysses 3")) {
+		mprintf(("ship 3\n"));
+	}
+
 	// Set globals defining the current object and its enemy object.
 	Pl_objp = &Objects[objnum];
 
@@ -14188,42 +14193,42 @@
 
 void ai_do_default_behavior(object *obj)
 {
-	ai_info	*aip;
-	int		ship_flags;
-
 	Assert(obj != NULL);
 	Assert(obj->instance != -1);
 	Assert(Ships[obj->instance].ai_index != -1);
 
-	aip = &Ai_info[Ships[obj->instance].ai_index];
+	ai_info	*aip = &Ai_info[Ships[obj->instance].ai_index];
+	int	ship_flags = Ship_info[Ships[obj->instance].ship_info_index].flags;
 
-	ship_flags = Ship_info[Ships[obj->instance].ship_info_index].flags;
-	if (!is_instructor(obj) && (ship_flags & (SIF_FIGHTER | SIF_BOMBER)))
+	// default behavior in most cases (especially if we're docked) is to just stay put
+	aip->mode = AIM_NONE;
+	aip->submode_start_time = Missiontime;
+	aip->active_goal = AI_GOAL_NONE;
+
+	// if we're not docked, we may modify the behavior a bit
+	if (!object_is_docked(obj))
 	{
-		int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
-		set_target_objnum(aip, enemy_objnum);
-		aip->mode = AIM_CHASE;
-		aip->submode = SM_ATTACK;
-		aip->submode_start_time = Missiontime;
+		// fighters automatically chase things
+		if (!is_instructor(obj) && (ship_flags & (SIF_FIGHTER | SIF_BOMBER)))
+		{
+			int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
+			set_target_objnum(aip, enemy_objnum);
+			aip->mode = AIM_CHASE;
+			aip->submode = SM_ATTACK;
+		}
+		// support ships automatically keep a safe distance
+		else if (ship_flags & SIF_SUPPORT)
+		{
+			aip->mode = AIM_SAFETY;
+			aip->submode = AISS_1;
+			aip->ai_flags &= ~(AIF_REPAIRING);
+		}
+		// sentry guns... do their thing
+		else if (ship_flags & SIF_SENTRYGUN)
+		{
+			aip->mode = AIM_SENTRYGUN;
+		}
 	}
-	else if (ship_flags & (SIF_SUPPORT))
-	{
-		aip->mode = AIM_SAFETY;
-		aip->submode = AISS_1;
-		aip->submode_start_time = Missiontime;
-		aip->ai_flags &= ~(AIF_REPAIRING);
-	}
-	else if ( ship_flags & SIF_SENTRYGUN )
-	{
-		aip->mode = AIM_SENTRYGUN;
-	}
-	else
-	{
-		aip->mode = AIM_NONE;
-	}
-	
-	aip->submode_start_time = Missiontime;
-	aip->active_goal = AI_GOAL_NONE;
 }
 
 #define	FRIENDLY_DAMAGE_THRESHOLD	50.0f		//	Display a message at this threshold.  Note, this gets scaled by Skill_level
