avm1: Rename Library::instantiate_by_id

This commit is contained in:
Mike Welsh 2019-12-17 03:25:52 -08:00
parent fc3878d6d9
commit dae3e27fb3
4 changed files with 13 additions and 13 deletions

View File

@ -272,11 +272,11 @@ pub fn duplicate_movie_clip<'gc>(
if depth < 0 || depth > 2_130_706_428 { if depth < 0 || depth > 2_130_706_428 {
return Ok(Value::Undefined.into()); return Ok(Value::Undefined.into());
} }
if let Ok(mut new_clip) = context.library.instantiate_display_object_by_id( if let Ok(mut new_clip) =
movie_clip.id(), context
context.gc_context, .library
&avm.prototypes, .instantiate_by_id(movie_clip.id(), context.gc_context, &avm.prototypes)
) { {
// Set name and attach to parent. // Set name and attach to parent.
new_clip.set_name(context.gc_context, &new_instance_name); new_clip.set_name(context.gc_context, &new_instance_name);
parent.add_child_from_avm(context, new_clip, depth); parent.add_child_from_avm(context, new_clip, depth);

View File

@ -143,7 +143,7 @@ impl<'gc> ButtonData<'gc> {
self.children.clear(); self.children.clear();
for record in &self.static_data.records { for record in &self.static_data.records {
if record.states.contains(&swf_state) { if record.states.contains(&swf_state) {
if let Ok(mut child) = context.library.instantiate_display_object_by_id( if let Ok(mut child) = context.library.instantiate_by_id(
record.id, record.id,
context.gc_context, context.gc_context,
&context.system_prototypes, &context.system_prototypes,
@ -173,7 +173,7 @@ impl<'gc> ButtonData<'gc> {
for record in &self.static_data.records { for record in &self.static_data.records {
if record.states.contains(&swf::ButtonState::HitTest) { if record.states.contains(&swf::ButtonState::HitTest) {
match context.library.instantiate_display_object_by_id( match context.library.instantiate_by_id(
record.id, record.id,
context.gc_context, context.gc_context,
&context.system_prototypes, &context.system_prototypes,

View File

@ -494,11 +494,11 @@ impl<'gc> MovieClipData<'gc> {
place_object: &swf::PlaceObject, place_object: &swf::PlaceObject,
copy_previous_properties: bool, copy_previous_properties: bool,
) -> Option<DisplayObject<'gc>> { ) -> Option<DisplayObject<'gc>> {
if let Ok(mut child) = context.library.instantiate_display_object_by_id( if let Ok(mut child) =
id, context
context.gc_context, .library
&context.system_prototypes, .instantiate_by_id(id, context.gc_context, &context.system_prototypes)
) { {
// Remove previous child from children list, // Remove previous child from children list,
// and add new childonto front of the list. // and add new childonto front of the list.
let prev_child = self.children.insert(depth, child); let prev_child = self.children.insert(depth, child);

View File

@ -75,7 +75,7 @@ impl<'gc> Library<'gc> {
} }
/// Instantiates the library item with the given character ID into a display object. /// Instantiates the library item with the given character ID into a display object.
pub fn instantiate_display_object_by_id( pub fn instantiate_by_id(
&self, &self,
id: CharacterId, id: CharacterId,
gc_context: MutationContext<'gc, '_>, gc_context: MutationContext<'gc, '_>,