Skip to content

Commit

Permalink
Fixed infinite blank spawning (CargoType data Type)
Browse files Browse the repository at this point in the history
CaregoType is now held as a CargoType, rather than byte in TaskDataData
CargoType is now serialised as int (byte is not wide enough to store all values of CargoType)
  • Loading branch information
AMacro committed May 18, 2024
1 parent 440b917 commit 8adb497
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Multiplayer/Networking/Data/TaskDataData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public class WarehouseTaskData : TaskBeforeDataData
public string[] Cars { get; set; }
public byte WarehouseTaskType { get; set; }
public string WarehouseMachine { get; set; }
public byte CargoType { get; set; }
public CargoType CargoType { get; set; }
public float CargoAmount { get; set; }
public bool ReadyForMachine { get; set; }

Expand All @@ -239,7 +239,7 @@ public static WarehouseTaskData FromWarehouseTask(WarehouseTask task)
Cars = task.cars.Select(x => x.ID).ToArray(),
WarehouseTaskType = (byte)task.warehouseTaskType,
WarehouseMachine = task.warehouseMachine.ID,
CargoType = (byte)task.cargoType,
CargoType = task.cargoType,
CargoAmount = task.cargoAmount,
ReadyForMachine = task.readyForMachine
};
Expand All @@ -251,7 +251,7 @@ public static WarehouseTask ToWarehouseTask(WarehouseTaskData data)
CarSpawner.Instance.allCars.FindAll(x => data.Cars.Contains(x.ID)).Select(x => x.logicCar).ToList(),
(WarehouseTaskType)data.WarehouseTaskType,
JobSaveManager.Instance.GetWarehouseMachineWithId(data.WarehouseMachine),
(CargoType)data.CargoType,
data.CargoType,
data.CargoAmount
);
}
Expand All @@ -262,7 +262,7 @@ public static void Serialize(NetDataWriter writer, WarehouseTaskData data)
writer.PutArray(data.Cars);
writer.Put(data.WarehouseTaskType);
writer.Put(data.WarehouseMachine);
writer.Put(data.CargoType);
writer.Put((int)data.CargoType);
writer.Put(data.CargoAmount);
writer.Put(data.ReadyForMachine);
}
Expand All @@ -274,7 +274,7 @@ public static WarehouseTaskData Deserialize(NetDataReader reader)
data.Cars = reader.GetStringArray();
data.WarehouseTaskType = reader.GetByte();
data.WarehouseMachine = reader.GetString();
data.CargoType = reader.GetByte();
data.CargoType = (CargoType)reader.GetInt();
data.CargoAmount = reader.GetFloat();
data.ReadyForMachine = reader.GetBool();

Expand Down

0 comments on commit 8adb497

Please sign in to comment.