Fix login

This commit is contained in:
Hondacrx
2024-11-16 23:05:45 -05:00
parent 76b0d747d3
commit 406aa5e445
26 changed files with 151 additions and 76 deletions
@@ -191,8 +191,8 @@ namespace Game.Collision
if (iLoadedModelFiles.TryGetValue(filename, out worldmodel))
return worldmodel.Model;
var model = new ManagedModel(filename);
if (!model.Model.ReadFile(VMapPath + filename))
worldmodel = new ManagedModel(filename);
if (!worldmodel.Model.ReadFile(VMapPath + filename))
{
Log.outError(LogFilter.Server, $"VMapManager: could not load '{filename}'");
return null;
@@ -200,10 +200,8 @@ namespace Game.Collision
Log.outDebug(LogFilter.Maps, $"VMapManager: loading file '{filename}'");
model = worldmodel;
iLoadedModelFiles.Add(filename, model);
return model.Model;
iLoadedModelFiles.Add(filename, worldmodel);
return worldmodel.Model;
}
}
@@ -271,7 +269,7 @@ namespace Game.Collision
public class ManagedModel
{
public WorldModel Model;
public WorldModel Model = new();
string _name; // valid only while model is held in VMapManager2::iLoadedModelFiles
public ManagedModel(string name)
+2 -2
View File
@@ -90,7 +90,7 @@ namespace Game.Collision
LoadResult result = LoadResult.FileNotFound;
TileFileOpenResult fileResult = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm);
if (fileResult.TileFile != null)
if (fileResult.TileFile != null && fileResult.SpawnIndicesFile != null)
{
result = LoadResult.Success;
using BinaryReader reader = new(fileResult.TileFile);
@@ -127,7 +127,7 @@ namespace Game.Collision
continue;
}
if (iTreeValues[referencedVal].GetWorldModel() == null)
if (iTreeValues[referencedVal]?.GetWorldModel() == null)
iTreeValues[referencedVal] = new ModelInstance(spawn, model);
iTreeValues[referencedVal].AddTileReference();