Commit graph

47 commits

Author SHA1 Message Date
Corantin H aca398f3c9 Added dialog to fix invalid map settings on load 2024-01-23 20:13:57 +01:00
Corantin H 9cc8a28305 Better map settings input (autocomplete, validation) 2024-01-23 20:13:56 +01:00
Robert Müller 159ddf5534 Refactor config manager, move config variable handling
Move all code for handling of config variables from console to config manager. The console no longer depends on the config manager, instead the config manager now depends on the console.

Add `struct`s to manage config variables of different types (int, color and string). The config manager now keeps a list of all config variables, so usage of the preprocessor can be avoided except for code to initially create all config variables. Additionally, a separate list of just the game config variables (config variables with `CFGFLAG_GAME`) is kept to optimize the `ResetGameSettings` function, as this function is called whenever connecting to a server and should be fast. Previously, this function was even less efficient because it preformed a linear search for every individual game config variable to find the respective command data.

Move console commands that opperate only on config variables (`reset`, `toggle` and `+toggle`) to config manager. Ensure that these commands only opperate on the desired config variables (client or server, respectively) by checking `IConsole::FlagMask`.

Add `IConfigManager::SetReadOnly` function to set/unset config variables as read-only instead of manually overriding the command handlers for the `sv_rescue` and `sv_test_cmds` config variables. This also fixes that read-only config variables could still be changed by using the `reset` command. A console message is now printed when trying to change a read-only config variable. Removing the special handling for these two config variables is additionally useful so the console does not need to keep a pointer to config values and manager.

Use a `CHeap` for the config variables, their help texts and the previous values of string config variables to avoid many separate allocations as well usage of static variables. Also use the heap to store the unknown commands instead of using `std::string`s.

Properly trigger command chain when resetting config variables with the `reset` command and when resetting game settings on map loading. Closes #7461.

Format default value for color variables as RGB/RGBA hex with dollar sign prefix. Closes #5523.

Add log message when using `reset` with a variable that does not exist. Use `log_error` instead of `dbg_msg` when saving config file fails.

Support unlimited number of config save callbacks instead of at most 16. The code also becomes more readable by using an `std::vector` instead of a fixed-size array and a separate num variable.

Consistently name `MACRO_CONFIG_*` parameters when declaring the macros.

Add `IConsole::CMDLINE_LENGTH` constant to represent the maximum length of the console input and thereby reduce usage of magic numbers for buffer sizes.
2023-11-30 20:26:00 +01:00
furo 6599b7e14b Save unknown commands from settings_ddnet.cfg 2023-11-11 19:09:13 +01:00
Jupeyy 5341fc37fd Minimal changes to default to Vulkan 2022-12-13 19:37:03 +01:00
Chairn 583d6e6c01 Mark virtual function as override using a script:
while IFS= read -r line; do file=${line%%:*}; lineno=$(echo $line | cut
-d':' -f2); echo "Treating $file line $lineno"; sed -i -e
"${lineno}s/virtual //" -e "${lineno}s/);\$/) override;/" -e
"${lineno}s/)\$/) override/" -e "${lineno}s/const\$/const override/" -e
"${lineno}s/) {/) override {/" -e "${lineno}s/) const {/) const override
{/" -e "${lineno}s/const;$/const override;/" "$file"; done < a
2022-05-17 23:47:32 +02:00
heinrich5991 1820a0e168 Add some checksum functions to the client
Let's see if it works out, if not, we can revert it.
2022-01-31 21:31:26 +01:00
def d787a4832b Implement "reset" command
to reset specific config to default value
2021-12-27 01:13:11 +01:00
Alexander Akulich c2f276cee1 Port CConfig API from the upstream (0.7.5)
The old (g_Config) API is kept to not break the stuff.

See commits:
    de5859b371
    78076761eb
2021-01-10 17:10:19 +03:00
Learath2 ba7b95f7ad Revert #3066
This reverts commits:
	a2b3f45f8b
	26a07c804f
2020-10-17 17:32:52 +02:00
heinrich5991 a2b3f45f8b Reintroduce CMDFLAG_TEST
Add some more helpful messages for executing test/game commands.
2020-10-11 16:27:28 +02:00
Andrii 26a07c804f Disallow game-related commands unless testing is enabled 2020-10-11 16:02:10 +02:00
Jupeyy bfe55728d2 fix c++ one definition rule for config 2020-10-07 08:06:26 +02:00
def 3be8a592e5 Run clang-format
Purely automatic change. In case of conflict with this change, apply the
other change and rerun the formatting to restore it:

$ python scripts/fix_style.py
2020-09-26 21:50:15 +02:00
def 31ae4c4d5a use pid in file names of temporary files
to prevent race conditions with multiple clients running when saving
maps, config on quit, during upgrade
2020-02-12 23:14:30 +01:00
Learath 0d39eb128d Use unsigned integers for colors 2019-05-15 18:05:19 +02:00
Learath f479f69735 Add a flag for colors with alpha 2019-05-01 13:58:51 +03:00
Learath 69d78c21b4 Lighten tee colors 2019-04-26 16:38:16 +03:00
Learath 93265dbb9c Please MSVC 2019-04-25 21:09:32 +03:00
Learath 0f781df1dd Try handling colors in console 2019-04-25 14:48:53 +03:00
def c95e1a61c6 More conservative config saving 2018-04-05 17:24:49 +02:00
heinrich5991 9761e9606a Make most user input teehistoric
Exclude private stuff like chat messages and votes.
2017-09-20 02:23:28 +02:00
heinrich5991 bf1f7d6ccd (Safely) execute settings embedded in maps 2015-08-27 12:55:34 +02:00
def 8f532aad9f Use autoexec_client/server.cfg by default, fall back to autoexec.cfg for both 2015-08-12 13:49:16 +02:00
def 4e658c1057 Minor cleanups 2015-07-22 18:23:40 +02:00
GreYFoX ee670118a5 Merge branch 'master' of git://github.com/oy/teeworlds into DDRace
Conflicts:
	src/engine/console.h
	src/engine/server/server.cpp
	src/engine/server/server.h
	src/engine/shared/config.h
	src/engine/shared/console.cpp
	src/engine/shared/console.h
	src/engine/shared/network_server.cpp
@heinrich5991 todo
2012-01-01 00:11:56 +02:00
oy ec4bb94537 added logout command for econ 2011-12-30 19:12:31 +01:00
GreYFoX 7e24be5d83 Version 1.091a 2011-08-31 12:10:15 +02:00
GreYFoX 4ca0681689 Added chat commands for only chat and available to all users
Thanks @heinrich5991 for this idea of a separate console object to handle it
2011-08-27 17:11:39 +02:00
GreYFoX 5b27758650 Removed level stuff
Removed client ID stuff
Removed console stuff
Resolved merge conflicts
Upgraded Banmaster
Cleaned up
2011-08-13 02:11:06 +02:00
GreYFoX 561ce64666 Renamed cheats to testing commands sv_test_cmds
Since these are testing commands, anyone can use them and only on their selves no login needed
Revised some rcon commands
cleanup some unwanted codes
2011-04-15 06:04:21 +02:00
GreYFoX 3f0ad1ab65 Cleaned up helper commands, @heinrich5991 please revise this commit 2011-04-15 05:20:52 +02:00
GreYFoX 0df6d0541f Merge branch 'master' of git://github.com/oy/teeworlds into HEAD
Conflicts:
	bam.lua
	src/engine/console.h
	src/engine/server.h
	src/engine/server/server.cpp
	src/engine/shared/config.h
	src/engine/shared/config_variables.h
	src/engine/shared/console.cpp
	src/engine/shared/console.h
	src/game/client/components/binds.cpp
	src/game/client/components/chat.h
	src/game/client/components/console.cpp
	src/game/client/components/console.h
	src/game/client/components/controls.cpp
	src/game/client/components/emoticon.h
	src/game/client/components/maplayers.cpp
	src/game/client/components/menus.h
	src/game/client/components/scoreboard.h
	src/game/client/components/spectator.h
	src/game/client/components/voting.h
	src/game/client/gameclient.cpp
	src/game/client/gameclient.h
	src/game/client/render.h
	src/game/collision.cpp
	src/game/editor/ed_layer_tiles.cpp
	src/game/gamecore.cpp
	src/game/gamecore.h
	src/game/layers.cpp
	src/game/layers.h
	src/game/mapitems.h
	src/game/server/entities/character.cpp
	src/game/server/entities/laser.cpp
	src/game/server/entities/laser.h
	src/game/server/entities/pickup.cpp
	src/game/server/entities/pickup.h
	src/game/server/entities/projectile.cpp
	src/game/server/gamecontext.cpp
	src/game/server/gamecontroller.cpp
	src/game/server/gamecontroller.h
	src/game/server/gameworld.cpp
	src/game/server/gameworld.h
	src/game/server/player.cpp
	src/game/variables.h
2011-04-14 01:27:49 +02:00
oy 06115dd49d added "Whitespace and line Endings cleanup" by GreYFoX 2011-04-13 20:37:12 +02:00
oy e6f0318bdf added "fixed some header guards and added a script to fix them all!" by Choupom 2011-04-13 20:22:10 +02:00
GreYFoX f7f6058a92 Merged Oy, Cleaned up, removed some useless features and code parts
Added Icon by landil
alot more...
2011-04-09 22:32:17 +02:00
GreYFoXGTi f1a8b6b7ad Merge branch 'master' of http://github.com/oy/teeworlds
Conflicts:
	src/engine/shared/config.h
	src/engine/shared/config_variables.h
	src/game/client/gameclient.cpp
	src/game/server/entities/character.cpp
	src/game/server/gamecontext.cpp
	src/game/server/gamecontext.h
2011-01-24 14:06:55 +02:00
m!nus 05d274444a Add banning to mastersrv: any packet from a banned IP (and optionally a fixed port) will be dropped (also affects clients. Put your bans into master.cfg: "ban 127.0.0.1" or "ban 127.0.0.1:8303". It's reloaded every 5 minutes. This change also adds IStorage, IConsole and IKernel to mastersrv. 2011-01-23 17:54:27 +01:00
GreYFoXGTi ddc5dd7ab3 Cleaned up & Re-arranged stuff 2011-01-06 05:46:10 +02:00
GreYFoXGTi cebbecf632 Some Code Improvements and Compiler warnings 2010-12-07 19:44:23 +02:00
GreYFoXGTi 5d9ee1736e made the code so it would have less conflicts in the future and Merged branch 'master' of http://github.com/oy/teeworlds
Conflicts:
	data/languages/dutch.txt
	data/languages/french.txt
	data/languages/german.txt
	data/languages/russian.txt
	src/game/server/entities/flag.cpp
	src/game/server/entities/flag.h
	src/game/server/gamecontext.cpp
	src/game/server/gamemodes/ctf.cpp
	src/game/server/gamemodes/ctf.h
	src/game/server/gamemodes/dm.cpp
	src/game/server/gamemodes/dm.h
	src/game/server/gamemodes/mod.cpp
	src/game/server/gamemodes/tdm.cpp
	src/game/server/gamemodes/tdm.h
2010-11-22 00:26:00 +02:00
Sworddragon fc9211c777 Updated copyrights 2010-11-20 21:26:06 +01:00
heinrich5991 50b8d93d6d finished system to generalize rcon commands, sorry for last commit's description 2010-11-07 17:35:11 +01:00
btd eae1d1e54b My special func ^_^ 2010-10-31 23:29:41 +03:00
GreYFoXGTi 8901057944 Modified the config variables to have level
Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
2010-08-31 01:47:55 +02:00
oy ad9b32b741 added the possibility to store commands within the console and execute them later on when everything is initialised correctly - fixes several possible startup crashes and the "Support bans in server configuration"-ticket 2010-08-07 20:22:25 +02:00
Magnus Auvinen 72c06a2589 copied refactor to trunk 2010-05-29 07:25:38 +00:00