The server keeps track of every player ID that ever connected successfully.
This database stores the last names and IPs used by the player and the
last countries the connections came from. Some stats are counted, like
"time connected" and "total tks". Most importantly, the database stores
rights (like admin) and restrictions (like ban). All rights and
restrictions are kept as dates (or timecodes), so, for example, if your
ban date is in the future, you are banned - and if it's in the past, you
can play. The collected stats are meant to help server owners at managing
players - especially, if they want to give someone admin rights.
The database is periodically saved to a file and read from that file on
startup. The default file is config/servervita.cfg and one backup is kept
in config/servervita_bak.cfg. During server start, if the regular file
can't be loaded, the backup is tried instead.
While the server is running, it checks periodically for a file named
config/servervita_update.cfg, and if the file exists, it is renamed to
a backup filename including a timecode and read and merged into the
database. The automatic rename makes sure, that a file is only read once.
Using such updates, a server owner can easily give several people admin
rights or for example, add clan tags for a whole list of IDs. (Yes, the
database also stores a clan tag for every ID...)
The database also stores two short comments for every ID. One can only be
read by server admins, but the other one is public. The public reason, for
example, can state a reason for a ban.
One database record takes up 264 bytes of RAM. During autosave, accounts,
that have not been used for a specified time (default 12 months), will
not be written. After a server restart, those old records will be gone.
Currently, there is no process in place, to also clean up old records
from RAM. Maybe, that'll be added later...
Uses own thread to actually write to logs, so the main thread can't be
blocked by a slow logfile. Log entries are buffered in two ringbuffers,
one for the main thread and one for all other threads. The main thread
will copy the second buffer to the main buffer periodically. The main
thread buffer is read from the log worker thread.
Since two buffers are kept, there are now several functions to add a log
entry:
mlog()
for main thread functions only: will never block
tlog()
other threads only: may block, until main thread copied some entries
xlog()
automatically determines, which thread it's been called from and
then writes to the proper buffer (will block accordingly)
To avoid improper usage, mlog and tlog verify, if they are used correctly.
(Only for debug builds. An assert triggers, if necessary.)
(to avoid casting IPs to signed integer)
also mute single number debug messages for compound data structures like
string and key: no longer print a debug message for every char of a string
Instead of a list of specific map+mode combinations the maprot now only
contains general rules for maps and game modes. The server then calculates
the list by itself when needed. The server accounts played maps and modes
(and map+mode combinations) and calculates the list specifically not to
overplay maps or modes.
May need further testing.
A list of parameters is read from config/serverparameters.cfg once per
minute and the values written to corresponding server data structures.
If the binary is compiled in debug mode, starting a dedicated server
will write a blank config file with all possible parameters and their
descriptions, sorted and grouped into chapters.
The name of the config file can be set with the commandline parameter -A.
So far, syntax errors are not reported. Instead, it's possible to dump
all current values to a file every time something changes.
"readserverconfigsthread" gets triggered by poll_serverthreads() once a
minute to check the filesizes of all server config files. Altered files
get loaded into memory.
poll_serverthreads() in the main thread then processes the buffered files
one at a time. During processing, a semaphore is locked, so that other
threads can use the data structures derived from config files - if they
use the semaphore to lock the ressource.
Using the data from main thread can be done without using the semaphore,
since _all_ changes are done in the main thread.
If the main thread wants to update data that is locked by a thread, the
main thread will defer the changes for a minute. The main thread will
never lock.
also:
* -Y now sets the private key for the server
* -m without argument uses default masterserver URL
* servers run LAN-only by default (set ms URL and private key to
register with the master)
* use generic locale "POSIX"
almost 3000 lines of "errors" contained one actual memleak, one actually
unused variable and three actual ambiguous code parts
from cppcheck website: "The goal is to detect only real errors in the
code (i.e. have zero false positives)." :)
thx for finding five problems in our code
new tool: list media sources
new stage: check vantage points
new: add single map from menu
new: option to abort maps on stage errors
fixed: make sure, player is alive (to be able to enter edit mode) during
conversions
- copyent and pasteent now also work with the menu list of copied ents
- pressing editmeta while using pasteent opens the menu
- new switch command (not unlike the old one)
- make expandselection and shrinkselection work with multiple selections
DOCREF switch copyent pasteent
newent7 type attr1 attr2 attr3 attr4 attr5 attr6 attr7
Works like newent, but can set all seven attributes directly.
Does not automatically put the camera yaw angle into mapmodel and flag
entities.
fixed selectionwalk so that the first parameter can be ""
DOCREF newent7
- always allow read-only edittextureslot, editmapmodelslot and
editmapsoundslot
- allow setvantagepoint when editing offline or spectating offline
- new var editing_sp: 1 during edit mode in singleplayer (offline)
- additional menus for read-only access to map config slots
- new bonus edit scripts: selectmiddle and unclipentclippedmodels
DOCREF edittextureslot editmapmodelslot editmapsoundslot setvantagepoint
DOCREF editing_sp
menuitemmapload mapname action [hoveraction [desc]]
create menu entry for a map file
menudirlistsub action dots
adds subdirectory entries to a menu with a files list
has to come after the menudirlist command
<action> is the command to be executed, when the menu entry is chosen
if <dots> is 1, an entry ".." is added
enumfiles path [extension]
lists files in a directory
if extension is specified, only files of that extension are listed
if the extension is "dir", only directories are listed
DOCREF menuitemmapload menudirlistsub enumfiles
pressing CTRL+F12 during spectating creates a clean screenshot and saves
it as map preview picture
modkeypressed
returns 1, if a CTRL key is pressed and 0, if not
screenshotpreview [lines]
creates a screenshot cropped to 4:3 with a given number of lines
(in the range of 144 to 480, default 240 or last given value)
and jpeg quality 80
gotovantagepoint
now returns 1, if the map actually has a vantage point set
DOCREF screenshotpreview modkeypressed gotovantagepoint
(editentity, edittextureslot, editmapmodelslot, editmapsoundslot)
the commands are still not allowed to change anything in coop, but
information retrieval is ok