mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Check if the tiles passed are of the correct format
This commit is contained in:
parent
c6bac34294
commit
689bfc642f
|
@ -8,7 +8,6 @@ use agb::{
|
|||
},
|
||||
include_font,
|
||||
};
|
||||
use modular_bitfield::private::checks::FourMod8;
|
||||
|
||||
use core::fmt::Write;
|
||||
|
||||
|
|
|
@ -195,6 +195,14 @@ impl RegularMap {
|
|||
tileset: &TileSet<'_>,
|
||||
tile_setting: TileSetting,
|
||||
) {
|
||||
if tileset.format() != self.colours() {
|
||||
panic!(
|
||||
"Cannot set a {:?} colour tile on a {:?} colour background",
|
||||
tileset.format(),
|
||||
self.colours()
|
||||
);
|
||||
}
|
||||
|
||||
let pos = self.map_size().gba_offset(pos);
|
||||
|
||||
let old_tile = self.tiles_mut()[pos];
|
||||
|
|
|
@ -57,6 +57,10 @@ impl<'a> TileSet<'a> {
|
|||
fn reference(&self) -> NonNull<[u8]> {
|
||||
self.tiles.into()
|
||||
}
|
||||
|
||||
pub(crate) fn format(&self) -> TileFormat {
|
||||
self.format
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
Loading…
Reference in a new issue