Propagate groups from <enums> to each individual <enum>

Signed-off-by: Graham <gpe@openrs2.dev>
bzip2
Graham 5 years ago
parent 9a1599880b
commit 7e66c024b4
  1. 10
      deob-ast/src/main/java/dev/openrs2/deob/ast/gl/GlRegistry.kt

@ -34,16 +34,18 @@ data class GlRegistry(val enums: ImmutableSetMultimap<Long, GlEnum>, val command
val enumsBuilder = ImmutableSetMultimap.builder<Long, GlEnum>() val enumsBuilder = ImmutableSetMultimap.builder<Long, GlEnum>()
val groupsBuilder = HashMultimap.create<String, GlEnum>() val groupsBuilder = HashMultimap.create<String, GlEnum>()
for (elements in root.getChildren("enums")) { for (parent in root.getChildren("enums")) {
for (element in elements.getChildren("enum")) { val parentGroups = (parent.getAttributeValue("group") ?: "").split(",")
for (element in parent.getChildren("enum")) {
val name = element.getAttributeValue("name") val name = element.getAttributeValue("name")
val value = parseValue(element.getAttributeValue("value")) val value = parseValue(element.getAttributeValue("value"))
val enum = GlEnum(name, value) val enum = GlEnum(name, value)
enumsBuilder.put(value, enum) enumsBuilder.put(value, enum)
val groups = element.getAttributeValue("group") ?: continue val groups = (element.getAttributeValue("group") ?: "").split(",")
for (group in groups.split(",")) { for (group in parentGroups union groups) {
groupsBuilder.put(group, enum) groupsBuilder.put(group, enum)
} }
} }

Loading…
Cancel
Save