Cleanup LoadManager

This commit is contained in:
VegaZ
2018-10-08 19:01:29 +02:00
parent 80c4b7bc34
commit cacff0dc3c

View File

@@ -28,10 +28,7 @@ namespace reallife_gamemode.Server.Managers
b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short) b.Rotation, b.Dimension); b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short) b.Rotation, b.Dimension);
} }
} }
} foreach (Saves.SavedVehicle v in loadData.Vehicles)
using (var loadVehicles = new DatabaseContext())
{
foreach (Saves.SavedVehicle v in loadVehicles.Vehicles)
{ {
if (v.Active == true) if (v.Active == true)
{ {
@@ -39,15 +36,12 @@ namespace reallife_gamemode.Server.Managers
v.SecondaryColor, v.NumberPlate, v.Alpha, v.Locked, v.Engine = false, v.Dimension); v.SecondaryColor, v.NumberPlate, v.Alpha, v.Locked, v.Engine = false, v.Dimension);
} }
} }
} foreach (FactionVehicle v in loadData.FactionVehicles)
using (var loadFVehicles = new DatabaseContext())
{
foreach (FactionVehicle v in loadFVehicles.FactionVehicles)
{ {
if (v.Active == true) if (v.Active == true)
{ {
NAPI.Vehicle.CreateVehicle((uint)v.Model, new Vector3(v.PositionX, v.PositionY, v.PositionZ), v.Heading, (v.PrimaryColor), NAPI.Vehicle.CreateVehicle((uint)v.Model, new Vector3(v.PositionX, v.PositionY, v.PositionZ), v.Heading, (v.PrimaryColor),
v.SecondaryColor, v.NumberPlate, v.Alpha, v.Locked, v.Engine = false, v.Dimension); v.SecondaryColor, v.NumberPlate, v.Alpha, v.Locked, v.Engine = false, v.Dimension);
} }
} }
} }