Skip to content
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

NPC crash bug (w/details) - When reporting completion of mission #359

Closed
GlyphGryph opened this issue Apr 3, 2013 · 2 comments
Closed
Labels
<Bug> This needs to be fixed NPC / Factions NPCs, AI, Speech, Factions, Ownership
Milestone

Comments

@GlyphGryph
Copy link
Contributor

Bug found in npcs. miss->val is not set.

In
std::vector<talk_response> gen_responses(talk_topic topic, game *g, npc *p)
on line 594, miss->val is being called, but mission is NULL (explicitly set line 446)

Is it because I lied? Testing says NOEP.jpg

Note: 'p' is the npc

(gdb) print miss
$5 = (mission *) 0x0
(gdb) print miss->value
Cannot access memory at address 0x14
(gdb) print miss->description
Cannot access memory at address 0x8
(gdb) bt
#0 0x0000000000c0410d in gen_responses (topic=TALK_MISSION_SUCCESS, g=0x7ffff7f82010, p=0x35e7830) at npctalk.cpp:594
#1 0x0000000000c0c96a in dialogue::opt (this=0x7fffffffdac0, topic=TALK_MISSION_SUCCESS, g=0x7ffff7f82010) at npctalk.cpp:1562
#2 0x0000000000c000a9 in npc::talk_to_u (this=0x35e7830, g=0x7ffff7f82010) at npctalk.cpp:121
#3 0x000000000062da59 in game::chat (this=0x7ffff7f82010) at game.cpp:6592
#4 0x0000000000604360 in game::handle_action (this=0x7ffff7f82010) at game.cpp:1248
#5 0x00000000005fffd2 in game::do_turn (this=0x7ffff7f82010) at game.cpp:402
#6 0x00000000008709f1 in main (argc=0, argv=0x7fffffffe7e0) at main.cpp:70

(gdb) print ret[0]->mission_index
$12 = -1
(gdb) print p
$13 = (npc *) 0x35e7830
(gdb) print p->op_of_u
$14 = {trust = 3, fear = -3, value = 5, anger = -1, owed = 800, favors = {<std::_Vector_base<npc_favor, std::allocator<npc_favor> >> = {
_M_impl = {std::allocator<npc_favor> = {<__gnu_cxx::new_allocator<npc_favor>> = {}, }, _M_start = 0x0, _M_finish = 0x0,
_M_end_of_storage = 0x0}}, }}
(gdb) print p->op_of_u.owed
$15 = 800
(gdb) print p
$16 = (npc *) 0x35e7830
(gdb) print p->chatbin
$17 = {missions = {<std::_Vector_base<int, std::allocator >> = {
_M_impl = {std::allocator = {<__gnu_cxx::new_allocator> = {}, }, _M_start = 0x3c41a50, _M_finish = 0x3c41a54,
_M_end_of_storage = 0x3c41a54}}, }, missions_assigned = {<std::_Vector_base<int, std::allocator >> = {
_M_impl = {std::allocator = {<__gnu_cxx::new_allocator> = {}, }, _M_start = 0x35e68c0, _M_finish = 0x35e68c0,
_M_end_of_storage = 0x35e68c4}}, }, mission_selected = -1, tempvalue = 0, first_topic = TALK_SHELTER}
(gdb) print p->chatbin.missions_assigned.size()
$24 = 0
(gdb) print selected
$25 = -1
(gdb) print p->chatbin.mission_selected
$29 = -1
(gdb) print topic
$26 = TALK_MISSION_SUCCESS

The problem has to be earlier - Why is the topic Mission Success being passed if no mission is in the chatbin and mission_selected == -1?

dynamic_line has a special check to make sure mission is not -1 - include that here? (line 147)

These are the only times mission_selected is set to -1
Line 1289

this is triggered only by "clear_mission" calls:
All TALK_MISSION_SUCCESS options 591
TALK_MISSION_SUCCESS_LIE: 613
TALK_MISSION_REWARD: 623

However, it is also initialized with a value of -1, and since none of the above seem a likely source (unless actions are being double sent), I'm assuming it's never being sent properly

@HeatherSoron
Copy link
Contributor

Seems like this may have been fixed by Soyweiser's NPC/mission fixes. At least, I'm not having any luck reproducing this with debug-assisted mission completion, even though I'm choosing the "I need no payment" option (which I think is what triggered this for you?). It also sounds like something that Soyweiser may have fixed.

@GlyphGryph
Copy link
Contributor Author

In that case I'll close it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

No branches or pull requests

2 participants