Commit graph

20 commits

Author SHA1 Message Date
Bill Currie
12c84046f3 [cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.

As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.

The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).

While not used yet (partly due to working out the design), cvars can
have a validation function.

Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.

nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-24 19:15:22 +09:00
Bill Currie
86b5b30b45 Merge branch 'master' into vulkan 2020-06-25 14:03:52 +09:00
Bill Currie
88b4046632 [util] Pass a data pointer to shutdown functions
And clean up the mess.
2020-03-22 00:57:54 +09:00
Bill Currie
4e4d1b99b4 Clean up all the system shutdown calls
I added Sys_RegisterShutdown years ago and never really did anything
with it: now any system that needs to be shutdown can ensure it gets
shutdown on program exit, and in the correct order (ie, reverse to init
order).
2019-07-12 23:15:26 +09:00
Bill Currie
34bcf7faab Do a pure/const/noreturn/format attribute pass.
I always wanted these, but as gcc now provides warnings for functions that
could do with such attributes, finding all the functions is much easier.
2018-10-09 12:42:21 +09:00
Bill Currie
ce6ab908a5 Don't include the specific plugin headers in plugin.h.
This lets files that use plugins not depend on plugins they don't use.
2012-02-13 22:02:07 +09:00
Bill Currie
cc5140e3a1 Move min/max/bound and field_offset into better locations.
min/max bound into mathlib.h (they /are/ math functions, after all) and
field_offset into qtypes.h.
2011-12-24 10:04:33 +09:00
Bill Currie
a71acc9ae5 Move the essential init code into Sys_Init(). 2011-09-11 14:56:47 +09:00
Bill Currie
d66934942d nuke Con_Printf and Con_DPrintf and use Sys_* instead 2007-11-06 10:17:14 +00:00
Ragnvald Maartmann-Moe IV
1f04776ad1 Mostly whitespace. 2003-02-13 00:06:24 +00:00
Ragnvald Maartmann-Moe IV
6466f44ed3 x86-64 fix from Mike A. Harris. 2003-02-12 23:56:29 +00:00
Bill Currie
8ff653a142 forgot to clean up the net headers 2003-02-12 19:41:44 +00:00
Bill Currie
84f90f904c more cleanup 2003-02-12 18:36:14 +00:00
Bill Currie
7e968f0837 fix up unknown packet output 2003-02-12 17:46:48 +00:00
Bill Currie
5c6b3c1968 various cleanups 2003-02-12 17:15:03 +00:00
Ragnvald Maartmann-Moe IV
3fbb55f8ad More variable declares in the middle of functions. gcc 2.95 does not seem to like this at all... 2003-02-12 06:53:38 +00:00
Ragnvald Maartmann-Moe IV
872c2f5c5f Attempt to fix alphageek's compile problem, and clean up other horrors. 2003-02-12 06:24:30 +00:00
Bill Currie
cd448e12ce initialize the cmd and cvar stuff properly (hey, look, pretty console with
+set sv_use_curses 1:)
2003-02-12 02:39:24 +00:00
Bill Currie
21d8b4f8dc link in hw, move the qw and nq networking code into libs/net and make
hw-master use libnetchan. there are evil include hacks that will need to be
taken care of in net*.[ch]
2003-02-11 22:48:57 +00:00
Bill Currie
ee56645e76 d'oh 2003-02-10 21:06:30 +00:00