make names better

This commit is contained in:
Corwin 2023-09-05 22:53:10 +01:00
parent 962b503751
commit 5fc302dec9
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -45,7 +45,7 @@ impl Simulation {
entities.add(item, location); entities.add(item, location);
} }
let (entities, animations) = entities.to_entity_map(); let (entities, animations) = entities.make_entity_map();
for ani in animations { for ani in animations {
animation.populate(ani, sfx); animation.populate(ani, sfx);
} }

View file

@ -34,10 +34,10 @@ impl EntityMapMaker {
} }
pub fn add(&mut self, entity: crate::level::Item, location: Vector2D<i32>) { pub fn add(&mut self, entity: crate::level::Item, location: Vector2D<i32>) {
let idx = self.map.push((entity, location)); self.map.push((entity, location));
} }
pub fn to_entity_map(mut self) -> (EntityMap, Vec<AnimationInstruction>) { pub fn make_entity_map(mut self) -> (EntityMap, Vec<AnimationInstruction>) {
self.map self.map
.sort_unstable_by_key(|(_, location)| location.x + location.y * 100); .sort_unstable_by_key(|(_, location)| location.x + location.y * 100);
let mut entity_map = EntityMap { let mut entity_map = EntityMap {
@ -1111,7 +1111,7 @@ mod tests {
simulator.add(solution_entity.0, solution_entity.1); simulator.add(solution_entity.0, solution_entity.1);
} }
let (mut simulator, _) = simulator.to_entity_map(); let (mut simulator, _) = simulator.make_entity_map();
for &direction in level.directions { for &direction in level.directions {
let (outcome, _) = simulator.tick(&level.map, Action::Direction(direction)); let (outcome, _) = simulator.tick(&level.map, Action::Direction(direction));