mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 01:21:34 +11:00
mark get object as unsafe
This commit is contained in:
parent
432c7f12f0
commit
bea753d81a
|
@ -52,7 +52,7 @@ fn main(_argc: isize, _argv: *const *const u8) -> isize {
|
||||||
object.enable();
|
object.enable();
|
||||||
unsafe { object.clear_objects() };
|
unsafe { object.clear_objects() };
|
||||||
let mut chicken = Character {
|
let mut chicken = Character {
|
||||||
object: object.get_object(0),
|
object: unsafe { object.get_object(0) },
|
||||||
position: Vector2D {
|
position: Vector2D {
|
||||||
x: 20 << 8,
|
x: 20 << 8,
|
||||||
y: 20 << 8,
|
y: 20 << 8,
|
||||||
|
|
|
@ -102,7 +102,7 @@ impl ObjectControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Safety
|
/// # Safety
|
||||||
/// Temporary
|
/// Temporary, do not call if you currently hold an object
|
||||||
pub unsafe fn clear_objects(&mut self) {
|
pub unsafe fn clear_objects(&mut self) {
|
||||||
let mut o = ObjectAttributeStandard::new();
|
let mut o = ObjectAttributeStandard::new();
|
||||||
o.set_mode(Mode::Hidden);
|
o.set_mode(Mode::Hidden);
|
||||||
|
@ -124,7 +124,9 @@ impl ObjectControl {
|
||||||
DISPLAY_CONTROL.set(disp);
|
DISPLAY_CONTROL.set(disp);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_object(&self, id: usize) -> ObjectStandard {
|
/// # Safety
|
||||||
|
/// Temporary function, you must not get multiple objects with the same id
|
||||||
|
pub unsafe fn get_object(&self, id: usize) -> ObjectStandard {
|
||||||
assert!(id < 128, "object id must be less than 128");
|
assert!(id < 128, "object id must be less than 128");
|
||||||
ObjectStandard {
|
ObjectStandard {
|
||||||
attributes: ObjectAttributeStandard::new(),
|
attributes: ObjectAttributeStandard::new(),
|
||||||
|
|
Loading…
Reference in a new issue