generate: What

This commit is contained in:
Sasha Koshka 2025-01-21 16:33:10 -05:00
parent 69f3d4973b
commit fe5f2448a1

View File

@ -50,15 +50,3 @@ func (this *MessageData) UnmarshalBinary(buffer []byte) error {
}
return nil
}
// Protocol maps methods to functions that create messages. The messages must be
// passed by reference, and the functions must return a new object every time.
type Protocol map[uint16] func() Message
// Add adds messages to the protocol. Messages with conflicting methods will
// be replaced.
func (this Protocol) Add(messages ...func() Message) {
for _, message := range messages {
this[message().Method()] = message
}
}