olafurw / poke-fighting-rust

Application that simulates a large grid of Pokémon types fighting each other.
24 stars 3 forks source link

Fixed regression from #36: Wrong position calculation if width and height aren't identical #40

Closed palant closed 2 years ago

palant commented 2 years ago

I noticed lines in the display if I specify an image size that’s not square. Turns out, this is a regression from #36: wrong calculation in Battle::action().

While looking for the bug, I added a test making sure that Grid2D::get_pair_mut() operates on the same data as is returned by Grid2D::get() later. It’s probably a good idea to keep this one.