Add a command to clear all lines of chat messages, same as the `clear_local_console`/`clear_remote_console` commands for the consoles. This is useful for example when taking screenshots or recording videos with initially empty chat.
Fix out-of-bounds reads in ghost loader when current chunk does not contain enough data for expected number of items.
Improve validation of ghost header information. Ensure strings (owner and map name) are null-terminated and valid UTF-8 to avoid crashes. Avoid duplicate code for validating header.
Remove `static` buffers for compression and decompression of ghost data, which would prevent parallelizing ghost recording and loading. Switch between the main buffer and only one temporary buffer instead of using two temporary buffers.
Automatically delete the ghost file when the recording is stopped with the number of ticks or time being invalid, i.e. when ghost recording will be restarted. This should ensure that invalid ghost files are not left behind if recording is not immediately restarted after being stopped, e.g. due to edge cases like standing inside a start-tile.
Use `int32_t` for `DiffItem` and `UndiffItem` data pointers as these functions are expected to operate on 32-bit integers. Ensure chunk and item data is aligned with `int32_t` to avoid potential unaligned accesses. Use `size_t` for size arguments.
Add assertions to ghost loader and recorder functions to ensure their correct usage. Ensure a file is not already open when opening another one and ensure that a file is open when reading/writing. Ensure that the ghost data type is valid, i.e. between `0` and `0xFF` because it is packed into an `unsigned char`. Ensure data size is valid and aligned with `int32_t`, otherwise data would be packed incorrectly by the `DiffItem` function. Improve error messages, consistent with the error messages of the demo player and recorder. Use the `log_*` functions for logging. Use the same color for all ghost-related log messages.
Avoid `system.h` include in `ghost.h` by moving `CGhostHeader` function definitions to `ghost.cpp`.
Closes#7413.
Simplify the code by replacing the usage of a linked list and heap with an `std::vector`.
The assignment operators are replaced with copy constructors to use `std::vector`.
Use the flag `MOVEFILE_WRITE_THROUGH` with the `MoveFileExW` function on Windows to ensure that the file is renamed/moved on the disk before the function returns. Otherwise, if the function returns before the file is moved, subsequent loading of the file with this name may fail sporadically.
See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw
Add `log_error_color`, `log_warn_color`, `log_info_color`, `log_debug_color` and `log_trace_color` macros to wrap `log_log_color` function with specific log levels.
Add comment to mark the `IConsole::Print` function as deprecated in favor of the `log_*` functions, which should be preferred for the following reasons:
- They support `printf`-formatting without a separate buffer.
- They support all five log levels.
- They do not require a pointer to `IConsole` to be used.
- Consistency of logging code.
The `IConsole::Format` function was previously used to format the log and rcon output, but it has become obsolete when the logging was refactored.
The function was still being used to format the output of the `show_ips` command in the rcon, which was causing this particular rcon line to have the old log format (e.g. `[12:34:56][server]: Value: 0`). Now, `IConsole::Print` is used directly, as this causes the output to be sent with the correct format and only to the rcon command user.
The `IConsole::FPrintCallback` function pointer typedef is also obsolete and unused.
It's not necessary to create a new `CTextureHandle` object after unloading the handle and it's also not necessary to check if the texture handle is valid when unloading it.
Store and update the last race tick directly in `CGameClient` instead of in `CGhost`, as the value is also used in the gameclient.
Move current race time calculation from `CClient` to `CGameClient`, as this function is not used in the engine and this allows removing unnecessary virtual functions.
Closes#1720.
Show popup to select the envelope curve type from a list when right clicking the curve type button, as selecting the curve type by pressing the button multiple times is inconvenient.
Switch to previous curve type on shift+left clicking the curve type button.
The `CLayers::InitBackground` function implemented a subset of the `CLayers::Init` function, only loading the game layers and not the other entities layers, so a Boolean parameter can be used to reduce the duplicate code.