Skip to content

Commit

Permalink
awd
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxyUwU committed Jul 28, 2021
1 parent 52fb80c commit db347a5
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions crates/bevy_ecs/src/world/entity_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,17 +929,19 @@ unsafe fn take_component(
}
}

fn contains_component_with_type(
/// # Safety
/// `entity_location` must be within bounds of the given archetype and `entity` must exist inside
/// the archetype
#[inline]
unsafe fn get_component_with_type(
world: &World,
type_id: TypeId,
target: Option<Entity>,
entity: Entity,
location: EntityLocation,
) -> bool {
world
.components
.get_component_id(type_id)
.map(|component_id| contains_component(world, component_id, target, location))
.unwrap_or(false)
) -> Option<*mut u8> {
let component_id = world.components.get_component_id(type_id)?;
get_component(world, component_id, target, entity, location)
}

/// # Safety
Expand All @@ -956,19 +958,17 @@ unsafe fn get_component_and_ticks_with_type(
get_component_and_ticks(world, component_id, target, entity, location)
}

/// # Safety
/// `entity_location` must be within bounds of the given archetype and `entity` must exist inside
/// the archetype
#[inline]
unsafe fn get_component_with_type(
fn contains_component_with_type(
world: &World,
type_id: TypeId,
target: Option<Entity>,
entity: Entity,
location: EntityLocation,
) -> Option<*mut u8> {
let component_id = world.components.get_component_id(type_id)?;
get_component(world, component_id, target, entity, location)
) -> bool {
world
.components
.get_component_id(type_id)
.map(|component_id| contains_component(world, component_id, target, location))
.unwrap_or(false)
}

fn contains_component(
Expand Down

0 comments on commit db347a5

Please sign in to comment.