[Scummvm-cvs-logs] SF.net SVN: scummvm:[47741] tools/trunk/engines/mohawk/construct_mohawk.cpp
tdhs at users.sourceforge.net
tdhs at users.sourceforge.net
Sun Jan 31 08:41:41 CET 2010
Revision: 47741
http://scummvm.svn.sourceforge.net/scummvm/?rev=47741&view=rev
Author: tdhs
Date: 2010-01-31 07:41:41 +0000 (Sun, 31 Jan 2010)
Log Message:
-----------
Correction to ensure that construct_mohawk tool now produces archives files in an identical way to the original Mohawk archiver. This has been tested against Myst Original and ME files, but more work will be needed to account for Riven archive layout differences.
Modified Paths:
--------------
tools/trunk/engines/mohawk/construct_mohawk.cpp
Modified: tools/trunk/engines/mohawk/construct_mohawk.cpp
===================================================================
--- tools/trunk/engines/mohawk/construct_mohawk.cpp 2010-01-31 02:14:11 UTC (rev 47740)
+++ tools/trunk/engines/mohawk/construct_mohawk.cpp 2010-01-31 07:41:41 UTC (rev 47741)
@@ -24,6 +24,7 @@
#include "common/array.h"
#include "common/file.h"
#include "common/str.h"
+#include "common/util.h"
#include "archive.h"
uint32 _fileSize;
@@ -268,13 +269,34 @@
}
}
+// Original Archiver seems to treat '_' as greater than all alphanumerics which is not
+// the same as ASCII ordering and thus String '>' operator. This corrects for this.
+bool stringGreaterThan(Common::String *test, Common::String *ref) {
+ // Normal Function if just ASCII ordering..
+ //return *test > *ref;
+
+ // Function with correction for underscore ordered after Alphanumerics...
+ for (uint16 i = 0; i < Common::MIN(test->size(), ref->size()); i++) {
+ if ((*test)[i] == '_' && (*ref)[i] != '_')
+ return true;
+ else if ((*test)[i] > (*ref)[i])
+ return true;
+ else if ((*test)[i] < (*ref)[i])
+ return false;
+ }
+ if(test->size() > ref->size())
+ return true;
+ else
+ return false;
+}
+
void sortNameTable(Common::Array<TypeConstructNameEntries> *tempNameTable, uint16 i) {
uint16 k, j;
// Insert in Type Name Table ordered Alphabetically by Name
for (k = 0; k < _types[i].nameTable.num; k++) {
for (j = 0; j < tempNameTable->size(); j++) {
- if ((*tempNameTable)[j].name > _types[i].nameTable.entries[k].name)
+ if (stringGreaterThan(&((*tempNameTable)[j].name), &(_types[i].nameTable.entries[k].name)))
break;
}
tempNameTable->insert_at(j, _types[i].nameTable.entries[k]);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list