Fix crash on failure to create afterburner blob

Fix crash on failure to recreate thief.
This commit is contained in:
Kp 2014-09-13 22:01:17 +00:00
parent cbe07f023c
commit 039bf2f0b7
3 changed files with 17 additions and 7 deletions

View file

@ -20,6 +20,12 @@
((void)0)
#endif
#ifdef DXX_HAVE_CXX11_REF_QUALIFIER
#define DXX_VALPTRIDX_REF_QUALIFIER_LVALUE &
#else
#define DXX_VALPTRIDX_REF_QUALIFIER_LVALUE
#endif
#define DXX_VALPTRIDX_CHECK(E,S,success,failure) \
( \
DXX_VALPTRIDX_STATIC_CHECK(E,dxx_trap_##failure,S), \
@ -90,8 +96,12 @@ public:
p(p)
{
}
pointer_type operator->() const { return p; }
operator pointer_type() const { return p; }
pointer_type operator->() const DXX_VALPTRIDX_REF_QUALIFIER_LVALUE { return p; }
operator pointer_type() const DXX_VALPTRIDX_REF_QUALIFIER_LVALUE { return p; }
#ifdef DXX_HAVE_CXX11_REF_QUALIFIER
pointer_type operator->() const && = delete;
operator pointer_type() const && = delete;
#endif
/* Only vvalptr_t can implicitly convert to reference */
operator reference() const = delete;
bool operator==(const pointer_type &rhs) const { return p == rhs; }

View file

@ -1183,12 +1183,13 @@ void recreate_thief(object *objp)
{
segnum_t segnum;
vms_vector center_point;
object *new_obj;
segnum = choose_thief_recreation_segment();
compute_segment_center(&center_point, &Segments[segnum]);
new_obj = create_morph_robot( &Segments[segnum], &center_point, objp->id);
auto new_obj = create_morph_robot( &Segments[segnum], &center_point, objp->id);
if (new_obj == object_none)
return;
init_ai_object(new_obj, AIB_SNIPE, segment_none);
Re_init_thief_time = GameTime64 + F1_0*10; // In 10 seconds, re-initialize thief.
}

View file

@ -1400,9 +1400,8 @@ void drop_afterburner_blobs(object *obj, int count, fix size_scale, fix lifetime
if (count > 1) {
segnum = find_point_seg(&pos_right, obj->segnum);
if (segnum != segment_none) {
object *blob_obj;
blob_obj = object_create_explosion(segnum, &pos_right, size_scale, VCLIP_AFTERBURNER_BLOB );
if (lifetime != -1)
auto blob_obj = object_create_explosion(segnum, &pos_right, size_scale, VCLIP_AFTERBURNER_BLOB );
if (lifetime != -1 && blob_obj != object_none)
blob_obj->lifeleft = lifetime;
}
}