1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-12 16:15:20 +02:00

Network: offload often changed constants to source file (#15207)

* Network: offload often changed constants to source file

This prevents unnecessary recompiling when using incremental builds.
There is also no need to have separate max proto version variables;
as they're subject to the handshake between client and server. The
code is also expected to support the same version (or higher).

Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
SmallJoker
2024-10-02 11:01:30 +02:00
committed by GitHub
parent 22ef4c8be1
commit 3797ca52c4
13 changed files with 92 additions and 241 deletions

View File

@@ -43,7 +43,12 @@ read_versions() {
# in: $1
read_proto_ver() {
local ref=$1
git show "$ref":src/network/networkprotocol.h | grep -oE 'LATEST_PROTOCOL_VERSION [0-9]+' | tr -dC 0-9
local output=$(git show "$ref":src/network/networkprotocol.cpp 2>/dev/null)
if [ -z "$output" ]; then
# Fallback to previous file (for tags < 5.10.0)
output=$(git show "$ref":src/network/networkprotocol.h)
fi
grep -oE 'LATEST_PROTOCOL_VERSION\s+=?\s*[0-9]+' <<<"$output" | tr -dC 0-9
}
## Prompts for new version