Skip to content

Commit 41e35bc

Browse files
committed
fix tests
1 parent 3fd64fe commit 41e35bc

18 files changed

Lines changed: 39 additions & 62 deletions

src/level_tick.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -780,15 +780,6 @@ static void level_tick_update_frame_counter(Levelsp v)
780780
static uint32_t level_ts_now;
781781
auto t = time_ms();
782782

783-
//
784-
// We need a more consistent tick for tests that does not vary with time
785-
//
786-
static uint32_t test_t;
787-
if (g_opt_tests) {
788-
test_t++;
789-
t = test_t;
790-
}
791-
792783
if (level_ts_begin == 0U) [[unlikely]] {
793784
level_ts_begin = t;
794785
}

src/my_level.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@ void level_fov(const FovContext & /*ctx*/);
941941
[[nodiscard]] auto level_is_combustible(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
942942
[[nodiscard]] auto level_is_corpse_on_death(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
943943
[[nodiscard]] auto level_is_corridor(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
944+
[[nodiscard]] auto level_is_critical_to_level(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
944945
[[nodiscard]] auto level_is_crushable(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
945946
[[nodiscard]] auto level_is_cursor_path_hazard(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
946947
[[nodiscard]] auto level_is_cursor_path_none(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
@@ -1077,7 +1078,6 @@ void level_fov(const FovContext & /*ctx*/);
10771078
[[nodiscard]] auto level_is_unused3(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
10781079
[[nodiscard]] auto level_is_unused4(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
10791080
[[nodiscard]] auto level_is_unused46(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
1080-
[[nodiscard]] auto level_is_critical_to_level(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
10811081
[[nodiscard]] auto level_is_unused5(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
10821082
[[nodiscard]] auto level_is_unused6(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
10831083
[[nodiscard]] auto level_is_unused63(Gamep g, Levelsp v, Levelp l, const bpoint &p, Thingp me = nullptr) -> Thingp;
@@ -1162,6 +1162,7 @@ void level_fov(const FovContext & /*ctx*/);
11621162
[[nodiscard]] auto level_is_combustible_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
11631163
[[nodiscard]] auto level_is_corpse_on_death_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
11641164
[[nodiscard]] auto level_is_corridor_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
1165+
[[nodiscard]] auto level_is_critical_to_level_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
11651166
[[nodiscard]] auto level_is_crushable_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
11661167
[[nodiscard]] auto level_is_cursor_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
11671168
[[nodiscard]] auto level_is_cursor_path_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
@@ -1298,7 +1299,6 @@ void level_fov(const FovContext & /*ctx*/);
12981299
[[nodiscard]] auto level_is_unused3_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
12991300
[[nodiscard]] auto level_is_unused4_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
13001301
[[nodiscard]] auto level_is_unused46_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
1301-
[[nodiscard]] auto level_is_critical_to_level_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
13021302
[[nodiscard]] auto level_is_unused5_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
13031303
[[nodiscard]] auto level_is_unused6_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
13041304
[[nodiscard]] auto level_is_unused63_cached(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> bool;
@@ -1381,6 +1381,7 @@ void level_fov(const FovContext & /*ctx*/);
13811381
[[nodiscard]] auto level_alive_is_combustible(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
13821382
[[nodiscard]] auto level_alive_is_corpse_on_death(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
13831383
[[nodiscard]] auto level_alive_is_corridor(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
1384+
[[nodiscard]] auto level_alive_is_critical_to_level(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
13841385
[[nodiscard]] auto level_alive_is_crushable(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
13851386
[[nodiscard]] auto level_alive_is_cursor_path_hazard(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
13861387
[[nodiscard]] auto level_alive_is_cursor_path_none(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
@@ -1517,7 +1518,6 @@ void level_fov(const FovContext & /*ctx*/);
15171518
[[nodiscard]] auto level_alive_is_unused3(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
15181519
[[nodiscard]] auto level_alive_is_unused4(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
15191520
[[nodiscard]] auto level_alive_is_unused46(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
1520-
[[nodiscard]] auto level_alive_is_critical_to_level(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
15211521
[[nodiscard]] auto level_alive_is_unused5(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
15221522
[[nodiscard]] auto level_alive_is_unused6(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
15231523
[[nodiscard]] auto level_alive_is_unused63(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
@@ -1600,6 +1600,7 @@ void level_fov(const FovContext & /*ctx*/);
16001600
[[nodiscard]] auto level_count_is_combustible(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
16011601
[[nodiscard]] auto level_count_is_corpse_on_death(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
16021602
[[nodiscard]] auto level_count_is_corridor(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
1603+
[[nodiscard]] auto level_count_is_critical_to_level(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
16031604
[[nodiscard]] auto level_count_is_crushable(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
16041605
[[nodiscard]] auto level_count_is_cursor_path_hazard(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
16051606
[[nodiscard]] auto level_count_is_cursor_path_none(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
@@ -1736,7 +1737,6 @@ void level_fov(const FovContext & /*ctx*/);
17361737
[[nodiscard]] auto level_count_is_unused3(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
17371738
[[nodiscard]] auto level_count_is_unused4(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
17381739
[[nodiscard]] auto level_count_is_unused46(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
1739-
[[nodiscard]] auto level_count_is_critical_to_level(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
17401740
[[nodiscard]] auto level_count_is_unused5(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
17411741
[[nodiscard]] auto level_count_is_unused6(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
17421742
[[nodiscard]] auto level_count_is_unused63(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> uint32_t;
@@ -1826,6 +1826,7 @@ void level_fov(const FovContext & /*ctx*/);
18261826
[[nodiscard]] auto level_open_is_combustible(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
18271827
[[nodiscard]] auto level_open_is_corpse_on_death(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
18281828
[[nodiscard]] auto level_open_is_corridor(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
1829+
[[nodiscard]] auto level_open_is_critical_to_level(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
18291830
[[nodiscard]] auto level_open_is_crushable(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
18301831
[[nodiscard]] auto level_open_is_cursor_path_hazard(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
18311832
[[nodiscard]] auto level_open_is_cursor_path_none(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
@@ -1962,7 +1963,6 @@ void level_fov(const FovContext & /*ctx*/);
19621963
[[nodiscard]] auto level_open_is_unused3(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
19631964
[[nodiscard]] auto level_open_is_unused4(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
19641965
[[nodiscard]] auto level_open_is_unused46(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
1965-
[[nodiscard]] auto level_open_is_critical_to_level(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
19661966
[[nodiscard]] auto level_open_is_unused5(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
19671967
[[nodiscard]] auto level_open_is_unused6(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;
19681968
[[nodiscard]] auto level_open_is_unused63(Gamep g, Levelsp v, Levelp l, const bpoint &p) -> Thingp;

src/my_thing.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ using Thing = struct Thing {
708708
[[nodiscard]] auto thing_is_corpse_on_death(Thingp t) -> bool;
709709
[[nodiscard]] auto thing_is_corpse(Thingp t) -> bool;
710710
[[nodiscard]] auto thing_is_corridor(Thingp t) -> bool;
711+
[[nodiscard]] auto thing_is_critical_to_level(Thingp t) -> bool;
711712
[[nodiscard]] auto thing_is_crushable(Thingp t) -> bool;
712713
[[nodiscard]] auto thing_is_cursor_path_hazard(Thingp t) -> bool;
713714
[[nodiscard]] auto thing_is_cursor_path_none(Thingp t) -> bool;
@@ -859,7 +860,6 @@ using Thing = struct Thing {
859860
[[nodiscard]] auto thing_is_unused3(Thingp t) -> bool;
860861
[[nodiscard]] auto thing_is_unused4(Thingp t) -> bool;
861862
[[nodiscard]] auto thing_is_unused46(Thingp t) -> bool;
862-
[[nodiscard]] auto thing_is_critical_to_level(Thingp t) -> bool;
863863
[[nodiscard]] auto thing_is_unused5(Thingp t) -> bool;
864864
[[nodiscard]] auto thing_is_unused6(Thingp t) -> bool;
865865
[[nodiscard]] auto thing_is_unused63(Thingp t) -> bool;

src/my_time.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ using ts_t = int;
2222
[[nodiscard]] auto time2str(ts_t ms, char *buf, int len) -> const char *;
2323
[[nodiscard]] auto timestamp(char *buf, int len) -> const char *;
2424

25-
[[nodiscard]] auto time_game_ms() -> ts_t;
26-
[[nodiscard]] auto time_game_ms_cached() -> ts_t;
27-
2825
[[nodiscard]] auto time_ms() -> ts_t;
2926
[[nodiscard]] auto time_ms_cached() -> ts_t;
3027

src/my_tp.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
list_macro(is_unused3, "is_unused3"), /* newline */ \
218218
list_macro(is_unused4, "is_unused4"), /* newline */ \
219219
list_macro(is_unused46, "is_unused46"), /* newline */ \
220-
list_macro(is_critical_to_level, "is_critical_to_level"), /* newline */ \
220+
list_macro(is_critical_to_level, "is_critical_to_level"), /* newline */ \
221221
list_macro(is_unused5, "is_unused5"), /* newline */ \
222222
list_macro(is_unused6, "is_unused6"), /* newline */ \
223223
list_macro(is_unused63, "is_unused63"), /* newline */ \
@@ -578,6 +578,7 @@ class Tp;
578578
[[nodiscard]] auto tp_is_combustible(Tpp tp) -> bool;
579579
[[nodiscard]] auto tp_is_corpse_on_death(Tpp tp) -> bool;
580580
[[nodiscard]] auto tp_is_corridor(Tpp tp) -> bool;
581+
[[nodiscard]] auto tp_is_critical_to_level(Tpp tp) -> bool;
581582
[[nodiscard]] auto tp_is_crushable(Tpp tp) -> bool;
582583
[[nodiscard]] auto tp_is_cursor_path_hazard(Tpp tp) -> bool;
583584
[[nodiscard]] auto tp_is_cursor_path_none(Tpp tp) -> bool;
@@ -716,7 +717,6 @@ class Tp;
716717
[[nodiscard]] auto tp_is_unused3(Tpp tp) -> bool;
717718
[[nodiscard]] auto tp_is_unused4(Tpp tp) -> bool;
718719
[[nodiscard]] auto tp_is_unused46(Tpp tp) -> bool;
719-
[[nodiscard]] auto tp_is_critical_to_level(Tpp tp) -> bool;
720720
[[nodiscard]] auto tp_is_unused5(Tpp tp) -> bool;
721721
[[nodiscard]] auto tp_is_unused6(Tpp tp) -> bool;
722722
[[nodiscard]] auto tp_is_unused63(Tpp tp) -> bool;

src/thing_anim.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void thing_anim_time_step(Gamep g, Levelsp v, Levelp l, Thingp t, Tpp tp, int ti
141141
return;
142142
}
143143

144-
if (compiler_unused) {
144+
if (g_opt_tests) {
145145
if (thing_is_level_curr(t)) {
146146
THING_DBG(t, "anim %s index %d [%s]", tile_name(tile).c_str(), t->anim_index, ThingAnimType_to_string(t->anim_type).c_str());
147147
}

src/thing_dead.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void thing_killed_by_player(Gamep g, Levelsp v, Levelp l, Thingp me, Thin
142142
TRACE();
143143

144144
auto *player = e.source;
145-
if (! player) {
145+
if (player == nullptr) {
146146
return;
147147
}
148148

src/thing_push_pop.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44

55
#include "my_callstack.hpp"
66
#include "my_game_defs.hpp"
7+
#include "my_level.hpp"
78
#include "my_level_inlines.hpp"
89
#include "my_main.hpp"
910
#include "my_random.hpp"
1011
#include "my_thing.hpp"
1112
#include "my_thing_inlines.hpp"
1213
#include "my_tp.hpp"
1314
#include "my_types.hpp"
15+
#include <vector>
1416

1517
//
1618
// Push the thing onto the level
1719
//
18-
[[nodiscard]] auto thing_push_internal(Gamep g, Levelsp v, Levelp l, Thingp t) -> bool
20+
[[nodiscard]] static auto thing_push_internal(Gamep g, Levelsp v, Levelp l, Thingp t) -> bool
1921
{
2022
TRACE();
2123

@@ -33,7 +35,7 @@
3335
if (o_id == t->id) {
3436
return true;
3537
}
36-
if (o_id) {
38+
if (o_id != 0u) {
3739
slot_count++;
3840
}
3941
}
@@ -203,7 +205,7 @@
203205
continue;
204206
}
205207

206-
if (level_is_obs_to_movement(g, v, l, new_at)) {
208+
if (level_is_obs_to_movement(g, v, l, new_at) != nullptr) {
207209
continue;
208210
}
209211

@@ -231,7 +233,7 @@
231233
continue;
232234
}
233235

234-
if (level_is_obs_to_movement(g, v, l, new_at)) {
236+
if (level_is_obs_to_movement(g, v, l, new_at) != nullptr) {
235237
continue;
236238
}
237239

src/things/dungeon/entrance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ static auto tp_entrance_detail_get(Gamep g, Levelsp v, Levelp l, Thingp t) -> st
3939
tp_flag_set(tp, is_blit_centered);
4040
tp_flag_set(tp, is_blit_if_has_seen);
4141
tp_flag_set(tp, is_blit_shown_in_chasms);
42-
tp_flag_set(tp, is_critical_to_level);
4342
tp_flag_set(tp, is_blit_shown_in_overlay);
43+
tp_flag_set(tp, is_critical_to_level);
4444
tp_flag_set(tp, is_described_cursor);
4545
tp_flag_set(tp, is_dmap);
4646
tp_flag_set(tp, is_entrance);

src/things/dungeon/exit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ static auto tp_exit_detail_get(Gamep g, Levelsp v, Levelp l, Thingp t) -> std::s
3636
thing_description_set(tp, tp_exit_description_get);
3737
thing_detail_set(tp, tp_exit_detail_get);
3838
tp_flag_set(tp, is_animated);
39-
tp_flag_set(tp, is_critical_to_level);
4039
tp_flag_set(tp, is_blit_centered);
4140
tp_flag_set(tp, is_blit_if_has_seen);
4241
tp_flag_set(tp, is_blit_shown_in_chasms);
4342
tp_flag_set(tp, is_blit_shown_in_overlay);
43+
tp_flag_set(tp, is_critical_to_level);
4444
tp_flag_set(tp, is_described_cursor);
4545
tp_flag_set(tp, is_dmap);
4646
tp_flag_set(tp, is_exit);

0 commit comments

Comments
 (0)