From 2d0ac38fa0e023d29b32a867240df7fc38c5afaa Mon Sep 17 00:00:00 2001 From: Willian Henrique Date: Sun, 19 May 2024 17:14:55 -0300 Subject: Fix compatibility with latest L4D2 update --- src/kvsys.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/kvsys.h') diff --git a/src/kvsys.h b/src/kvsys.h index 0c8217d..de97b01 100644 --- a/src/kvsys.h +++ b/src/kvsys.h @@ -1,5 +1,6 @@ /* * Copyright © 2023 Michael Smith + * Copyright © 2024 Willian Henrique * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -32,7 +33,19 @@ struct KeyValues { bool hasescapes; bool evalcond; //char unused; - struct KeyValues *next, *child, *chain; + union { + struct { + struct KeyValues *next, *child, *chain; + } v1; + struct { + void *kvsys; + bool haskvsys; // wasting 3 bytes for no reason, brilliant + struct KeyValues *next, *child, *chain; + } v2; + }; + // this was supposedly added here at some point but we don't use it: + // typedef bool (*GetSymbolProc_t)(const char *pKey); + // GetSymbolProc_t m_pExpressionGetSymbolProc; }; /* Wraps the engine IKeyValuesSystem::GetStringForSymbol() call. */ @@ -49,7 +62,7 @@ struct KeyValues *kvsys_getsubkey(struct KeyValues *kv, int sym); * IMPORTANT: currently does not automatically coerce types like the engine * does. This can be added later if actually required. */ -const char *kvsys_getstrval(struct KeyValues *kv); +const char *kvsys_getstrval(const struct KeyValues *kv); /* Free a KV object and all its subkeys. */ void kvsys_free(struct KeyValues *kv); -- cgit v1.2.3