From 111cdc633987f35892345efbd1ae8b5b98041895 Mon Sep 17 00:00:00 2001 From: <> Date: Sat, 6 May 2017 15:25:47 -0700 Subject: [PATCH] Fixed bug where hex digit in Face is assigned as a material --- ReflexToQ3/includes/oopless-parser.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ReflexToQ3/includes/oopless-parser.cpp b/ReflexToQ3/includes/oopless-parser.cpp index f9025e8..63f6ee2 100644 --- a/ReflexToQ3/includes/oopless-parser.cpp +++ b/ReflexToQ3/includes/oopless-parser.cpp @@ -125,27 +125,25 @@ vector parse_face(ifstream &f) { // then it qualifies as an illegal line. } else if (4 < i && i < 8) { x.m_Indices.push_back(stoi(fdata)); - } else if (i == 8) { - // field #8 may either be the unidentified hex digit - // i.e there are 3 indices only, - // or it could be another index. - if (fdata.length() > 1 && SECONDCH(fdata) == 'x') { + } else if (8 <= i) { + if (!hex && fdata.length() > 1) { + if (SECONDCH(fdata) == 'x') { // this is the unidentified hex digit. // just it signify the texture at the end. - hex = true; - } else { + hex = true; + } + } else if (!hex) { x.m_Indices.push_back(stoi(fdata)); - } - } else if ((i == 9 && hex) || i == 10) { - // it is a texture if it is field #9 - // and the hex digit is already encountered - // or it is field #10. + } else if (hex) { x.m_Material = fdata; + } else { + ; + } } i++; } // end, per field iteration output.push_back(x); - } + } // end else case, if line did not contain other keywords pos = f.tellg(); } // end, per line iteration // the odd case when the map file ends with a face indent.