Issues with enable VISUALIZE_AI_DEBUG
aaronorosen2 opened this issue · comments
src/game.cpp:1315:72: error: ‘class Toggle’ has no member named ‘just_down’
1315 | if (button_pressed != eventsystem.GetKeyState(SDLK_F9).just_down)
| ^~~~~~~~~
I changed just_down to be
-
if (button_pressed != eventsystem.GetKeyState(SDLK_F9).GetImpulseRising())
though i'm not able to get the code to enter this segment
bool player_control = car_info[player_car_id].driver.empty();
#ifdef VISUALIZE_AI_DEBUG
if (!player_control) // XXX If i hack this to be like 1 || !player_control we get a segfault later on
{
// It allows to deactivate the AI on the player car with F9 button.
// This is useful for bringing the car in strange
// situations and test how the AI solves it.
static bool override_ai = false;
static bool button_pressed = false;
if (button_pressed != eventsystem.GetKeyState(SDLK_F9).just_down)
{
button_pressed = !button_pressed;
if (button_pressed)
{
override_ai = !override_ai;
if (override_ai)
info_output << "Switching to user controlled player car." << std::endl;
else
info_output << "Switching to ai controlled player car." << std::endl;
}
}
player_control = override_ai;
}
#endif