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

LightsOut border crash #33

Closed
Taste83 opened this issue Sep 21, 2019 · 1 comment
Closed

LightsOut border crash #33

Taste83 opened this issue Sep 21, 2019 · 1 comment

Comments

@Taste83
Copy link

Taste83 commented Sep 21, 2019

The border bug where the game crashes when panning out to the border is due to missing boundry checks in EntityConfigManager_LoadGeneratedEntities_Patch.Prefix. (LightsOutPatches.cs)

Code below crashes when trying to access cell -1 as CellAbove, CellUpRight etc returns -1 when at the border.

var light = (Grid.LightIntensity[Grid.CellAbove(cell)]
+ Grid.LightIntensity[Grid.CellUpRight(cell)]
+ Grid.LightIntensity[Grid.CellRight(cell)]
+ Grid.LightIntensity[Grid.CellDownRight(cell)]
+ Grid.LightIntensity[Grid.CellBelow(cell)]
+ Grid.LightIntensity[Grid.CellDownLeft(cell)]
+ Grid.LightIntensity[Grid.CellLeft(cell)]
+ Grid.LightIntensity[Grid.CellUpLeft(cell)])
/ 8;

Creating a helper that checks for < 0 seems to fix the problem.

@Cairath
Copy link
Owner

Cairath commented Sep 21, 2019

Aye, that's an oversight, thanks.

@Cairath Cairath closed this as completed Sep 21, 2019
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

2 participants