Skip to content

Commit

Permalink
Merge remote-tracking branch 'original/master' into feat/@next
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
JAGFx committed Aug 6, 2022
2 parents 9d02fc4 + 42ef47b commit bb920ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions TsMap/Common/Consts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ internal static class Consts
new DlcGuard("dlc_ut_and_wy", 19),
new DlcGuard("dlc_tx", 20, false),
new DlcGuard("dlc_nm_and_tx", 21, false),
new DlcGuard("dlc_mt", 22, false),
new DlcGuard("dlc_id_and_mt", 23, false),
new DlcGuard("dlc_mt_and_wy", 24, false),
new DlcGuard("dlc_mt", 22),
new DlcGuard("dlc_id_and_mt", 23),
new DlcGuard("dlc_mt_and_wy", 24),
};

/// <summary>
Expand Down
14 changes: 11 additions & 3 deletions TsMap/TsItem/TsBusStopItem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using TsMap.Helpers;
using TsMap.Helpers.Logger;
using TsMap.Map.Overlays;
Expand All @@ -8,6 +9,8 @@ namespace TsMap.TsItem
{
public class TsBusStopItem : TsItem
{
private ulong _prefabUid;

public TsBusStopItem(TsSector sector, int startOffset) : base(sector, startOffset)
{
Valid = true;
Expand All @@ -23,28 +26,33 @@ public TsBusStopItem(TsSector sector, int startOffset) : base(sector, startOffse
public void TsBusStopItem825(int startOffset)
{
var fileOffset = startOffset + 0x34; // Set position at start of flags
_prefabUid = MemoryHelper.ReadUInt64(Sector.Stream, fileOffset += 0x05 + 0x08); // 0x05(flags) + 0x08(city_name)
Nodes = new List<ulong>(1)
{
MemoryHelper.ReadUInt64(Sector.Stream, fileOffset += 0x05 + 0x10), // 0x05(flags) + 0x10(city_name + prefab_uid)
MemoryHelper.ReadUInt64(Sector.Stream, fileOffset += 0x08), // 0x08(prefab_uid)
};
fileOffset += 0x08; // 0x08(node_uid)
BlockSize = fileOffset - startOffset;
}
public void TsBusStopItem836(int startOffset)
{
var fileOffset = startOffset + 0x34; // Set position at start of flags
_prefabUid = MemoryHelper.ReadUInt64(Sector.Stream, fileOffset += 0x05 + 0x08); // 0x05(flags) + 0x08(city_name)
Nodes = new List<ulong>(1)
{
MemoryHelper.ReadUInt64(Sector.Stream, fileOffset += 0x05 + 0x10), // 0x05(flags) + 0x10(city_name + prefab_uid)
MemoryHelper.ReadUInt64(Sector.Stream, fileOffset += 0x08), // 0x08(prefab_uid)
};
fileOffset += 0x0C; // 0x0C(node_uid & padding2)
BlockSize = fileOffset - startOffset;
}

internal override void Update()
{
var node = Sector.Mapper.GetNodeByUid(Nodes[0]);
var prefab = Sector.Mapper.Prefabs.FirstOrDefault(x => x.Uid == _prefabUid);

if (prefab == null) return; // invalid or hidden prefab

var node = Sector.Mapper.GetNodeByUid(Nodes[0]);
if (node == null)
{
Logger.Instance.Error(
Expand Down

0 comments on commit bb920ed

Please sign in to comment.