Always set hide_segment in init_ai_object
Fixes bug where in the editor, you insert a robot with normal behaviour then play the level - it fails the check on the hide_segment index in init_ai_objects(). This is because hide_segment was written as the poisoned value of 0xfdfd if the behaviour of the robot is AIB_NORMAL - because hide_segment wasn't initialised. Therefore, always setting hide_segment to suppress this exception (it's an inexpensive operation seldom called).
This commit is contained in:
parent
fd2c8df74e
commit
f2f6af5bf1
|
@ -534,17 +534,10 @@ void init_ai_object(object &objp, ai_behavior behavior, const segidx_t hide_segm
|
|||
ailp->next_misc_sound_time = GameTime64;
|
||||
ailp->time_player_sound_attacked = GameTime64;
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
if ((behavior == ai_behavior::AIB_HIDE) || (behavior == ai_behavior::AIB_FOLLOW_PATH) || (behavior == ai_behavior::AIB_STATION) || (behavior == ai_behavior::AIB_RUN_FROM))
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
if ((behavior == ai_behavior::AIB_SNIPE) || (behavior == ai_behavior::AIB_STATION) || (behavior == ai_behavior::AIB_RUN_FROM) || (behavior == ai_behavior::AIB_FOLLOW))
|
||||
#endif
|
||||
{
|
||||
aip->hide_segment = hide_segment;
|
||||
ailp->goal_segment = hide_segment;
|
||||
aip->hide_index = -1; // This means the path has not yet been created.
|
||||
aip->cur_path_index = 0;
|
||||
}
|
||||
aip->hide_segment = hide_segment;
|
||||
ailp->goal_segment = hide_segment;
|
||||
aip->hide_index = -1; // This means the path has not yet been created.
|
||||
aip->cur_path_index = 0;
|
||||
|
||||
aip->SKIP_AI_COUNT = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue