Adventure Game Studio | Forums

AGS Development => Engine Development => Topic started by: Monsieur OUXX on 04 Aug 2022, 16:53

Title: Modern C++ code is written but not used. What am I missing?
Post by: Monsieur OUXX on 04 Aug 2022, 16:53
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.





Title: Re: Modern C++ code is written but not used. What am I missing?
Post by: Monsieur OUXX on 06 Aug 2022, 01:36
I've started working on that specific thing : https://github.com/adventuregamestudio/ags/pull/1749/commits
Title: Re: Modern C++ code is written but not used. What am I missing?
Post by: eri0o on 07 Aug 2022, 17:45
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.
Title: Re: Modern C++ code is written but not used. What am I missing?
Post by: Monsieur OUXX on 08 Aug 2022, 08:42
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.
 
Title: Re: Modern C++ code is written but not used. What am I missing?
Post by: Crimson Wizard on 08 Aug 2022, 08:47
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.
Title: Re: Modern C++ code is written but not used. What am I missing?
Post by: Monsieur OUXX on 08 Aug 2022, 12:45
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

Title: Re: Modern C++ code is written but not used. What am I missing?
Post by: Monsieur OUXX on 08 Aug 2022, 13:12
EDIT: Created separate theread