Author Topic: [Suggestion] 'inherit' rulesets option - duplication with minimal entrires  (Read 525 times)

Online 0xEBJC

  • Colonel
  • ****
  • Posts: 148
  • Y'all are awesome! Thankful for this community.
    • View Profile
    • My Projects
I post this question below but didn't know if it was a good idea to post into a '[DONE]' topic

https://openxcom.org/forum/index.php/topic,11198.msg160045.html#msg160045

Like 'override' and 'update' that could duplicate / 'inherit' another entry?

I don't think this feature is implemented but would a great enhancement.

Sorry if this question has already been asked or implemented, doing my best to look for posted answers before asking.

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: [Suggestion] 'inherit' rulesets option - duplication with minimal entrires
« Reply #1 on: December 18, 2023, 06:16:47 pm »
As I replayed in other topic, I do not plan adding some thing like this, too much work in implementation compared to benefits its give.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Re: [Suggestion] 'inherit' rulesets option - duplication with minimal entrires
« Reply #2 on: December 18, 2023, 09:32:17 pm »
Both the design and the implementation of the OpenXcom modding system does not support true inheritance.

(Unless you want to change the entire system,) it is not possible to implement this.

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: [Suggestion] 'inherit' rulesets option - duplication with minimal entrires
« Reply #3 on: December 18, 2023, 10:22:12 pm »
Both the design and the implementation of the OpenXcom modding system does not support true inheritance.

(Unless you want to change the entire system,) it is not possible to implement this.
In theory we could simply implement this in term of C++ copy-constructor, but still even in this case we would need visit
each class and make it support correctly copying, that in some cases is not trivial.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Re: [Suggestion] 'inherit' rulesets option - duplication with minimal entrires
« Reply #4 on: December 18, 2023, 10:59:34 pm »
Even if you come up with some implementation ideas, design-wise it's still the opposite of well-defined.

Any hack, compromise or workaround will only make the already bad situation (a lot) worse.

We've beaten this dead horse enough, time to admit it's dead.

Offline GumChewer

  • Sergeant
  • **
  • Posts: 38
    • View Profile
That feature would be great, because refNode only works within in the same yaml file.
I always wanted to implement this, or a similar, feature myself downstream.

An implementation in XXX::load(...) would be as easy as
const auto idSave = _id;
*this = mod.getXXX(node["copy"].as<std::string>());
_id = idSave;

But the implicit copy constructors are deleted on many/all relevant classes.
Undeleting them gives lengthy compiler errors somehow related to Y-script.
So I had to resort to a lengthy implementation of only selected tags.

It would be great if the implicit copy constructors would come back.
« Last Edit: March 02, 2024, 12:30:24 pm by GumChewer »