Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Vdauphin

Dynamic Mission Parameter

Recommended Posts

Hello guys,

 

Mission Parameters are very usefull to define parameters.

For each parameter, I define values like this :

values[] = {0,1,2}; 

I am lazy to write those values. So I would like to make it automatically by using PreProcessor Commands.

My goal is create a macro like this :

GENERATE_VALUES(begin_value,end_value)

This will return :

GENERATE_VALUES(0,100) = {0,1,2, ............, 99,100}

 

I never work before on preprocessor commands and I also didn't find a lot of documentation on it.

 

I would like to know if it is possible to create this macro and if yes do you have some helpful documentation or code line ?

 

Here are my first lines of code. I am trying to make it recursive but I fail ...  :

 

#define SOMME(a1,a2) a1+a2
#define ELEMENT(end_value) SOMME(end_value,-1)##,##ELEMENT(SOMME(end_value,-1))
#define GENERATE_VALUES(begin_value,end_value) {##begin_value##,##ELEMENT(end_value)##end_value##}

Thanks your help!

Share this post


Link to post
Share on other sites
22 minutes ago, Vdauphin said:

I am lazy to write those values. So I would like to make it automatically by using PreProcessor Commands.

 

Sounds like: I'm too lazy to walk on my own feet, so I choose to crutches and a wheelchair. Sorry XD

Share this post


Link to post
Share on other sites
1 minute ago, serena said:

 

Sounds like: I'm too lazy to walk on my own feet, so I choose to crutches and a wheelchair. Sorry XD

x)

Here is my final goal : Automatic mod support

I want to detect all faction available depending on mod loaded on the server. So I need a dynamic mission parameter and this macro will help me a lot :)

Share this post


Link to post
Share on other sites

×