Xonotic
skin.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #define SKINBEGIN
4 #define SKINVECTOR(name,def) vector SKIN##name = def
5 #define SKINFLOAT(name,def) float SKIN##name = def
6 //#define SKINSTRING(name,def) const string SKIN##name = def
7 #define SKINSTRING(name,def) string SKIN##name = def
8 #define SKINEND
9 #include "skin-customizables.inc"
10 #undef SKINEND
11 #undef SKINBEGIN
12 #undef SKINSTRING
13 #undef SKINFLOAT
14 #undef SKINVECTOR
15 
16 #define SKINBEGIN void Skin_ApplySetting(string key, string _value) { switch(key) {
17 #define SKINVECTOR(name,def) case #name: SKIN##name = stov(_value); break
18 #define SKINFLOAT(name,def) case #name: SKIN##name = stof(_value); break
19 //#define SKINSTRING(name,def) case #name: break
20 #define SKINSTRING(name,def) case #name: SKIN##name = strzone(_value); break
21  // I know this leaks memory when skin is read multiple times. Screw it.
22 #define SKINEND case "": break; case "//": break; default: LOG_TRACE("Invalid key in skin file: ", key); } }
23 #include "skin-customizables.inc"
24 #undef SKINEND
25 #undef SKINSTRING
26 #undef SKINFLOAT
27 #undef SKINVECTOR
28 #undef SKINBEGIN