-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mission Chain Nullptr #36586
Comments
This was referenced Jan 5, 2020
untested fix proposal: diff --git a/src/npctalk.cpp b/src/npctalk.cpp
index d700556fa3..e61384eecd 100644
--- a/src/npctalk.cpp
+++ b/src/npctalk.cpp
@@ -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 ) ) {
@@ -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" ) {
diff --git a/src/npctalk_funcs.cpp b/src/npctalk_funcs.cpp
index 57ab1a431a..9b3ce092d3 100644
--- a/src/npctalk_funcs.cpp
+++ b/src/npctalk_funcs.cpp
@@ -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();
+ }
}
} It's a little brute force, but it should force every dynamic line/response pair to have a valid |
ghost
mentioned this issue
Jan 20, 2020
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
In mission chains after some undetermined number of them a NullPtr is thrown when attempting to accept the next mission in a chain or if there is no defined next mission.
Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
Presumably the NPC should give the next mission in the chain without issue. Or simply say he has no more missions for you if you reach the end of the chain.
Screenshots
Versions and configuration
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food]
]
Additional context
testddave.zip
This save will show the issue, simply speak to DDave and give him the cardboard and ask for the next mission in the chain.
As a reference, #35597 also shows this issue, though in that case it seems to happen after the second mission in the chain. I'm not sure why the difference yet.
The text was updated successfully, but these errors were encountered: