mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-13 02:12:22 -06:00
fix: reset code borrows
This commit is contained in:
@@ -208,7 +208,8 @@ impl Game<'_> {
|
||||
// Reset the score
|
||||
self.score = 0;
|
||||
|
||||
// Get valid positions from the cached flood fill
|
||||
// Get valid positions from the cached flood fill and randomize positions in a single block
|
||||
{
|
||||
let mut map = self.map.borrow_mut();
|
||||
let valid_positions = map.get_valid_playable_positions();
|
||||
let mut rng = rand::rng();
|
||||
@@ -232,6 +233,7 @@ impl Game<'_> {
|
||||
self.blinky.base.direction = Direction::Left;
|
||||
self.blinky.mode = crate::ghost::GhostMode::Chase;
|
||||
}
|
||||
}
|
||||
|
||||
self.edibles = reconstruct_edibles(
|
||||
Rc::clone(&self.map),
|
||||
@@ -289,8 +291,7 @@ impl Game<'_> {
|
||||
.copy(&self.map_texture, None, None)
|
||||
.expect("Could not render texture on canvas");
|
||||
|
||||
// Remove old pellet rendering
|
||||
// Instead, render all edibles
|
||||
// Render all edibles
|
||||
for edible in &self.edibles {
|
||||
edible.render(self.canvas);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user