There is a new version of the forums ready for testing. Please post here if you're willing to help test! We could also use the help of coders!

Author Topic: Modern C++ code is written but not used. What am I missing?  (Read 241 times)

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
I see in main.cpp that there's this main_process_cmdline function to parse command line arguments.
But I also see in cmdlineopts.cpp that the same code has been rewritten in modern c++.

Is the new code supposed to be part of AGS4, and, if yes, what do I need to toggle to enable the new code? Nothing seems to be using CmdLineOpts::Parse.


My bad. It's used by the new compiler. The Engine's startup simply hasn't been updated to use this too.





« Last Edit: 04 Aug 2022, 17:10 by Monsieur OUXX »
 

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
I've started working on that specific thing : https://github.com/adventuregamestudio/ags/pull/1749/commits
 

eri0o

When making the command line handling thing for the new compiler I wanted to add something that could be leveraged in the future for the other command line tools - there are eight already I think.

But the default command line options of AGS engine itself requires a lot more flexibility, there were things that I did not know how to modularize away at the time.

PS: there wasn't any rational towards being modern at the time, it was based on looking other small command line libraries that existed.
« Last Edit: 07 Aug 2022, 17:52 by eri0o »

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
But the default command line options of AGS engine itself requires a lot more flexibility
I simply has options that take more than one argument, I've added 2, 3 and 4 arguments to your mini library.
 
 

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
I simply has options that take more than one argument, I've added 2, 3 and 4 arguments to your mini library.

Speaking of which; I did not research the code thoroughly yet, so cannot tell why was this necessary, but these 2,3,4 argument sets caught my eye. I wish there were a different implementation, that would not require to have N different sets depending on how many command arguments we need to support.
« Last Edit: 08 Aug 2022, 08:54 by Crimson Wizard »

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Speaking of which;  these 2,3,4 argument sets caught my eye.
Me too; it does not satisfy the dev in me; but right now I'm trying to get rid of the "old" implementation (greedy parser). That, and the fact that the discovered options were applied on the spot using global variables.

When everything works I can factor together the code for 2, 3, 4 params; this was a quick copy-paste fix after realizing that the feature was missing from the new CmdLineOpts

 

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
EDIT: Created separate theread