diff --git a/plugins/lua/sort/places.lua b/plugins/lua/sort/places.lua index dc8816970..0baefb980 100644 --- a/plugins/lua/sort/places.lua +++ b/plugins/lua/sort/places.lua @@ -28,10 +28,22 @@ local zone_names = { [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) return zone_names[zone_type] or '' 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 site = df.global.world.world_data.active_site[0] 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 local building, success, _ = utils.binsearch(site.buildings, zone.location_id, 'id') 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 table.insert(result, dfhack.TranslateName(building.name, true)) end