public static string getBuildingName(ushort buildingId, out ItemClass.Service serviceFound, out ItemClass.SubService subserviceFound, out string prefix) { NetManager nm = Singleton <NetManager> .instance; BuildingManager bm = Singleton <BuildingManager> .instance; Building b = bm.m_buildings.m_buffer[buildingId]; while (b.m_parentBuilding > 0) { doLog("getStationNameWithPrefix(): building id {0} - parent = {1}", buildingId, b.m_parentBuilding); buildingId = b.m_parentBuilding; b = bm.m_buildings.m_buffer[buildingId]; } InstanceID iid = default(InstanceID); iid.Building = buildingId; serviceFound = b.Info?.GetService() ?? default(ItemClass.Service); subserviceFound = b.Info?.GetSubService() ?? default(ItemClass.SubService); TLMCW.ConfigIndex index = GameServiceExtensions.toConfigIndex(serviceFound, subserviceFound); if (index == TLMCW.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG) { var tsd = TransportSystemDefinition.from(b.Info.GetAI()); index = tsd.toConfigIndex(); } prefix = index.getPrefixTextNaming()?.Trim(); return(bm.GetBuildingName(buildingId, iid)); }
public static string getBuildingName(ushort buildingId, out ItemClass.Service serviceFound, out ItemClass.SubService subserviceFound, out string prefix, ushort lineId = 0) { NetManager nm = Singleton <NetManager> .instance; BuildingManager bm = Singleton <BuildingManager> .instance; Building b = bm.m_buildings.m_buffer[buildingId]; while (b.m_parentBuilding > 0) { doLog("getBuildingName(): building id {0} - parent = {1}", buildingId, b.m_parentBuilding); buildingId = b.m_parentBuilding; b = bm.m_buildings.m_buffer[buildingId]; } InstanceID iid = default; iid.Building = buildingId; serviceFound = b.Info?.GetService() ?? default; subserviceFound = b.Info?.GetSubService() ?? default; var index = GameServiceExtensions.ToConfigIndex(serviceFound, subserviceFound); TransportSystemDefinition tsd = default; if ((index & TLMCW.ConfigIndex.DESC_DATA) == TLMCW.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG) { tsd = TransportSystemDefinition.From(b.Info.GetAI()); index = tsd.ToConfigIndex(); } prefix = index.GetSystemStationNamePrefix(lineId)?.TrimStart(); doLog($"getBuildingName(): serviceFound {serviceFound} - subserviceFound = {subserviceFound} - tsd = {tsd} - index = {index} - prefix = {prefix}"); return(bm.GetBuildingName(buildingId, iid)); }