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

bsnes/sfc/controller/justifier/justifier.cpp: probably unintended player2 instead of player1 in player1-related statement group #282

Open
Marat-Tanalin opened this issue May 9, 2023 · 2 comments

Comments

@Marat-Tanalin
Copy link

Marat-Tanalin commented May 9, 2023

Potential typo in bsnes/sfc/controller/justifier/justifier.cpp. The code contains two groups of similar statements, first group sets properties of player1, second group does the same for player2:

  player1.x = 256 / 2;
  player1.y = 240 / 2;
  player1.trigger = false;
  player2.start = false;

  player2.x = 256 / 2;
  player2.y = 240 / 2;
  player2.trigger = false;
  player2.start = false;

But the last line of the first group contains player2 instead of player1. This might be a bug, not just because of obvious grouping, but also given that the second group contains the same statement player2.start = false; too, and such duplication is unlikely intentional.

@Screwtapello
Copy link
Contributor

Looks like this change was introduced in v084r05 (6227974), and probably has gone unnoticed for this long because these defaults are immediately overwritten as soon as the game reads the emulated controller state (and bsnes polls its mapped controllers).

It should probably still be fixed, though.

@jeffythedragonslayer
Copy link

jeffythedragonslayer commented May 27, 2023

I agree with Screwtape; why not turn player1 and player2 into two elements of an array while we're at it? Copypasta is how these kinds of mistakes happen, in my experience.

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

3 participants