summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-04-21 13:56:33 +0200
committeraap <aap@papnet.eu>2020-04-21 13:56:33 +0200
commit959f84ff9566297701064e30b46fd292e7e840a1 (patch)
tree23885d295e8f23ad7c4db346c431953d57bd45dc /src
parentlibrw (diff)
downloadre3-959f84ff9566297701064e30b46fd292e7e840a1.tar
re3-959f84ff9566297701064e30b46fd292e7e840a1.tar.gz
re3-959f84ff9566297701064e30b46fd292e7e840a1.tar.bz2
re3-959f84ff9566297701064e30b46fd292e7e840a1.tar.lz
re3-959f84ff9566297701064e30b46fd292e7e840a1.tar.xz
re3-959f84ff9566297701064e30b46fd292e7e840a1.tar.zst
re3-959f84ff9566297701064e30b46fd292e7e840a1.zip
Diffstat (limited to '')
-rw-r--r--src/core/Directory.cpp14
-rw-r--r--src/core/Directory.h1
-rw-r--r--src/core/Streaming.cpp6
3 files changed, 20 insertions, 1 deletions
diff --git a/src/core/Directory.cpp b/src/core/Directory.cpp
index 27539824..cc4d65d8 100644
--- a/src/core/Directory.cpp
+++ b/src/core/Directory.cpp
@@ -41,9 +41,23 @@ void
CDirectory::AddItem(const DirectoryInfo &dirinfo)
{
assert(numEntries < maxEntries);
+#ifdef FIX_BUGS
+ // don't add if already exists
+ uint32 offset, size;
+ if(FindItem(dirinfo.name, offset, size))
+ return;
+#endif
entries[numEntries++] = dirinfo;
}
+void
+CDirectory::AddItem(const DirectoryInfo &dirinfo, int32 imgId)
+{
+ DirectoryInfo di = dirinfo;
+ di.offset |= imgId<<24;
+ AddItem(di);
+}
+
bool
CDirectory::FindItem(const char *name, uint32 &offset, uint32 &size)
{
diff --git a/src/core/Directory.h b/src/core/Directory.h
index 06e6bba4..0fef080f 100644
--- a/src/core/Directory.h
+++ b/src/core/Directory.h
@@ -18,5 +18,6 @@ public:
void ReadDirFile(const char *filename);
bool WriteDirFile(const char *filename);
void AddItem(const DirectoryInfo &dirinfo);
+ void AddItem(const DirectoryInfo &dirinfo, int32 imgId);
bool FindItem(const char *name, uint32 &offset, uint32 &size);
};
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 15fe60e2..8124d11c 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -369,8 +369,12 @@ CStreaming::LoadCdDirectory(const char *dirname, int n)
lastID = modelId;
}
}else{
- // BUG: doesn't remember which cdimage this was in
+#ifdef FIX_BUGS
+ // remember which cdimage this came from
+ ms_pExtraObjectsDir->AddItem(direntry, n);
+#else
ms_pExtraObjectsDir->AddItem(direntry);
+#endif
lastID = -1;
}
}else if(!CGeneral::faststrcmp(dot+1, "TXD") || !CGeneral::faststrcmp(dot+1, "txd")){