From abb000177ace49bfbb504b9be335daf085e86c35 Mon Sep 17 00:00:00 2001 From: Kp Date: Mon, 18 Nov 2019 00:22:34 +0000 Subject: [PATCH] Move bm_read_reactor object type check into if(D1) In Descent 2, `type` is initialized at declaration time, then never rewritten. At the end of the function, `Error` is called if `type` has not been rewritten. Originally, `type` was hard reset to `OL_CONTROL_CENTER`, but this reinitialization was removed when `ObjType` and related data were removed from Descent 2. Reported-by: InsanityBringer (issue 3) Fixes: ea7ba7ae87bb5e1f707dd448ce818c440337416a ("remove ObjType, ObjId, ObjStrength and OL_ constants; use "object" instead of "robot" in some places; draw and place reactors with correct modelnum") --- similar/main/bmread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/similar/main/bmread.cpp b/similar/main/bmread.cpp index 022d5cb04..7bec8d550 100644 --- a/similar/main/bmread.cpp +++ b/similar/main/bmread.cpp @@ -1693,8 +1693,8 @@ void bm_read_reactor(void) char *equal_ptr; short model_num; fix lighting = F1_0/2; // Default - int type=-1; #if defined(DXX_BUILD_DESCENT_I) + int type = -1; fix strength=0; #elif defined(DXX_BUILD_DESCENT_II) assert(Num_reactors < Reactors.size()); @@ -1772,10 +1772,10 @@ void bm_read_reactor(void) else Dead_modelnums[model_num] = -1; +#if defined(DXX_BUILD_DESCENT_I) if (type == -1) Error("No object type specfied for object in BITMAPS.TBL on line %d\n",linenum); -#if defined(DXX_BUILD_DESCENT_I) ObjType[Num_total_object_types] = type; ObjId[Num_total_object_types] = model_num; ObjStrength[Num_total_object_types] = strength;