Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with enable VISUALIZE_AI_DEBUG #196

Open
aaronorosen2 opened this issue May 25, 2023 · 0 comments
Open

Issues with enable VISUALIZE_AI_DEBUG #196

aaronorosen2 opened this issue May 25, 2023 · 0 comments

Comments

@aaronorosen2
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant