Fix revoke debug privs not reliably turn off stuff (#11409)

This commit is contained in:
Wuzzy 2021-07-12 18:32:18 +00:00 committed by GitHub
parent 5c89a0e12a
commit b7b5aad027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -677,7 +677,7 @@ protected:
bool handleCallbacks(); bool handleCallbacks();
void processQueues(); void processQueues();
void updateProfilers(const RunStats &stats, const FpsControl &draw_times, f32 dtime); void updateProfilers(const RunStats &stats, const FpsControl &draw_times, f32 dtime);
void updateBasicDebugState(); void updateDebugState();
void updateStats(RunStats *stats, const FpsControl &draw_times, f32 dtime); void updateStats(RunStats *stats, const FpsControl &draw_times, f32 dtime);
void updateProfilerGraphs(ProfilerGraph *graph); void updateProfilerGraphs(ProfilerGraph *graph);
@ -1123,7 +1123,7 @@ void Game::run()
updatePlayerControl(cam_view); updatePlayerControl(cam_view);
step(&dtime); step(&dtime);
processClientEvents(&cam_view_target); processClientEvents(&cam_view_target);
updateBasicDebugState(); updateDebugState();
updateCamera(draw_times.busy_time, dtime); updateCamera(draw_times.busy_time, dtime);
updateSound(dtime); updateSound(dtime);
processPlayerInteraction(dtime, m_game_ui->m_flags.show_hud, processPlayerInteraction(dtime, m_game_ui->m_flags.show_hud,
@ -1728,18 +1728,24 @@ void Game::processQueues()
shader_src->processQueue(); shader_src->processQueue();
} }
void Game::updateBasicDebugState() void Game::updateDebugState()
{ {
bool has_basic_debug = client->checkPrivilege("basic_debug");
bool has_debug = client->checkPrivilege("debug");
if (m_game_ui->m_flags.show_basic_debug) { if (m_game_ui->m_flags.show_basic_debug) {
if (!client->checkPrivilege("basic_debug")) { if (!has_basic_debug) {
m_game_ui->m_flags.show_basic_debug = false; m_game_ui->m_flags.show_basic_debug = false;
hud->disableBlockBounds();
} }
} else if (m_game_ui->m_flags.show_minimal_debug) { } else if (m_game_ui->m_flags.show_minimal_debug) {
if (client->checkPrivilege("basic_debug")) { if (has_basic_debug) {
m_game_ui->m_flags.show_basic_debug = true; m_game_ui->m_flags.show_basic_debug = true;
} }
} }
if (!has_basic_debug)
hud->disableBlockBounds();
if (!has_debug)
draw_control->show_wireframe = false;
} }
void Game::updateProfilers(const RunStats &stats, const FpsControl &draw_times, void Game::updateProfilers(const RunStats &stats, const FpsControl &draw_times,