Json "defines"

Is there a way to use “defines” in JSON? I would like to be able to use names instead of numbers.

For example here…

// Indicate which dwelling produces which creature
	// Note that it is 1<->n connection since
	// a creature can be produced by more than one dwelling.
		{ "dwelling": 0, "creature": 106 },
		{ "dwelling": 1, "creature": 96 },
		{ "dwelling": 2, "creature": 74 },
		{ "dwelling": 3, "creature": 66 },

No macros in config.

Engine can already handle creatures by name (check HoTA pack), we’re going to change files to that format.

Can you paste a small example of a hota file?

And theoretically if I wanted to use “macros” in JSON do you know a way to do it? :smiley:

Check 0.9 release announcement for link to complete hota creatures package.

This is not a problem with json but with c++ in general - you can’t get string from enumerations items.
So if you have


You won’t be able to get RED\GREEN\BLUE in runtime (for example to read such strings from file). Same goes to C-style define’s

This can be avoided with some macro magic. Take a look at lib/HeroBonus files.