Page 1 of 1
[Ruleset] Something like C preprocessor for override directory
Posted: Sun Oct 22, 2017 2:22 pm
by Lachu
It makes sense to use preprocessor construction in override ruleset directory, so player can incorporate with more ruleset than once. For example:
Code: Select all
#if ruleset_name("civ2civ3")
some code
#else
some other code
#endif
Other example:
Code: Select all
#if nation_exist("Polish")
[unittype_wing_husar]
some code
#endif
Instead of making preprocessor, you can add needed code to lua interpreter.
Re: [Ruleset] Something like C preprocessor for override directory
Posted: Mon Oct 23, 2017 11:19 pm
by dunnoob
Lachu wrote:Code: Select all
#if ruleset_name("civ2civ3")
some code
#else
some other code
#endif
Yes, I also wished that something like your idea existed in ruleset files, but
"rejected" it (=never put it on the wish list here or submitted it as feature request) as violation of the KISS principle: If it is important it can be implemented as requirement (for effects, etc.), with the else-part covered by present=FALSE. For our personal purposes we could roll our own .c-ruleset.i-ruleset: make file rules.

Re: [Ruleset] Something like C preprocessor for override directory
Posted: Fri Nov 03, 2017 7:26 pm
by Lachu
So we can fork C preprocessor to make program to generate new rulest from many ruleset or implement lua api to generate ruleset before game starts.
In my opinion, second way is better, but if we decided to one, then I propose to make preprocesor layered. In some step preprocesor will handle file one and in next give result on this step to input of next step.
Layers could be nested in this way:
1, Freeciv original ruleset
2. Not important general changes/settings
3. Selected override directory definitions
4. Important general changes/settings