riperiperi / FreeSO

Re-implementation of The Sims Online.
http://freeso.org
Mozilla Public License 2.0
817 stars 95 forks source link

[Fix for Simitone]Some Far files are ignored. #139

Closed simptomo closed 5 years ago

simptomo commented 5 years ago

I just found "ExpansionPack5/ExpansionPack5.FAR" and "SoundData/SoundData.FAR".

riperiperi commented 5 years ago

LGTM, though these files have lower case extensions in my version of the game. Maybe this is where your issues loading CAS come from?

simptomo commented 5 years ago

No. But my new patch showed me that. 無題

New patch:

diff --git TSOClient/tso.simantics/VM.cs TSOClient/tso.simantics/VM.cs
index 0604bf28..be799754 100644
--- TSOClient/tso.simantics/VM.cs
+++ TSOClient/tso.simantics/VM.cs
@@ -220,8 +220,8 @@ namespace FSO.SimAntics
             var ents = new List<VMEntity>(Entities);
             foreach (var ent in ents)
             {
-                if (ent.Thread.BlockingState != null) ent.Thread.BlockingState = null;
-                if (ent.Thread.EODConnection != null) ent.Thread.EODConnection = null;
+                if (ent.Thread?.BlockingState != null) ent.Thread.BlockingState = null;
+                if (ent.Thread?.EODConnection != null) ent.Thread.EODConnection = null;
                 if (ent.Object.OBJ.GUID == 0x3929AADC) ent.Delete(true, Context); //also remove any reserved tiles
             }
         }
@@ -796,6 +796,7 @@ namespace FSO.SimAntics
                     continue;
                 }
                 var threadMarsh = input.Threads[i];
+                if (i >= Entities.Count) break;
                 var realEnt = Entities[i++];

                 realEnt.Thread = new VMThread(threadMarsh, Context, realEnt);
@@ -818,7 +819,7 @@ namespace FSO.SimAntics
                     {
                         avgPos += obj.Position;
                     }
-                    avgPos /= grp.Objects.Count;
+                    if (grp.Objects.Count != 0) avgPos /= grp.Objects.Count;

                     foreach (var obj in grp.Objects)
                     {