From 1bab8cbdb11fd355df2893dbaffa3d33484b25d4 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Mon, 13 Jan 2014 23:56:13 +0000 Subject: [PATCH] Fixed legacy parser not extracting ITM counts correctly. --- README.md | 22 ++++++++++++++++++++-- src/backend/legacy-parser.h | 6 +++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dc26f3ca..4cec8ad8 100644 --- a/README.md +++ b/README.md @@ -188,9 +188,27 @@ make ## Using The Masterlist Converter -The `masterlist-converter.exe` expects a v2 masterlist named `masterlist.txt` to be present in the same directory as it, and produces a v3 masterlist named `masterlist.txt.yaml`. +The masterlist converter is a command line utility that takes two optional command line arguments: -The converter is a command line utility and will print any errors in encounters to the console. It also won't create a v3 masterlist file if errors are encountered. +``` +masterlist-converter.exe [v2 masterlist input file] [v3 masterlist output file] +``` + +If only one argument is given, or if no arguments are given, the converter assumes it was called as + +``` +masterlist-converter.exe masterlist.txt masterlist.yaml +``` + +On encountering an error, it will print an error message to the console, and will not output a v3 masterlist. + +The converter does not perform a lossless conversion. The following do not get transferred into the new masterlist: + +* Silent comments. +* Requirement messages containing plugin filenames. +* Dirty message content. The ITM, UDR and Navmesh counts, along with CRCs and the dirty utility referenced are transferred, but any additional content, such as links to additional instructions, are lost. + +In addition, while other data is retained, it needs some manual adjustment, eg. translated messages need are converted as separate messages and should be placed into message content objects. ## Packaging Releases diff --git a/src/backend/legacy-parser.h b/src/backend/legacy-parser.h index 6f484b3b..1f0744b1 100644 --- a/src/backend/legacy-parser.h +++ b/src/backend/legacy-parser.h @@ -614,7 +614,10 @@ namespace boss { //Extract ITM count. pos1 = content.find("ITM"); if (pos1 != std::string::npos) { - itm = atoi(content.substr(0, pos1).c_str()); + pos2 = content.rfind(':', pos1); + if (pos2 != std::string::npos) { + itm = atoi(content.substr(pos2+1, pos1-pos2-1).c_str()); + } } //Extract UDR count. @@ -648,6 +651,7 @@ namespace boss { } dirtyInfo.insert(PluginDirtyInfo(crc, itm, udr, 0, utility)); it = messages.erase(it); + } else ++it; } else