ddnet/src/engine/shared/config.rs
heinrich5991 dcd76fd3e1 Add support for Rust code in DDNet
The glue is done using the [cxx crate](https://cxx.rs/) on the Rust
side.

As a proof-of-concept, only a small console command (`rust_version`)
printing the currently used Rust version was added.

You can generate and open the Rust documentation using
`DDNET_TEST_NO_LINK=1 cargo doc --open`.

You can run the Rust tests using `cmake --build <build dir> --target
run_rust_tests`, they're automatically included in the `run_tests`
target as well.

Rust tests don't work on Windows in debug mode on Windows because Rust
cannot currently link with the debug version of the C stdlib on Windows:
https://github.com/rust-lang/rust/issues/39016.

---

The stuff in `src/rust-bridge` is generated using
```
cxxbridge src/engine/shared/rust_version.rs --output src/rust-bridge/engine/shared/rust_version.cpp --output src/rust-bridge/engine/shared/rust_version.h
cxxbridge src/engine/console.rs --output src/rust-bridge/cpp/console.cpp --output src/rust-bridge/cpp/console.h
```
2022-10-19 23:46:06 +02:00

58 lines
1.9 KiB
Rust

/// Config variable that is saved when the client is closed.
///
/// Has no effect on other commands.
pub const CFGFLAG_SAVE: i32 = 1 << 0;
/// Command that is available in the client.
pub const CFGFLAG_CLIENT: i32 = 1 << 1;
/// Command that is available on the server.
pub const CFGFLAG_SERVER: i32 = 1 << 2;
/// Command that is delayed in the execution until
/// `IConsole::StoreCommands(false)` is called.
pub const CFGFLAG_STORE: i32 = 1 << 3;
/// Command that is available in the master server.
pub const CFGFLAG_MASTER: i32 = 1 << 4;
/// Command that has something to do with the external console (econ).
pub const CFGFLAG_ECON: i32 = 1 << 5;
/// Command that can be used for testing or cheating maps. Only available if
/// `sv_test_cmds 1` is set.
pub const CMDFLAG_TEST: i32 = 1 << 6;
/// Command that can be used from the chat on the server.
pub const CFGFLAG_CHAT: i32 = 1 << 7;
/// Command that can be used from a map config.
///
/// Only commands that are not security sensitive should have this flag.
pub const CFGFLAG_GAME: i32 = 1 << 8;
/// Command that is not recorded into teehistorian.
///
/// This should only be set for security sensitive commands like passwords etc.
/// that should not be recorded.
pub const CFGFLAG_NONTEEHISTORIC: i32 = 1 << 9;
/// Color config variable that can only have lightness 0.5 to 1.0.
///
/// This is achieved by dividing the lightness channel by and adding 0.5, i.e.
/// remapping all the colors.
///
/// Has no effect on other commands or config variables.
pub const CFGFLAG_COLLIGHT: i32 = 1 << 10;
/// Color config variable that includes an alpha (opacity) value.
///
/// Has no effect on other commands or config variables.
pub const CFGFLAG_COLALPHA: i32 = 1 << 11;
/// Config variable with insensitive data that can be included in client
/// integrity checks.
///
/// This should only be set on config variables the server could observe anyway.
pub const CFGFLAG_INSENSITIVE: i32 = 1 << 12;