Closed Chris3606 closed 6 years ago
Go ahead if you want to do this. I wrote it the way I did because it's what I needed specifically to create random maps while keeping corridors and rooms separate. Just watch out if you try to do a read-only version of LambdaTranslationMap
, because C# will require that the SettableLambdaTranslationMap
version have a matching constructor which will be invalid.
I'll look into it. The hope is that the change won't break any code on your end.
Currently,
TranslationMap
andLambdaTranslationMap
require specifying both "get" and "set" methods. In many GoRogue algorithms, including pathing, fov, and sense-mapping, "set" functionality is not required, rather only "get" functionality. In these cases it would be convenient to specify translation methods as lambda methods, but only specify the needed "get" functionality, rather than writing unnecessary set functionality (particularly since set functionality may be difficult or lengthy to implement in certain map architectures).Thus, I propose that it may be beneficial to split
TranslationMap
into two classes,TranslationMap
andSettableTranslationMap
.TranslationMap
would implementIMapView
and require only the "get" function to be specified, whereasSettableTranslationMap
would extend that to implementISettableMapView
and require the "set" functionality. Similarly, splitLambdaTranslationMap
intoLambdaTranslationMap
andSettableLambdaTranslationMap
. These would more closely mirror theIMapView
vs.ISettableMapView
distinction made in GoRogue, and prevent the need to specify both "get" and "set" functionality to take advantage of the convenience of lambda functions.Any feedback is welcome! :)