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 <https://github.com/dxx-rebirth/dxx-rebirth/issues/464> (issue 3)
Fixes: ea7ba7ae87 ("remove ObjType, ObjId, ObjStrength and OL_ constants; use "object" instead of "robot" in some places; draw and place reactors with correct modelnum")
This commit is contained in:
Kp 2019-11-18 00:22:34 +00:00
parent adf12be0be
commit abb000177a

View file

@ -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;