aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sword2/resman.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/engines/sword2/resman.cpp b/engines/sword2/resman.cpp
index a30c6301cc..e7ef62d672 100644
--- a/engines/sword2/resman.cpp
+++ b/engines/sword2/resman.cpp
@@ -113,7 +113,17 @@ bool ResourceManager::init() {
// The resource.inf file is a simple text file containing the names of
// all the resource files.
- while (file.readLine_OLD(_resFiles[_totalClusters].fileName, sizeof(_resFiles[_totalClusters].fileName))) {
+ while (1) {
+ char *buf = _resFiles[_totalClusters].fileName;
+ uint len = sizeof(_resFiles[_totalClusters].fileName);
+
+ if (!file.readLine_NEW(buf, len))
+ break;
+
+ int pos = strlen(buf);
+ if (buf[pos - 1] == 0x0A)
+ buf[pos - 1] = 0;
+
_resFiles[_totalClusters].numEntries = -1;
_resFiles[_totalClusters].entryTab = NULL;
if (++_totalClusters >= MAX_res_files) {