Remove snapshot_id

It is now consistently replaced by build_num. The next snapshot will be snapshot-353.
This commit is contained in:
Tamás Bálint Misius 2023-10-19 11:36:19 +02:00
parent 7fc3fb4c15
commit a9cbd784f7
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
10 changed files with 21 additions and 37 deletions

6
.github/build.sh vendored
View File

@ -251,16 +251,12 @@ if [[ $stable_or_beta == yes ]]; then
fi fi
if [[ $RELEASE_TYPE == snapshot ]]; then if [[ $RELEASE_TYPE == snapshot ]]; then
meson_configure+=$'\t'-Dsnapshot=true meson_configure+=$'\t'-Dsnapshot=true
meson_configure+=$'\t'-Dsnapshot_id=$(echo $RELEASE_NAME | cut -d '-' -f 2) # $RELEASE_NAME is snapshot-X meson_configure+=$'\t'-Dbuild_num=$(echo $RELEASE_NAME | cut -d '-' -f 2) # $RELEASE_NAME is snapshot-X
fi fi
if [[ $RELEASE_TYPE == snapshot ]] && [[ $MOD_ID != 0 ]]; then if [[ $RELEASE_TYPE == snapshot ]] && [[ $MOD_ID != 0 ]]; then
>&2 echo "mods and snapshots do not mix" >&2 echo "mods and snapshots do not mix"
exit 1 exit 1
fi fi
if [[ $stable_or_beta == yes ]] && [[ $MOD_ID != 0 ]]; then
# mods and snapshots both check their snapshot_id against whatever version starcatcher.us/TPT has
meson_configure+=$'\t'-Dsnapshot_id=$(echo $RELEASE_NAME | cut -d '.' -f 3) # $RELEASE_NAME is vX.Y.Z
fi
if [[ $RELEASE_TYPE == snapshot ]] || [[ $MOD_ID != 0 ]]; then if [[ $RELEASE_TYPE == snapshot ]] || [[ $MOD_ID != 0 ]]; then
meson_configure+=$'\t'-Dupdate_server=starcatcher.us/TPT meson_configure+=$'\t'-Dupdate_server=starcatcher.us/TPT
fi fi

View File

@ -36,13 +36,6 @@ option(
value: false, value: false,
description: 'Snapshot build' description: 'Snapshot build'
) )
option(
'snapshot_id',
type: 'integer',
min: 0,
value: 0,
description: 'Snapshot ID, only relevant if \'snapshot\' is true'
)
option( option(
'display_version_major', 'display_version_major',
type: 'integer', type: 'integer',
@ -140,7 +133,7 @@ option(
'update_server', 'update_server',
type: 'string', type: 'string',
value: '', value: '',
description: 'Update server, only used by snapshots and mods, see \'snapshot_id\' and \'mod_id\'' description: 'Update server, only used by snapshots and mods, see \'snapshot\' and \'mod_id\''
) )
option( option(
'workaround_noncpp_lua', 'workaround_noncpp_lua',

View File

@ -45,7 +45,6 @@ constexpr char APPID[] = "@APPID@";
constexpr char APPDATA[] = "@APPDATA@"; constexpr char APPDATA[] = "@APPDATA@";
constexpr char APPVENDOR[] = "@APPVENDOR@"; constexpr char APPVENDOR[] = "@APPVENDOR@";
constexpr int SNAPSHOT_ID = @SNAPSHOT_ID@;
constexpr int MOD_ID = @MOD_ID@; constexpr int MOD_ID = @MOD_ID@;
struct DisplayVersionWithBuild struct DisplayVersionWithBuild

View File

@ -2317,7 +2317,6 @@ std::pair<bool, std::vector<char>> GameSave::serialiseOPS() const
bson_append_int(&b, "majorVersion", int(currentVersion[0])); bson_append_int(&b, "majorVersion", int(currentVersion[0]));
bson_append_int(&b, "minorVersion", int(currentVersion[1])); bson_append_int(&b, "minorVersion", int(currentVersion[1]));
bson_append_int(&b, "buildNum", APP_VERSION.build); bson_append_int(&b, "buildNum", APP_VERSION.build);
bson_append_int(&b, "snapshotId", SNAPSHOT_ID);
bson_append_int(&b, "modId", MOD_ID); bson_append_int(&b, "modId", MOD_ID);
bson_append_string(&b, "releaseType", ByteString(1, IDENT_RELTYPE).c_str()); bson_append_string(&b, "releaseType", ByteString(1, IDENT_RELTYPE).c_str());
bson_append_string(&b, "platform", IDENT_PLATFORM); bson_append_string(&b, "platform", IDENT_PLATFORM);

View File

@ -76,7 +76,7 @@ namespace http
if constexpr (SNAPSHOT || MOD) if constexpr (SNAPSHOT || MOD)
{ {
parseUpdate("Snapshot", UpdateInfo::channelSnapshot, [](int build) -> bool { parseUpdate("Snapshot", UpdateInfo::channelSnapshot, [](int build) -> bool {
return build > SNAPSHOT_ID; return size_t(build) > APP_VERSION.build;
}); });
} }
else else

View File

@ -17,7 +17,7 @@ namespace http
"; NO", // Unused, used to be SSE level. "; NO", // Unused, used to be SSE level.
"; M", MOD_ID, "; M", MOD_ID,
"; ", IDENT, "; ", IDENT,
") TPTPP/", apiVersion[0], ".", apiVersion[1], ".", APP_VERSION.build, IDENT_RELTYPE, ".", SNAPSHOT_ID ") TPTPP/", apiVersion[0], ".", apiVersion[1], ".", APP_VERSION.build, IDENT_RELTYPE, ".", 0
); );
} }

View File

@ -1601,13 +1601,13 @@ void GameController::NotifyUpdateAvailable(Client * sender)
updateMessage << "Click \"Continue\" to download the latest version from our website.\n\nCurrent version:\n "; updateMessage << "Click \"Continue\" to download the latest version from our website.\n\nCurrent version:\n ";
} }
if constexpr (MOD)
{
updateMessage << "Mod " << MOD_ID << " ";
}
if constexpr (SNAPSHOT) if constexpr (SNAPSHOT)
{ {
updateMessage << "Snapshot " << SNAPSHOT_ID; updateMessage << "Snapshot " << APP_VERSION.build;
}
else if constexpr (MOD)
{
updateMessage << "Mod version " << SNAPSHOT_ID;
} }
else if constexpr (BETA) else if constexpr (BETA)
{ {

View File

@ -5,14 +5,19 @@
inline ByteString VersionInfo() inline ByteString VersionInfo()
{ {
ByteStringBuilder sb; ByteStringBuilder sb;
sb << DISPLAY_VERSION[0] << "." << DISPLAY_VERSION[1] << "." << APP_VERSION.build << " " << IDENT; sb << DISPLAY_VERSION[0] << "." << DISPLAY_VERSION[1];
if constexpr (!SNAPSHOT)
{
sb << "." << APP_VERSION.build;
}
sb << " " << IDENT;
if constexpr (MOD)
{
sb << " MOD " << MOD_ID << " UPSTREAM " << UPSTREAM_VERSION.build;
}
if constexpr (SNAPSHOT) if constexpr (SNAPSHOT)
{ {
sb << " SNAPSHOT " << SNAPSHOT_ID; sb << " SNAPSHOT " << APP_VERSION.build;
}
else if constexpr (MOD)
{
sb << " MODVER " << SNAPSHOT_ID;
} }
if constexpr (LUACONSOLE) if constexpr (LUACONSOLE)
{ {

View File

@ -415,14 +415,7 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
lua_setfield(l, tptPropertiesVersion, "upstream_minor"); lua_setfield(l, tptPropertiesVersion, "upstream_minor");
lua_pushinteger(l, UPSTREAM_VERSION.build); lua_pushinteger(l, UPSTREAM_VERSION.build);
lua_setfield(l, tptPropertiesVersion, "upstream_build"); lua_setfield(l, tptPropertiesVersion, "upstream_build");
if constexpr (SNAPSHOT || MOD) lua_pushboolean(l, SNAPSHOT);
{
lua_pushinteger(l, SNAPSHOT_ID);
}
else
{
lua_pushinteger(l, 0);
}
lua_setfield(l, tptPropertiesVersion, "snapshot"); lua_setfield(l, tptPropertiesVersion, "snapshot");
lua_pushinteger(l, MOD_ID); lua_pushinteger(l, MOD_ID);
lua_setfield(l, tptPropertiesVersion, "modid"); lua_setfield(l, tptPropertiesVersion, "modid");

View File

@ -11,7 +11,6 @@ conf_data.set('MOD_ID', mod_id)
conf_data.set('DEBUG', is_debug.to_string()) conf_data.set('DEBUG', is_debug.to_string())
conf_data.set('MOD', is_mod.to_string()) conf_data.set('MOD', is_mod.to_string())
conf_data.set('SNAPSHOT', is_snapshot.to_string()) conf_data.set('SNAPSHOT', is_snapshot.to_string())
conf_data.set('SNAPSHOT_ID', get_option('snapshot_id'))
conf_data.set('DISPLAY_VERSION_MAJOR', get_option('display_version_major')) conf_data.set('DISPLAY_VERSION_MAJOR', get_option('display_version_major'))
conf_data.set('DISPLAY_VERSION_MINOR', get_option('display_version_minor')) conf_data.set('DISPLAY_VERSION_MINOR', get_option('display_version_minor'))
conf_data.set('BUILD_NUM', get_option('build_num')) conf_data.set('BUILD_NUM', get_option('build_num'))