Update Building.java

This commit is contained in:
vshcherb 2021-01-15 18:47:02 +01:00 committed by GitHub
parent d25981a18d
commit c98ae20599
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,17 +116,15 @@ public class Building extends MapObject {
String sname = getName2(); String sname = getName2();
if (getInterpolationType() == BuildingInterpolation.ALPHABETIC && num == numB) { if (getInterpolationType() == BuildingInterpolation.ALPHABETIC && num == numB) {
char hCh = hno.charAt(hno.length() - 1); int hint = (int) hno.charAt(hno.length() - 1);
char fCh = fname.charAt(fname.length() - 1); int fch = (int) fname.charAt(fname.length() - 1);
char sCh = sname.charAt(sname.length() - 1); int sch = sname.charAt(sname.length() - 1);
int h = Character.getNumericValue(hCh); if (fch == sch) {
int f = Character.getNumericValue(fCh); return -1;
int s = Character.getNumericValue(sCh);
if (sCh > fCh) {
return ((float) h - f) / (((float) s - f));
} }
if (sCh < fCh) { float res = ((float) hint - fch) / (((float) sch - fch));
return ((float) f - h) / (((float) f - s)); if (res > 1 || res < -1) {
return -1;
} }
} }
if (num >= numB) { if (num >= numB) {