General code cleanup #3

Merged
wilson048 merged 3 commits from Lui798/3DS-Sweeper:general-cleanup into main 2024-09-24 01:27:58 -05:00
Contributor
  • Grid array is now width-by-height (all loops changed to account for this)
  • minesweeper_regenerate_board is used to initialized the board to reduce duplicate code
  • Using a pointer to store the current tile in multiple loops instead of accessing array multiple times

Currently the most recent change I made broke something with revealing tiles. Maybe I messed something up and a tile value isn't getting set properly, which is causing the function to misbehave?

- Grid array is now width-by-height (all loops changed to account for this) - minesweeper_regenerate_board is used to initialized the board to reduce duplicate code - Using a pointer to store the current tile in multiple loops instead of accessing array multiple times Currently the most recent change I made broke something with revealing tiles. Maybe I messed something up and a tile value isn't getting set properly, which is causing the function to misbehave?
Lui798 force-pushed general-cleanup from 8b77f780c9 to 845973f57f 2024-09-23 22:05:59 -05:00 Compare
wilson048 approved these changes 2024-09-23 22:39:35 -05:00
Dismissed
wilson048 left a comment

I think it might have to do with me changing grid inside minesweeper_t from minesweeper_tile_t grid[GRID_HEIGHT][GRID_WIDTH] to minesweeper_tile_t** grid so I could customize the size of the grid later down the road

I think it might have to do with me changing grid inside minesweeper_t from minesweeper_tile_t grid[GRID_HEIGHT][GRID_WIDTH] to minesweeper_tile_t** grid so I could customize the size of the grid later down the road
Author
Contributor

This bug was happening before I rebased on that commit, I originally committed the changes with the old array in place.

This bug was happening before I rebased on that commit, I originally committed the changes with the old array in place.
Not sure why the variables need to be initialized early like this if they are getting set to zero later anyway?
Lui798 changed title from WIP: General code cleanup to General code cleanup 2024-09-23 23:13:30 -05:00
Author
Contributor

Fixed by reverting loop variable initialization in minesweeper_regenerate_board back to original behaviour.
Really not sure why it needs to be done that way though...

Fixed by reverting loop variable initialization in `minesweeper_regenerate_board` back to original behaviour. Really not sure why it needs to be done that way though...
wilson048 approved these changes 2024-09-24 01:27:18 -05:00
wilson048 left a comment

That's really weird, I'll probably have to try it myself then

That's really weird, I'll probably have to try it myself then
wilson048 referenced this pull request from a commit 2024-09-24 01:28:00 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
wilson048/3DS-Sweeper!3
No description provided.