mirror of
https://github.com/kwsch/NHSE.git
synced 2026-10-01 14:26:38 -05:00
Add handling for revised player house and room structure (v2.0) (#547)
* Add handling for revised player house and room structure (v2.0) * Update player room load/dump file type filters
This commit is contained in:
@@ -66,29 +66,19 @@ public IReadOnlyList<Building> Buildings
|
||||
set => Building.SetArray(value).CopyTo(Data, Offsets.MainFieldStructure);
|
||||
}
|
||||
|
||||
public PlayerHouse GetPlayerHouse(int index)
|
||||
public IPlayerHouse GetPlayerHouse(int index) => Offsets.ReadPlayerHouse(Data, index);
|
||||
public void SetPlayerHouse(IPlayerHouse value, int index) => Offsets.WritePlayerHouse(value, Data, index);
|
||||
|
||||
|
||||
public IPlayerHouse[] GetPlayerHouses()
|
||||
{
|
||||
if ((uint)index >= MainSaveOffsets.PlayerCount)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
return new PlayerHouse(Data.Slice(Offsets.PlayerHouseList + (index * PlayerHouse.SIZE), PlayerHouse.SIZE));
|
||||
var players = new IPlayerHouse[MainSaveOffsets.PlayerCount];
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
players[i] = GetPlayerHouse(i);
|
||||
return players;
|
||||
}
|
||||
|
||||
public void SetPlayerHouse(PlayerHouse h, int index)
|
||||
{
|
||||
if ((uint)index >= MainSaveOffsets.PlayerCount)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
h.Data.CopyTo(Data, Offsets.PlayerHouseList + (index * PlayerHouse.SIZE));
|
||||
}
|
||||
|
||||
public PlayerHouse[] GetPlayerHouses()
|
||||
{
|
||||
var villagers = new PlayerHouse[MainSaveOffsets.PlayerCount];
|
||||
for (int i = 0; i < villagers.Length; i++)
|
||||
villagers[i] = GetPlayerHouse(i);
|
||||
return villagers;
|
||||
}
|
||||
|
||||
public void SetPlayerHouses(IReadOnlyList<PlayerHouse> houses)
|
||||
public void SetPlayerHouses(IReadOnlyList<IPlayerHouse> houses)
|
||||
{
|
||||
for (int i = 0; i < houses.Count; i++)
|
||||
SetPlayerHouse(houses[i], i);
|
||||
|
||||
Reference in New Issue
Block a user