Add get_typestring_from_language_name

develop
Ryan Dwyer 2023-11-07 12:52:04 -08:00
parent 4798dc6560
commit fc2819ec1a
1 changed files with 13 additions and 1 deletions

@ -28,10 +28,22 @@ local zone_names = {
[df.civzone_type.ClayCollection] = 'Clay' [df.civzone_type.ClayCollection] = 'Clay'
} }
-- I used strings rather than df.civzone_type because nobody is going to search "MeadHall" they're going to search "Tavern"
local language_name_type_strings = {
[df.language_name_type.SymbolFood] = 'Inn/Tavern',
[df.language_name_type.SymbolDomestic] = 'MarketStall'
}
local function get_default_zone_name(zone_type) local function get_default_zone_name(zone_type)
return zone_names[zone_type] or '' return zone_names[zone_type] or ''
end end
local function get_typestring_from_language_name(language_name_type)
-- Looking at df.language.xml I think SymbolFood and SymbolDomestic are the only two we need to override?
-- Every other df.language_name_type for a location matches the displayed type name (e.g. Temples are language_name_type.Temple, etc)
return language_name_type_strings[language_name_type] or df.language_name_type[language_name_type]
end
local function get_zone_search_key(zone) local function get_zone_search_key(zone)
local site = df.global.world.world_data.active_site[0] local site = df.global.world.world_data.active_site[0]
local result = {} local result = {}
@ -54,7 +66,7 @@ local function get_zone_search_key(zone)
else -- zone is a special location and we need to get its type from world data else -- zone is a special location and we need to get its type from world data
local building, success, _ = utils.binsearch(site.buildings, zone.location_id, 'id') local building, success, _ = utils.binsearch(site.buildings, zone.location_id, 'id')
if success and building.name then if success and building.name then
table.insert(result, df.language_name_type[building.name.type]) table.insert(result, get_typestring_from_language_name(building.name.type))
if building.name.has_name then if building.name.has_name then
table.insert(result, dfhack.TranslateName(building.name, true)) table.insert(result, dfhack.TranslateName(building.name, true))
end end