aliens

Author Topic: Converting OXCE to rapidyaml  (Read 15941 times)

Offline Delian

  • Commander
  • *****
  • Posts: 597
    • View Profile
Re: Converting OXCE to rapidyaml
« Reply #195 on: January 28, 2025, 01:57:43 am »
I'd want to see those "nested rulesets" that are causing the loss of error messages first.

Static is a no-go, because it breaks my multi-threading ;)

Offline Yankes

  • Global Moderator
  • Commander
  • ***
  • Posts: 3405
    • View Profile
Re: Converting OXCE to rapidyaml
« Reply #196 on: January 28, 2025, 02:18:16 am »
I'd want to see those "nested rulesets" that are causing the loss of error messages first.

Static is a no-go, because it breaks my multi-threading ;)
Where I used "static" variables that could be problem here? Only static is `YamlErrorHandler` that is stateless.
And all `tree` objects get its own "handler" as global is only fallback if not overridden.


And code that crash without info look like:
Code: [Select]

    reinforcements:
      - type: firstwave
        minTurn: 1
        maxTurn: 1
        maxRuns: 1
        mapBlockFilterType: 1
        spawnZLevels: [7]
        randomizeZLevels: falsee #crash here without info where it is
this is code related to `AlienDeployment`, any `tryRead` will break line info as we call functions like
Code: [Select]
bool read(ryml::ConstNodeRef const& n, ReinforcementsData* val)
as now there is no `root` in sight. as alterative would be refactor all calls to propagate one pointer.
but as `yml::Callbacks` already need have pointer that we control, we could easy store here our `root`.

Offline Delian

  • Commander
  • *****
  • Posts: 597
    • View Profile
Re: Converting OXCE to rapidyaml
« Reply #197 on: January 28, 2025, 02:46:55 am »
Hmm, nevermind that. So you're storing root in the callbacks...

Actually this looks good. It's probably a normal way to use Callbacks, and not a hack at all.

Yes, with that we can get rid of the _root reference from the YamlNodeReader/Writer and we can probably remove the global callbacks that I've set up as well.