From cde7041b5f660910c2b2d9bed5a36c66fab3ccf1 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Thu, 3 Mar 2016 01:33:03 -0500 Subject: [PATCH] Make all default components always have id "default_facet". This is mainly so that they are easily identified in the AI components overview in the gamestate inspector, but it can also be used with [modify_ai]. (It replaces the previous use of * for this.) --- src/ai/composite/aspect.hpp | 3 ++- src/ai/composite/property_handler.hpp | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ai/composite/aspect.hpp b/src/ai/composite/aspect.hpp index bf3660cd2b03..1140baa7178e 100644 --- a/src/ai/composite/aspect.hpp +++ b/src/ai/composite/aspect.hpp @@ -269,8 +269,9 @@ class composite_aspect : public typesafe_aspect { add_facet(-1,cfg_element); } - const config &_default = this->cfg_.child("default"); + config _default = this->cfg_.child("default"); if (_default) { + _default["id"] = "default_facet"; std::vector< aspect_ptr > default_aspects; engine::parse_aspect_from_config(*this,_default,parent_id_,std::back_inserter(default_aspects)); if (!default_aspects.empty()) { diff --git a/src/ai/composite/property_handler.hpp b/src/ai/composite/property_handler.hpp index d91634413863..77395aa0646d 100644 --- a/src/ai/composite/property_handler.hpp +++ b/src/ai/composite/property_handler.hpp @@ -185,8 +185,8 @@ class facets_property_handler : public vector_property_handler { component* handle_get(const path_element &child) { - //* is a special case - 'get the default facet' - if (child.id == "*") { + // special case - 'get the default facet' + if (child.id == "default_facet") { return default_.get(); } return vector_property_handler::handle_get(child); @@ -194,8 +194,8 @@ class facets_property_handler : public vector_property_handler { bool handle_change(const path_element &child, config cfg) { - //* is a special case - 'replace the default facet' - if (child.id == "*") { + // special case - 'replace the default facet' + if (child.id == "default_facet") { t_ptr_vector values; this->call_factory(values,cfg); default_ = values.back();