Armaclass
Armaclass copied to clipboard
Macros cause parsing to fail (#define and #include statements)
Was parsing Mike Force vehicle configs as the tag inclusions/exclusions can be pain to work out the final results without starting the gamemode and manually testing.
The parser would fail on these first macro lines
#include "..\ui\icons.inc"
#define RESPAWN_SHORT respawnType = "RESPAWN"; time = 10
#define RESPAWN_MEDIUM respawnType = "RESPAWN"; time = 30
#define RESPAWN_LONG respawnType = "RESPAWN"; time = 60
#define WRECK_SHORT respawnType = "WRECK"; time = 10
#define WRECK_MEDIUM respawnType = "WRECK"; time = 30
#define WRECK_LONG respawnType = "WRECK"; time = 60
#include
is a similar issue to #8 as it loads in additional config classes from somewhere else (inheritance is so fun isn't it :P )
But #define
macros are used to inject common values later in the config file.... and they don't necessarily have a key that can be parsed by armaclass
NOTE -- I think the lack of a key caused errors without doing with the macro replacement on RESPAWN_SHORT
. However, it was over 12 hours ago and i'm about to go to bed as it's 6am. so I could be wrong!
https://github.com/Savage-Game-Design/Mike-Force/blob/development/mission/config/subconfigs/vehicle_respawn_info.hpp#L503
class spawn_point_types {
class light_transport {
name = "Light transport";
RESPAWN_SHORT; // the problem line
class categories {
...
}
}
}
I've got a very messy, hacked together script which could possibly turn into a PR at some point.
- grabs the config file with
readlines
- ignores the
#include
macros - grabs the
#define
macros and parses them - replaces everything in the
readlines
data that matches the macro key - feeds the fixed
readlines
data toarmaclass.parse
Of course, there's also another option which is just to flat out exclude macros and any lines that don't have an appropriate key!