aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build/mkgamedata.c12
-rw-r--r--src/fixes.c2
-rw-r--r--src/gametype.h6
3 files changed, 9 insertions, 11 deletions
diff --git a/src/build/mkgamedata.c b/src/build/mkgamedata.c
index d3b9c9c..de70c0b 100644
--- a/src/build/mkgamedata.c
+++ b/src/build/mkgamedata.c
@@ -182,8 +182,10 @@ F( "#line %d \"%" fS "\"", srclines[i], srcnames[srcfiles[i]])
// don't attempt to optimise for nested conditionals because that's
// way more complicated and also basically defeats the purpose.
if (indents[j] != 1) continue;
- if_cold (fprintf(out, "%s \\\n\t _gametype_tag_%s", pipe,
- sbase + tags[j]) < 0) {
+ bool neg = sbase[tags[j]] == '!';
+ const char *tilde = (const char *)"~" + !neg; // cast away warning
+ if_cold (fprintf(out, "%s \\\n\t %s_gametype_tag_%s", pipe, tilde,
+ sbase + tags[j] + neg) < 0) {
diewrite();
}
pipe = " |";
@@ -247,14 +249,16 @@ _i("}")
continue;
}
F( "#line %d \"%" fS "\"", srclines[i], srcnames[srcfiles[i]])
+ bool neg = sbase[tags[i]] == '!';
+ const char *excl = (const char *)"!" + !neg; // cast away warning
if (indents[i] > indents[i - 1]) {
-Fi(" if (GAMETYPE_MATCHES(%s)) {", sbase + tags[i])
+Fi(" if (%sGAMETYPE_MATCHES(%s)) {", excl, sbase + tags[i] + neg);
++indent;
}
else {
_i("}")
F( "#line %d \"%" fS "\"", srclines[i], srcnames[srcfiles[i]])
-Fi("else if (GAMETYPE_MATCHES(%s)) {", sbase + tags[i])
+Fi("else if (%sGAMETYPE_MATCHES(%s)) {", excl, sbase + tags[i] + neg);
}
if (exprs[i]) {
F( "#line %d \"%" fS "\"", srclines[i], srcnames[srcfiles[i]])
diff --git a/src/fixes.c b/src/fixes.c
index d4b5330..733616b 100644
--- a/src/fixes.c
+++ b/src/fixes.c
@@ -91,8 +91,8 @@ static void generalfixes() {
// fps_max policy varies a bit between speedgames and their communities!
// in theory we might wanna remove CON_NOTCONN on Portal 1 in a future
// release, but for now people haven't fully talked themselves into it.
- struct con_var *v = con_findvar("fps_max");
if (GAMETYPE_MATCHES(L4Dx)) {
+ struct con_var *v = con_findvar("fps_max");
// for L4D games, generally changing anything above normal limits is
// disallowed, but externally capping FPS will always be possible so we
// might as well allow lowering it ingame for convenience.
diff --git a/src/gametype.h b/src/gametype.h
index 6f6a712..5b9336b 100644
--- a/src/gametype.h
+++ b/src/gametype.h
@@ -95,12 +95,6 @@ GAMETYPE_BASETAGS(_GAMETYPE_DISCARD, _GAMETYPE_ZERO)
(_gametype_tag_OrangeBox | _gametype_tag_2013)
#define _gametype_tag_Portal (_gametype_tag_Portal1 | _gametype_tag_Portal2)
-/* Match for stuff that's specifically NOT OE. */
-// TODO(compat): maybe we should add a specific !Tag syntax to mkgamedata,
-// which would make this redundant. as of now this is just a low-effort way to
-// keep some cvar things undefined under OE to avoid confusion
-#define _gametype_tag_NE (~_gametype_tag_OE)
-
#define GAMETYPE_MATCHES(x) !!(_gametype_tag & (_gametype_tag_##x))
#endif