File tree Expand file tree Collapse file tree
src/openvic-simulation/research Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,11 +146,11 @@ bool InventionManager::generate_invention_links(TechnologyManager& tech_manager)
146146
147147 for (Invention& invention : inventions.get_items ()) {
148148 for (const memory::string& tech_id : invention.raw_associated_tech_identifiers ) {
149- Technology const * tech = tech_manager.get_technology_by_identifier (tech_id);
150- if (tech) {
151- auto * mutable_tech = const_cast <Technology*>(tech);
152- mutable_tech->add_invention (&invention);
149+ Technology* tech = tech_manager.get_technology_by_identifier (tech_id);
150+ if (tech == nullptr ) {
151+ continue ;
153152 }
153+ tech->add_invention (&invention);
154154 }
155155
156156 invention.raw_associated_tech_identifiers .clear ();
Original file line number Diff line number Diff line change @@ -96,11 +96,15 @@ namespace OpenVic {
9696 };
9797
9898 struct TechnologyManager {
99+ friend struct InventionManager ;
100+
99101 IdentifierRegistry<TechnologyFolder> IDENTIFIER_REGISTRY (technology_folder);
100102 IdentifierRegistry<TechnologyArea> IDENTIFIER_REGISTRY (technology_area);
101103 IdentifierRegistry<Technology> IDENTIFIER_REGISTRY_CUSTOM_PLURAL (technology, technologies);
102104 IdentifierRegistry<TechnologySchool> IDENTIFIER_REGISTRY (technology_school);
103105
106+ IDENTIFIER_REGISTRY_NON_CONST_ACCESSORS_CUSTOM_PLURAL (technology, technologies);
107+
104108 public:
105109 bool add_technology_folder (std::string_view identifier);
106110
@@ -132,4 +136,4 @@ namespace OpenVic {
132136
133137 bool parse_scripts (DefinitionManager const & definition_manager);
134138 };
135- }
139+ }
You can’t perform that action at this time.
0 commit comments