Skip to content

Commit

Permalink
Localize region name in Place Macro4
Browse files Browse the repository at this point in the history
Requires storing region index in SiteDetails for lookup of localized region name.
  • Loading branch information
Interkarma committed Nov 27, 2022
1 parent 24d9e27 commit 49799a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Assets/Scripts/DaggerfallUnityStructs.cs
Expand Up @@ -427,8 +427,9 @@ public struct SiteDetails
public SiteTypes siteType; // Type of site
public int mapId; // MapID of this location
public uint locationId; // LocationID of this location
public string regionName; // Name of region containing this location
public string locationName; // Name of exterior location itself
public int regionIndex; // Index of region containing this location
public string regionName; // Canonical name Name of region containing this location
public string locationName; // Canonical Name of exterior location itself
public int buildingKey; // Key of building site in this location
public string buildingName; // Name of target building, e.g. 'The Odd Blades'
public QuestMarker[] questSpawnMarkers; // Array of quest spawn markers (Foe, Person resources) found in site, can be null or empty
Expand Down
6 changes: 5 additions & 1 deletion Assets/Scripts/Game/Questing/Place.cs
Expand Up @@ -268,7 +268,7 @@ public override bool ExpandMacro(MacroTypes macro, out string textOut)
break;

case MacroTypes.NameMacro4: // Name of region (e.g. Tigonus)
textOut = siteDetails.regionName;
textOut = TextManager.Instance.GetLocalizedRegionName(siteDetails.regionIndex);
break;

default: // Macro not supported
Expand Down Expand Up @@ -325,6 +325,7 @@ public bool ConfigureFromPlayerLocation(string symbolName)
siteDetails.siteType = siteType;
siteDetails.mapId = location.MapTableData.MapId;
siteDetails.locationId = location.Exterior.ExteriorData.LocationId;
siteDetails.regionIndex = location.RegionIndex;
siteDetails.buildingKey = buildingKey;
siteDetails.buildingName = buildingName;
siteDetails.regionName = location.RegionName;
Expand Down Expand Up @@ -893,6 +894,7 @@ bool SelectRemoteDungeonSite(int dungeonTypeIndex)
siteDetails.siteType = SiteTypes.Dungeon;
siteDetails.mapId = location.MapTableData.MapId;
siteDetails.locationId = location.Exterior.ExteriorData.LocationId;
siteDetails.regionIndex = location.RegionIndex;
siteDetails.regionName = location.RegionName;
siteDetails.locationName = location.Name;
siteDetails.questSpawnMarkers = questSpawnMarkers;
Expand Down Expand Up @@ -939,6 +941,7 @@ bool SelectRemoteLocationExteriorSite(int locationTypeIndex)
siteDetails.siteType = SiteTypes.Town;
siteDetails.mapId = location.MapTableData.MapId;
siteDetails.locationId = location.Exterior.ExteriorData.LocationId;
siteDetails.regionIndex = location.RegionIndex;
siteDetails.regionName = location.RegionName;
siteDetails.locationName = location.Name;
siteDetails.questSpawnMarkers = null;
Expand Down Expand Up @@ -1059,6 +1062,7 @@ void SetupFixedLocation()
siteDetails.siteType = siteType;
siteDetails.mapId = location.MapTableData.MapId;
siteDetails.locationId = location.Exterior.ExteriorData.LocationId;
siteDetails.regionIndex = location.RegionIndex;
siteDetails.regionName = location.RegionName;
siteDetails.locationName = location.Name;
siteDetails.buildingKey = buildingKey;
Expand Down

0 comments on commit 49799a1

Please sign in to comment.