AstroTechies/unrealmodding

[unreal_asset] Find import with no index

funlennysub opened this issue · 2 comments

Since introduction of name map for FName, accessing imports without index became more complex than it was, FName doesn't impl partialeq between dummy and baked variants, and find_import_no_index compares FNames fully. I think this can be solved by replacing current impl with this:

impl PartialEq for FName {
    fn eq(&self, other: &Self) -> bool {
        match (self, other) {
            (
                FName::Backed {
                    index: a_index,
                    number: a_number,
                    ty: _,
                    name_map: _,
                },
                FName::Backed {
                    index: b_index,
                    number: b_number,
                    ty: _,
                    name_map: _,
                },
            ) => a_index == b_index && a_number == b_number,
            (
                FName::Dummy {
                    value: a_value,
                    number: a_number,
                },
                FName::Dummy {
                    value: b_value,
                    number: b_number,
                },
            ) => a_value == b_value && a_number == b_number,
            (
                FName::Backed {
                    index,
                    number: a_number,
                    ty: _,
                    name_map,
                },
                FName::Dummy {
                    value,
                    number: b_number,
                },
            ) => name_map.get_ref().get_name_reference(*index) == value && a_number == b_number,
            (
                FName::Dummy {
                    value,
                    number: a_number,
                },
                FName::Backed {
                    index,
                    number: b_number,
                    ty,
                    name_map,
                },
            ) => value == name_map.get_ref().get_name_reference(*index) && a_number == b_number,
        }
    }
}

@localcc any plans to address this?

In a couple days