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 groupsBuilder = HashMultimap.create<String, GlEnum>()
for (elements in root.getChildren("enums")) {
for (element in elements.getChildren("enum")) {
for (parent in root.getChildren("enums")) {
val parentGroups = (parent.getAttributeValue("group") ?: "").split(",")
for (element in parent.getChildren("enum")) {
val name = element.getAttributeValue("name")
val value = parseValue(element.getAttributeValue("value"))
val enum = GlEnum(name, value)
enumsBuilder.put(value, enum)
val groups = element.getAttributeValue("group") ?: continue
for (group in groups.split(",")) {
val groups = (element.getAttributeValue("group") ?: "").split(",")
for (group in parentGroups union groups) {
groupsBuilder.put(group, enum)
}
}

Loading…
Cancel
Save