Skip to content

Commit 5bcc89b

Browse files
author
Goober5000
committed
one small bugfix, one small comment tweak
This fixes a bug where, when the skybox is changed after loading a new mission, it tries to delete its model instance which was already deleted in model_instance_free_all. Setting the instance reference to -1 when the instance is freed fixes this. (This is something that would typically be handled by the object_delete function, as it is for ship_delete, asteroid_delete, and weapon_delete, but there is no such equivalent for skyboxes.) Since this is such a small PR, I decided to also include a stash where I restored a comment that was inadvertently deleted by Swifty's hud_lock variable scope fix PR.
1 parent 7a7abe1 commit 5bcc89b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

code/hud/hudlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ void HudGaugeLock::render(float frametime)
253253
}
254254
}
255255

256+
// show locked indicator
256257
Lock_gauge.sx = sx - Lock_gauge_half_w;
257258
Lock_gauge.sy = sy - Lock_gauge_half_h;
258-
259259
if (Player_ai->current_target_is_locked) {
260260
hud_anim_render(&Lock_gauge, 0.0f, 1);
261261
} else {

code/model/modelread.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ void model_instance_free_all()
352352
}
353353
}
354354

355+
// clear skybox model instance if we have one; it is not an object and therefore has no <object>_delete function which would remove the instance
356+
extern int Nmodel_instance_num;
357+
Nmodel_instance_num = -1;
358+
355359
Polygon_model_instances.clear();
356360
}
357361

0 commit comments

Comments
 (0)