- Skills shake nearby shelves, tables and garbage cans into paper + rock debris; props stay intact, destroyed bins stop shedding, and rock debris can originate from prop surfaces - Manual K always casts WARP (field drops ahead of the agent when no crowd is in range); autoplay still waits for a real target - Add opt-in --trace categories for silent skill decisions, debris bursts, input and consumed events, with zero cost when disabled - Add debris_surface_wiring and debug_trace_toggle regression tests
46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
// Opt-in debug tracing: category parsing and enable/disable behaviour.
|
|
#include <cstdio>
|
|
|
|
#include "core/debug.hpp"
|
|
|
|
namespace {
|
|
|
|
bool failed = false;
|
|
|
|
void check(bool ok, const char* what) {
|
|
if (!ok) {
|
|
std::printf("FAIL: %s\n", what);
|
|
failed = true;
|
|
}
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int main() {
|
|
unsigned mask = debug::All;
|
|
check(debug::parse(nullptr, mask) && mask == debug::None,
|
|
"null category list clears the mask");
|
|
check(debug::parse("", mask) && mask == debug::None,
|
|
"empty category list clears the mask");
|
|
check(debug::parse("skills", mask) && mask == debug::Skills,
|
|
"single category parses");
|
|
check(debug::parse("skills,debris", mask)
|
|
&& mask == (debug::Skills | debug::Debris),
|
|
"comma-separated categories parse");
|
|
check(debug::parse(" skills , input ", mask)
|
|
&& mask == (debug::Skills | debug::Input),
|
|
"whitespace around names is ignored");
|
|
check(debug::parse("all", mask) && mask == debug::All,
|
|
"'all' enables every category");
|
|
check(!debug::parse("nope", mask) && mask == debug::All,
|
|
"unknown category fails without changing the mask");
|
|
|
|
debug::set_mask(debug::Skills);
|
|
check(debug::enabled(debug::Skills), "enabled category reports true");
|
|
check(!debug::enabled(debug::Debris), "disabled category reports false");
|
|
debug::set_mask(debug::None);
|
|
|
|
if (failed) return 1;
|
|
std::printf("debug: OK\n");
|
|
return 0;
|
|
}
|