Skip to content

Commit

Permalink
bug: robot would get stuck waiting on the inventory to close
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Aug 6, 2023
1 parent 5554384 commit 86d1a86
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 1 deletion.
100 changes: 100 additions & 0 deletions TESTME
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,106 @@ if [ ! -x zorbash ]; then
fi

for seed in \
1 \
2 \
3 \
4 \
5 \
6 \
7 \
8 \
9 \
10 \
11 \
12 \
13 \
14 \
15 \
16 \
17 \
18 \
19 \
20 \
21 \
22 \
23 \
24 \
25 \
26 \
27 \
28 \
29 \
30 \
31 \
32 \
33 \
34 \
35 \
36 \
37 \
38 \
39 \
40 \
41 \
42 \
43 \
44 \
45 \
46 \
47 \
48 \
49 \
50 \
51 \
52 \
53 \
54 \
55 \
56 \
57 \
58 \
59 \
60 \
61 \
62 \
63 \
64 \
65 \
66 \
67 \
68 \
69 \
70 \
71 \
72 \
73 \
74 \
75 \
76 \
77 \
78 \
79 \
80 \
81 \
82 \
83 \
84 \
85 \
86 \
87 \
88 \
89 \
90 \
91 \
92 \
93 \
94 \
95 \
96 \
97 \
98 \
99 \
100 \
alphabase \
apecastle \
badmonkey \
Expand Down
5 changes: 5 additions & 0 deletions src/level_tick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void Level::handle_input_events(void)
void Level::tick_(void)
{
TRACE_NO_INDENT();
DBG("Level tick");

if (g_opt_test_dungeon_gen) {
//
Expand Down Expand Up @@ -526,6 +527,9 @@ void Level::tick_(void)
// No point in waiting any more.
//
} else {
//
// Keep waiting
//
return;
}
}
Expand Down Expand Up @@ -719,6 +723,7 @@ void Level::tick_begin_now(void)
// A new game event has occurred?
//
if (game->tick_requested.empty()) {
dbg("No tick requested");
return;
}

Expand Down
14 changes: 13 additions & 1 deletion src/wid_inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ void wid_inventory_fini(bool remake)
DBG2("Close inventory");
TRACE_AND_INDENT();

auto level = game->get_current_level();
if (! level) {
return;
}

auto player = level->player;
if (! player) {
return;
}

if (wid_inventory_thing_info) {
DBG2("Close inventory; delete inventory thing info");
delete wid_inventory_thing_info;
Expand Down Expand Up @@ -57,7 +67,9 @@ void wid_inventory_fini(bool remake)
wid_destroy(&wid_inventory_window);
game->set_request_to_remake_rightbar();
if (! remake) {
game->change_state(Game::STATE_NORMAL, "inventory close");
player->change_state(MONST_STATE_IDLE, "closed inventory");
game->change_state(Game::STATE_NORMAL, "closed inventory");
game->tick_begin("closed inventory");
}
}
}
Expand Down

0 comments on commit 86d1a86

Please sign in to comment.