Hi

I've expanded the patch, because I found that the sort order parameters were not set correctly with the gmapsupp option either.

Here it is if anyone wants to give it a whirl before I commit it, which
I plan to do soon.

..Steve
Index: src/uk/me/parabola/mkgmap/combiners/FileInfo.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/FileInfo.java	(revision 2316)
+++ src/uk/me/parabola/mkgmap/combiners/FileInfo.java	(revision )
@@ -443,6 +443,7 @@
 		Sort sort = SrtTextReader.sortForCodepage(codePage);
 		if (sort == null)
 			sort = args.getSort();
+		sort.setSortOrderId(sortOrderId);
 		return sort;
 	}
 
Index: src/uk/me/parabola/imgfmt/app/srt/Sort.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/imgfmt/app/srt/Sort.java	(revision 2316)
+++ src/uk/me/parabola/imgfmt/app/srt/Sort.java	(revision )
@@ -227,7 +227,7 @@
 	}
 
 	public void setId2(int id2) {
-		this.id2 = id2;
+		this.id2 = id2 & 0x7fff;
 	}
 
 	/**
@@ -237,9 +237,18 @@
 	 * @return id1 and id2 as if they were a little endian 2 byte integer.
 	 */
 	public int getSortOrderId() {
-		return (this.id2 << 16) + (this.id1 & 0xff);
+		return (this.id2 << 16) + (this.id1 & 0xffff);
 	}
 
+	/**
+	 * Set the sort order as a single integer.
+	 * @param id The sort order id.
+	 */
+	public void setSortOrderId(int id) {
+		id1 = id & 0xffff;
+		id2 = (id >>> 16) & 0x7fff;
+	}
+
 	public void setCodepage(int codepage) {
 		this.codepage = codepage;
 		if (codepage == 0)
@@ -332,6 +341,10 @@
 
 	public int getExpansionSize() {
 		return expansions.size();
+	}
+
+	public String toString() {
+		return String.format("sort cp=%d order=%08x", codepage, getSortOrderId());
 	}
 
 	/**
Index: src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java	(revision 2316)
+++ src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java	(revision )
@@ -27,7 +27,6 @@
 import uk.me.parabola.imgfmt.app.srt.Sort;
 import uk.me.parabola.imgfmt.app.trergn.Point;
 import uk.me.parabola.imgfmt.fs.ImgChannel;
-import uk.me.parabola.mkgmap.srt.SrtTextReader;
 
 /**
  * The MDR file.  This is embedded into a .img file, either its own
@@ -142,14 +141,9 @@
 		currentMap++;
 		mdr1.addMap(mapName);
 		Sort sort = mdrHeader.getSort();
-		if (sort.getSortOrderId() == 0) {
-			sort = SrtTextReader.sortForCodepage(codePage);
-			mdrHeader.setSort(sort);
-		} else {
+
-			if (sort.getCodepage() != codePage)
-				System.err.println("WARNING: input files have different code pages");
+		if (sort.getCodepage() != codePage)
+			System.err.println("WARNING: input files have different code pages");
-		}
-
 	}
 
 	public Mdr14Record addCountry(Country country) {
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to