Vertex edit form: it was impossible to enter fractional position and zOffset values even if map format supported it.

This commit is contained in:
MaxED 2013-06-04 13:59:24 +00:00
parent 38fc9d1414
commit f1df0c2d94

View file

@ -215,8 +215,10 @@ namespace CodeImp.DoomBuilder.Controls
} }
else else
{ {
// Return the new value //mxd. Return the new value
return int.TryParse(this.Text, out result) ? result : original; if(!int.TryParse(this.Text, out result)) return original;
if(!allownegative && (result < 0)) return 0;
return result;
} }
} }
else else
@ -243,22 +245,24 @@ namespace CodeImp.DoomBuilder.Controls
if(this.Text.StartsWith("++")) if(this.Text.StartsWith("++"))
{ {
// Add number to original // Add number to original
if(!float.TryParse(textpart, out result)) result = 0; if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) result = 0;
return original + result; return original + result;
} }
// Prefixed with --? // Prefixed with --?
else if(this.Text.StartsWith("--")) else if(this.Text.StartsWith("--"))
{ {
// Subtract number from original // Subtract number from original
if(!float.TryParse(textpart, out result)) result = 0; if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) result = 0;
float newvalue = original - result; float newvalue = original - result;
if(!allownegative && (newvalue < 0)) newvalue = 0; if(!allownegative && (newvalue < 0)) newvalue = 0;
return newvalue; return newvalue;
} }
else else
{ {
// Return the new value //mxd. Return the new value
return float.TryParse(this.Text, out result) ? result : original; if(!float.TryParse(this.Text, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) return original;
if(!allownegative && (result < 0)) return 0;
return result;
} }
} }
else else