Skip to content

Commit

Permalink
NPC mission chain fix (#37255)
Browse files Browse the repository at this point in the history
* check for next mission during dialogue loop

* add verification to clear_mission()

* revert style fix to main menu.h
  • Loading branch information
davidpwbrown authored and ZhilkinSerg committed Jan 20, 2020
1 parent 038f70f commit 4e9ea8c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/npctalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,20 +726,6 @@ void npc::talk_to_u( bool text_only, bool radio_contact )
most_difficult_mission = type.difficulty;
}
}
if( chatbin.mission_selected != nullptr ) {
if( chatbin.mission_selected->get_assigned_player_id() != g->u.getID() ) {
// Don't talk about a mission that is assigned to someone else.
chatbin.mission_selected = nullptr;
}
}
if( chatbin.mission_selected == nullptr ) {
// if possible, select a mission to talk about
if( !chatbin.missions.empty() ) {
chatbin.mission_selected = chatbin.missions.front();
} else if( !d.missions_assigned.empty() ) {
chatbin.mission_selected = d.missions_assigned.front();
}
}

// Needs
if( has_effect( effect_npc_suspend ) ) {
Expand Down Expand Up @@ -785,6 +771,20 @@ void npc::talk_to_u( bool text_only, bool radio_contact )
d_win.open_dialogue( text_only );
// Main dialogue loop
do {
if( chatbin.mission_selected != nullptr ) {
if( chatbin.mission_selected->get_assigned_player_id() != g->u.getID() ) {
// Don't talk about a mission that is assigned to someone else.
chatbin.mission_selected = nullptr;
}
}
if( chatbin.mission_selected == nullptr ) {
// if possible, select a mission to talk about
if( !chatbin.missions.empty() ) {
chatbin.mission_selected = chatbin.missions.front();
} else if( !d.missions_assigned.empty() ) {
chatbin.mission_selected = d.missions_assigned.front();
}
}
d_win.print_header( name );
const talk_topic next = d.opt( d_win, d.topic_stack.back() );
if( next.id == "TALK_NONE" ) {
Expand Down
3 changes: 3 additions & 0 deletions src/npctalk_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ void talk_function::clear_mission( npc &p )
}
if( miss->has_follow_up() ) {
p.add_new_mission( mission::reserve_new( miss->get_follow_up(), p.getID() ) );
if( !p.chatbin.mission_selected ) {
p.chatbin.mission_selected = p.chatbin.missions.front();
}
}
}

Expand Down

0 comments on commit 4e9ea8c

Please sign in to comment.