File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
src/main/java/com/romraider/maps Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 11/*
22 * RomRaider Open-Source Tuning, Logging and Reflashing
3- * Copyright (C) 2006-2021 RomRaider.com
3+ * Copyright (C) 2006-2025 RomRaider.com
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
@@ -279,6 +279,7 @@ public void highlightLiveData(String liveVal) {
279279 }
280280
281281 int startIdx = data .length ;
282+ double currentErrorToLiveValue = Double .POSITIVE_INFINITY ;
282283 for (int i = 0 ; i < data .length ; i ++) {
283284 double currentValue = 0.0 ;
284285 if (table .isStaticDataTable () && null != data [i ].getStaticText ()) {
@@ -290,14 +291,14 @@ public void highlightLiveData(String liveVal) {
290291 } else {
291292 currentValue = data [i ].getDataCell ().getRealValue ();
292293 }
293-
294- if ( liveValue == currentValue ) {
295- startIdx = i ;
296- break ;
297- } else if ( liveValue < currentValue ){
298- startIdx = i - 1 ;
299- break ;
300- }
294+
295+ if ( Math . abs ( currentValue - liveValue ) < currentErrorToLiveValue )
296+ {
297+ currentErrorToLiveValue = Math . abs ( currentValue - liveValue ) ;
298+ startIdx = i ;
299+
300+ if ( currentErrorToLiveValue <= 0.001 ) break ;
301+ }
301302 }
302303
303304 setLiveDataIndex (startIdx );
You can’t perform that action at this time.
0 commit comments