Index: code/parse/sexp.cpp
===================================================================
RCS file: /home/fs2source/cvsroot/fs2_open/code/parse/sexp.cpp,v
retrieving revision 2.260
diff -u -r2.260 sexp.cpp
--- code/parse/sexp.cpp	2 Jun 2006 09:29:13 -0000	2.260
+++ code/parse/sexp.cpp	3 Jun 2006 20:17:46 -0000
@@ -3694,7 +3694,7 @@
 	// Goober5000 - preload stuff for certain sexps
 	if (!Fred_running)
 	{
-		int n;
+		int n, tmp_index = -1;
 		ship_info *sip;
 
 		op = get_operator_const(CTEXT(start));
@@ -3705,9 +3705,22 @@
 				// model is argument #1
 				n = CDR(start);
 
+				// if we are a special argument then don't preload, the model will
+				// get loaded properly later, it may just be a little slower in game
+				if ( !strcmp(Sexp_nodes[n].text, SEXP_ARGUMENT_STRING) )
+					break;
+
+				tmp_index = ship_info_lookup( CTEXT(n) );
+
+				// just to be on the safe side
+				if ( tmp_index < 0 ) {
+					Int3();
+					break;
+				}
+
 				// preload the model, just in case there is no other ship of this class in the mission
 				// (this eliminates the slight pause during a mission when changing to a previously unloaded model)
-				sip = &Ship_info[ship_info_lookup(CTEXT(n))];										// we already know this class exists
+				sip = &Ship_info[tmp_index];		// we already know this class exists, or at least we hope it does
 				sip->modelnum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);	// use the highest detail level
 				break;
 
@@ -3733,6 +3746,11 @@
 			case OP_SET_SKYBOX_MODEL:
 				n = CDR(start);
 
+				// if we are a special argument then don't preload, the model will
+				// get loaded properly later, it will just be a bit slower in game
+				if ( !strcmp(Sexp_nodes[n].text, SEXP_ARGUMENT_STRING) )
+					break;
+
 				sexp_set_skybox_model_preload( CTEXT(n) );
 				break;
 
@@ -3740,11 +3758,20 @@
 				// weapon to change to is arg #3
 				n = CDDDR(start);
 
+				// if we are a special argument then don't preload, the weapon will
+				// get loaded properly later, it may just be a little slower in game
+				if ( !strcmp(Sexp_nodes[n].text, SEXP_ARGUMENT_STRING) )
+					break;
+
 				weapon_mark_as_used( weapon_info_lookup(CTEXT(n) ));
 				break;
 
 			case OP_ADD_SUN_BITMAP:
 				n = CDR(start);
+				// if we are a special argument then don't preload, the bitmap will
+				// get loaded properly later, it may just be a little slower in game
+				if ( !strcmp(Sexp_nodes[n].text, SEXP_ARGUMENT_STRING) )
+					break;
 
 				stars_preload_sun_bitmap( CTEXT(n) );
 				break;
@@ -3752,6 +3779,11 @@
 			case OP_ADD_BACKGROUND_BITMAP:
 				n = CDR(start);
 
+				// if we are a special argument then don't preload, the bitmap will
+				// get loaded properly later, it may just be a little slower in game
+				if ( !strcmp(Sexp_nodes[n].text, SEXP_ARGUMENT_STRING) )
+					break;
+
 				stars_preload_background_bitmap( CTEXT(n) );
 				break;
 		}
@@ -10558,7 +10590,6 @@
 	// get the subsystems
 	for (; n >= 0; n = CDR(n))
 	{
-		char *subsystem_name = CTEXT(n);
 		ship_subsys *ss = ship_get_subsys(&Ships[ship_num], CTEXT(n));
 		if (ss == NULL)
 			continue;
