mxgmn / WaveFunctionCollapse

Bitmap & tilemap generation from a single example with the help of ideas from quantum mechanics
Other
23.18k stars 1.24k forks source link

Converting strings to values using culture invariant conventions #6

Closed Cookingsource closed 7 years ago

Cookingsource commented 7 years ago

ConvertFromString fails when trying to parse floating numeric values in systems where the expected decimal separator is not the same than in the author's expected one.

In our case, weights are formatted with dot as decimal separator as in: <tile name="grasscorner" symmetry="L" weight="0.0001"/>

In my system, the decimal separator is ',' (ES_ES) so 0.0001 is not a valid format

In order to avoid this kind of issues it's a common practice to use the ConvertFromInvariantString method instead. This way you bypass the system Culture

mxgmn commented 7 years ago

@Cookingsource Thanks! Didn't know that.