Skip to content

Commit 7f1b069

Browse files
committed
Multi-model node issue fix.
1 parent 105a4e9 commit 7f1b069

2 files changed

Lines changed: 27 additions & 24 deletions

File tree

DynamicTextureLoader/Loader.cs

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -157,37 +157,40 @@ public static void loadDictionary()
157157
DatabaseLoaderAttrib loaderAttrib = (DatabaseLoaderAttrib)Attribute.GetCustomAttribute(typeof(DatabaseLoaderTexture_DTL), typeof(DatabaseLoaderAttrib));
158158
foreach (UrlDir.UrlConfig config in GameDatabase.Instance.root.AllConfigs.ToArray())
159159
{
160-
ConfigNode model = config.config.GetNode("MODEL");
161-
if ((config.type == "PART" || config.type == "INTERNAL") && model != null)
160+
ConfigNode[] models = config.config.GetNodes("MODEL");
161+
if ((config.type == "PART" || config.type == "INTERNAL") && models != null)
162162
{
163-
int i = 0;
164-
string modelUrl = model.GetValue("model");
165-
String modelCapture = @"(.*/)([^/\\]+)$";
166-
if (Regex.IsMatch(modelUrl, modelCapture))
163+
foreach (ConfigNode model in models)
167164
{
168-
modelUrl = Regex.Match(modelUrl, modelCapture).Groups[1].Value;
169-
string value = model.GetValue("texture", i);
170-
while (value != null)
165+
int i = 0;
166+
string modelUrl = model.GetValue("model");
167+
String modelCapture = @"(.*/)([^/\\]+)$";
168+
if (Regex.IsMatch(modelUrl, modelCapture))
171169
{
172-
String capture = @"(.*[^\s])\s*,\s*(.*[^\s])";
173-
if (Regex.IsMatch(value, capture))
170+
modelUrl = Regex.Match(modelUrl, modelCapture).Groups[1].Value;
171+
string value = model.GetValue("texture", i);
172+
while (value != null)
174173
{
175-
Match match = Regex.Match(value, capture);
176-
string realUrl = match.Groups[2].Value;
177-
string dummyUrl = modelUrl + match.Groups[1].Value;
178-
Loader.Log("stashing " + dummyUrl + " -> " + realUrl);
179-
if (texMapDictionary.ContainsKey(dummyUrl) && texMapDictionary[dummyUrl] != realUrl)
174+
String capture = @"(.*[^\s])\s*,\s*(.*[^\s])";
175+
if (Regex.IsMatch(value, capture))
180176
{
181-
Loader.Log("Dummy has multiple refs!");
182-
}
183-
else
184-
{
185-
texMapDictionary[dummyUrl] = realUrl;
186-
}
177+
Match match = Regex.Match(value, capture);
178+
string realUrl = match.Groups[2].Value;
179+
string dummyUrl = modelUrl + match.Groups[1].Value;
180+
Loader.Log("stashing " + dummyUrl + " -> " + realUrl);
181+
if (texMapDictionary.ContainsKey(dummyUrl) && texMapDictionary[dummyUrl] != realUrl)
182+
{
183+
Loader.Log("Dummy has multiple refs!");
184+
}
185+
else
186+
{
187+
texMapDictionary[dummyUrl] = realUrl;
188+
}
187189

190+
}
191+
i++;
192+
value = model.GetValue("texture", i);
188193
}
189-
i++;
190-
value = model.GetValue("texture", i);
191194
}
192195
}
193196
}
25 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)