Take a look at this screenshot and tell me whether I could do it in a less ugly way:
This is a function of a storehouse. The function should get a item from the storehouse. The items are saved inside of a struct. The enum which the function get’s is just all the names of the struct variables. So I can say to the function “Get 2 of Item Wood” and it removes the 2 wood from the correct struct variable and tells me yes, I’ve done that.
Now if I add new variables to the struct, I actually have to copy/paste all the stuff on the right from the switch again and change the break struct and add members of struct node to the new item. That’s really ugly.
As far as I know there is no better approach for this at the moment, so my suggestion would be: Make that every struct automatically creates an enum with all the variable names and add a node like struct.SetMember(Enum, Value). If it would work like this I would not need all this ugly stuff on the right, and if I add a new item I would not have to manually add new nodes which fit the new switch output.