File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1083,8 +1083,10 @@ void asteroid_delete( object * obj )
10831083
10841084 asp = &Asteroids[num];
10851085
1086- if (asp->model_instance_num >= 0 )
1086+ if (asp->model_instance_num >= 0 ) {
10871087 model_delete_instance (asp->model_instance_num );
1088+ asp->model_instance_num = -1 ;
1089+ }
10881090
10891091 if (asp->target_objnum >= 0 ) {
10901092 for (asteroid_target& target : Asteroid_targets) {
Original file line number Diff line number Diff line change @@ -248,6 +248,7 @@ void debris_delete( object * obj )
248248
249249 if (db->model_instance_num >= 0 ) {
250250 model_delete_instance (db->model_instance_num );
251+ db->model_instance_num = -1 ;
251252 }
252253
253254 if ( db->is_hull ) {
Original file line number Diff line number Diff line change @@ -3196,6 +3196,8 @@ void model_render_set_wireframe_color(const color* clr)
31963196void modelinstance_replace_active_texture (polymodel_instance* pmi, const char * old_name, const char * new_name)
31973197{
31983198 Assert (pmi != nullptr );
3199+ if (pmi == nullptr )
3200+ return ;
31993201 polymodel* pm = model_get (pmi->model_num );
32003202
32013203 int final_index = -1 ;
Original file line number Diff line number Diff line change @@ -592,6 +592,7 @@ void prop_delete(object* obj)
592592 propp.glow_point_bank_active .clear ();
593593
594594 model_delete_instance (propp.model_instance_num );
595+ propp.model_instance_num = -1 ;
595596
596597 // Leave the slot empty for the duration of the scene
597598 // The Props array will be compacted at the end of the level
Original file line number Diff line number Diff line change @@ -8986,12 +8986,16 @@ void ship_delete( object * obj )
89868986 ct_ship_delete(shipp);
89878987
89888988 model_delete_instance(shipp->model_instance_num);
8989+ shipp->model_instance_num = -1;
89898990
89908991 // free up any weapon model instances
89918992 for (int i = 0; i < shipp->weapons.num_primary_banks; ++i)
89928993 {
89938994 if (shipp->weapons.primary_bank_external_model_instance[i] >= 0)
8995+ {
89948996 model_delete_instance(shipp->weapons.primary_bank_external_model_instance[i]);
8997+ shipp->weapons.primary_bank_external_model_instance[i] = -1;
8998+ }
89958999 }
89969000}
89979001
Original file line number Diff line number Diff line change @@ -5336,8 +5336,10 @@ void weapon_delete(object *obj)
53365336 if (wp->hud_in_flight_snd_sig .isValid () && snd_is_playing (wp->hud_in_flight_snd_sig ))
53375337 snd_stop (wp->hud_in_flight_snd_sig );
53385338
5339- if (wp->model_instance_num >= 0 )
5339+ if (wp->model_instance_num >= 0 ) {
53405340 model_delete_instance (wp->model_instance_num );
5341+ wp->model_instance_num = -1 ;
5342+ }
53415343
53425344 if (wp->cmeasure_ignore_list != nullptr ) {
53435345 delete wp->cmeasure_ignore_list ;
You can’t perform that action at this time.
0 commit comments