Skip to content

Commit

Permalink
Makes layout-specific properties more convenient
Browse files Browse the repository at this point in the history
  • Loading branch information
hufman committed Feb 27, 2024
1 parent 0b177e3 commit dc9a053
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ abstract class RHMIProperty(val id: Int, var value: Any = 0) {
class SimpleProperty(id: Int, value: Any = 0): RHMIProperty(id, value)

class LayoutBag(id: Int, value: Any = 0, val values: Map<Int, Any>): RHMIProperty(id, value) {
fun get(layout: Int): Any {
override fun getForLayout(layout: Int): Any {
return values.getOrElse(layout) { value }
}
}

open fun getForLayout(layout: Int): Any {
return value
}
}

0 comments on commit dc9a053

Please sign in to comment.