Preprocessor purge round 12: BETA, SNAPSHOT, MOD
This commit is contained in:
parent
9068920de3
commit
b16cbf86fc
@ -327,13 +327,13 @@ conf_data.set('AND', host_platform == 'android')
|
||||
conf_data.set('WIN', host_platform == 'windows')
|
||||
conf_data.set('MACOSX', host_platform == 'darwin')
|
||||
conf_data.set('X86', is_x86)
|
||||
conf_data.set('BETA', is_beta)
|
||||
conf_data.set('BETA', is_beta ? 'true' : 'false')
|
||||
conf_data.set('INSTALL_CHECK', get_option('install_check') ? 'true' : 'false')
|
||||
conf_data.set('IGNORE_UPDATES', get_option('ignore_updates') ? 'true' : 'false')
|
||||
conf_data.set('MOD_ID', mod_id)
|
||||
conf_data.set('DEBUG', is_debug)
|
||||
conf_data.set('SNAPSHOT', is_snapshot)
|
||||
conf_data.set('MOD', is_mod)
|
||||
conf_data.set('SNAPSHOT', is_snapshot ? 'true' : 'false')
|
||||
conf_data.set('MOD', is_mod ? 'true' : 'false')
|
||||
conf_data.set('SNAPSHOT_ID', get_option('snapshot_id'))
|
||||
conf_data.set('SERVER', get_option('server'))
|
||||
conf_data.set('STATICSERVER', get_option('static_server'))
|
||||
|
@ -5,16 +5,16 @@
|
||||
#mesondefine NOHTTP
|
||||
#mesondefine RENDERER
|
||||
#mesondefine FONTEDITOR
|
||||
#mesondefine BETA
|
||||
#mesondefine DEBUG
|
||||
#mesondefine LIN
|
||||
#mesondefine AND
|
||||
#mesondefine SNAPSHOT
|
||||
#mesondefine MOD
|
||||
#mesondefine WIN
|
||||
#mesondefine MACOSX
|
||||
#mesondefine X86
|
||||
|
||||
constexpr bool BETA = @BETA@;
|
||||
constexpr bool SNAPSHOT = @SNAPSHOT@;
|
||||
constexpr bool MOD = @MOD@;
|
||||
constexpr bool GRAVFFT = @GRAVFFT@;
|
||||
constexpr bool LUACONSOLE = @LUACONSOLE@;
|
||||
constexpr bool ALLOW_FAKE_NEWER_VERSION = @ALLOW_FAKE_NEWER_VERSION@;
|
||||
@ -53,13 +53,7 @@ constexpr int FUTURE_SAVE_VERSION = 97;
|
||||
constexpr int FUTURE_MINOR_VERSION = 0;
|
||||
//VersionInfoEnd
|
||||
|
||||
#if defined(SNAPSHOT)
|
||||
constexpr char IDENT_RELTYPE[] = "S";
|
||||
#elif defined(BETA)
|
||||
constexpr char IDENT_RELTYPE[] = "B";
|
||||
#else
|
||||
constexpr char IDENT_RELTYPE[] = "R";
|
||||
#endif
|
||||
constexpr char IDENT_RELTYPE = SNAPSHOT ? 'S' : (BETA ? 'B' : 'R');
|
||||
|
||||
constexpr char SCHEME[] = "https://";
|
||||
constexpr char STATICSCHEME[] = "https://";
|
||||
|
@ -313,53 +313,55 @@ bool Client::CheckUpdate(http::Request *updateRequest, bool checkSession)
|
||||
|
||||
if constexpr (!IGNORE_UPDATES)
|
||||
{
|
||||
//Check for updates
|
||||
Json::Value versions = objDocument["Updates"];
|
||||
#ifndef SNAPSHOT
|
||||
Json::Value stableVersion = versions["Stable"];
|
||||
int stableMajor = stableVersion["Major"].asInt();
|
||||
int stableMinor = stableVersion["Minor"].asInt();
|
||||
int stableBuild = stableVersion["Build"].asInt();
|
||||
ByteString stableFile = stableVersion["File"].asString();
|
||||
String stableChangelog = ByteString(stableVersion["Changelog"].asString()).FromUtf8();
|
||||
if (stableBuild > BUILD_NUM)
|
||||
{
|
||||
updateAvailable = true;
|
||||
updateInfo = UpdateInfo(stableMajor, stableMinor, stableBuild, stableFile, stableChangelog, UpdateInfo::Stable);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!updateAvailable)
|
||||
{
|
||||
Json::Value betaVersion = versions["Beta"];
|
||||
int betaMajor = betaVersion["Major"].asInt();
|
||||
int betaMinor = betaVersion["Minor"].asInt();
|
||||
int betaBuild = betaVersion["Build"].asInt();
|
||||
ByteString betaFile = betaVersion["File"].asString();
|
||||
String betaChangelog = ByteString(betaVersion["Changelog"].asString()).FromUtf8();
|
||||
if (betaBuild > BUILD_NUM)
|
||||
//Check for updates
|
||||
Json::Value versions = objDocument["Updates"];
|
||||
if constexpr (!SNAPSHOT)
|
||||
{
|
||||
updateAvailable = true;
|
||||
updateInfo = UpdateInfo(betaMajor, betaMinor, betaBuild, betaFile, betaChangelog, UpdateInfo::Beta);
|
||||
Json::Value stableVersion = versions["Stable"];
|
||||
int stableMajor = stableVersion["Major"].asInt();
|
||||
int stableMinor = stableVersion["Minor"].asInt();
|
||||
int stableBuild = stableVersion["Build"].asInt();
|
||||
ByteString stableFile = stableVersion["File"].asString();
|
||||
String stableChangelog = ByteString(stableVersion["Changelog"].asString()).FromUtf8();
|
||||
if (stableBuild > BUILD_NUM)
|
||||
{
|
||||
updateAvailable = true;
|
||||
updateInfo = UpdateInfo(stableMajor, stableMinor, stableBuild, stableFile, stableChangelog, UpdateInfo::Stable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(SNAPSHOT) || defined(MOD)
|
||||
Json::Value snapshotVersion = versions["Snapshot"];
|
||||
int snapshotSnapshot = snapshotVersion["Snapshot"].asInt();
|
||||
ByteString snapshotFile = snapshotVersion["File"].asString();
|
||||
String snapshotChangelog = ByteString(snapshotVersion["Changelog"].asString()).FromUtf8();
|
||||
if (snapshotSnapshot > SNAPSHOT_ID)
|
||||
{
|
||||
updateAvailable = true;
|
||||
updateInfo = UpdateInfo(snapshotSnapshot, snapshotFile, snapshotChangelog, UpdateInfo::Snapshot);
|
||||
}
|
||||
#endif
|
||||
if (!updateAvailable)
|
||||
{
|
||||
Json::Value betaVersion = versions["Beta"];
|
||||
int betaMajor = betaVersion["Major"].asInt();
|
||||
int betaMinor = betaVersion["Minor"].asInt();
|
||||
int betaBuild = betaVersion["Build"].asInt();
|
||||
ByteString betaFile = betaVersion["File"].asString();
|
||||
String betaChangelog = ByteString(betaVersion["Changelog"].asString()).FromUtf8();
|
||||
if (betaBuild > BUILD_NUM)
|
||||
{
|
||||
updateAvailable = true;
|
||||
updateInfo = UpdateInfo(betaMajor, betaMinor, betaBuild, betaFile, betaChangelog, UpdateInfo::Beta);
|
||||
}
|
||||
}
|
||||
|
||||
if(updateAvailable)
|
||||
{
|
||||
notifyUpdateAvailable();
|
||||
}
|
||||
if constexpr (SNAPSHOT || MOD)
|
||||
{
|
||||
Json::Value snapshotVersion = versions["Snapshot"];
|
||||
int snapshotSnapshot = snapshotVersion["Snapshot"].asInt();
|
||||
ByteString snapshotFile = snapshotVersion["File"].asString();
|
||||
String snapshotChangelog = ByteString(snapshotVersion["Changelog"].asString()).FromUtf8();
|
||||
if (snapshotSnapshot > SNAPSHOT_ID)
|
||||
{
|
||||
updateAvailable = true;
|
||||
updateInfo = UpdateInfo(snapshotSnapshot, snapshotFile, snapshotChangelog, UpdateInfo::Snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
if(updateAvailable)
|
||||
{
|
||||
notifyUpdateAvailable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2403,7 +2403,7 @@ std::pair<bool, std::vector<char>> GameSave::serialiseOPS() const
|
||||
bson_append_int(&b, "buildNum", BUILD_NUM);
|
||||
bson_append_int(&b, "snapshotId", SNAPSHOT_ID);
|
||||
bson_append_int(&b, "modId", MOD_ID);
|
||||
bson_append_string(&b, "releaseType", IDENT_RELTYPE);
|
||||
bson_append_string(&b, "releaseType", ByteString(1, IDENT_RELTYPE).c_str());
|
||||
bson_append_string(&b, "platform", IDENT_PLATFORM);
|
||||
bson_append_string(&b, "ident", IDENT);
|
||||
bson_append_finish_object(&b);
|
||||
|
@ -58,7 +58,7 @@ namespace http
|
||||
"; NO", // Unused, used to be SSE level.
|
||||
"; M", MOD_ID,
|
||||
"; ", IDENT,
|
||||
") TPTPP/", SAVE_VERSION, ".", MINOR_VERSION, ".", BUILD_NUM, IDENT_RELTYPE, ".", SNAPSHOT_ID
|
||||
") TPTPP/", SAVE_VERSION, ".", MINOR_VERSION, ".", BUILD_NUM, ByteString(1, IDENT_RELTYPE), ".", SNAPSHOT_ID
|
||||
);
|
||||
|
||||
worker_thread = std::thread([this]() { Worker(); });
|
||||
|
@ -1599,27 +1599,43 @@ void GameController::NotifyUpdateAvailable(Client * sender)
|
||||
updateMessage << "Click \"Continue\" to download the latest version from our website.\n\nCurrent version:\n ";
|
||||
#endif
|
||||
|
||||
#ifdef SNAPSHOT
|
||||
updateMessage << "Snapshot " << SNAPSHOT_ID;
|
||||
#elif defined(MOD)
|
||||
updateMessage << "Mod version " << SNAPSHOT_ID;
|
||||
#elif defined(BETA)
|
||||
updateMessage << SAVE_VERSION << "." << MINOR_VERSION << " Beta, Build " << BUILD_NUM;
|
||||
#else
|
||||
updateMessage << SAVE_VERSION << "." << MINOR_VERSION << " Stable, Build " << BUILD_NUM;
|
||||
#endif
|
||||
if constexpr (SNAPSHOT)
|
||||
{
|
||||
updateMessage << "Snapshot " << SNAPSHOT_ID;
|
||||
}
|
||||
else if constexpr (MOD)
|
||||
{
|
||||
updateMessage << "Mod version " << SNAPSHOT_ID;
|
||||
}
|
||||
else if constexpr (BETA)
|
||||
{
|
||||
updateMessage << SAVE_VERSION << "." << MINOR_VERSION << " Beta, Build " << BUILD_NUM;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateMessage << SAVE_VERSION << "." << MINOR_VERSION << " Stable, Build " << BUILD_NUM;
|
||||
}
|
||||
|
||||
updateMessage << "\nNew version:\n ";
|
||||
if (info.Type == UpdateInfo::Beta)
|
||||
{
|
||||
updateMessage << info.Major << "." << info.Minor << " Beta, Build " << info.Build;
|
||||
}
|
||||
else if (info.Type == UpdateInfo::Snapshot)
|
||||
#if defined(MOD)
|
||||
updateMessage << "Mod version " << info.Time;
|
||||
#else
|
||||
updateMessage << "Snapshot " << info.Time;
|
||||
#endif
|
||||
{
|
||||
if constexpr (MOD)
|
||||
{
|
||||
updateMessage << "Mod version " << info.Time;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateMessage << "Snapshot " << info.Time;
|
||||
}
|
||||
}
|
||||
else if(info.Type == UpdateInfo::Stable)
|
||||
{
|
||||
updateMessage << info.Major << "." << info.Minor << " Stable, Build " << info.Build;
|
||||
}
|
||||
|
||||
if (info.Changelog.length())
|
||||
updateMessage << "\n\nChangelog:\n" << info.Changelog;
|
||||
@ -1631,11 +1647,14 @@ void GameController::NotifyUpdateAvailable(Client * sender)
|
||||
switch(sender->GetUpdateInfo().Type)
|
||||
{
|
||||
case UpdateInfo::Snapshot:
|
||||
#if defined(MOD)
|
||||
gameModel->AddNotification(new UpdateNotification(this, "A new mod update is available - click here to update"));
|
||||
#else
|
||||
gameModel->AddNotification(new UpdateNotification(this, "A new snapshot is available - click here to update"));
|
||||
#endif
|
||||
if constexpr (MOD)
|
||||
{
|
||||
gameModel->AddNotification(new UpdateNotification(this, "A new mod update is available - click here to update"));
|
||||
}
|
||||
else
|
||||
{
|
||||
gameModel->AddNotification(new UpdateNotification(this, "A new snapshot is available - click here to update"));
|
||||
}
|
||||
break;
|
||||
case UpdateInfo::Stable:
|
||||
gameModel->AddNotification(new UpdateNotification(this, "A new version is available - click here to update"));
|
||||
|
@ -28,19 +28,25 @@ inline ByteString IntroText()
|
||||
"\bgSimon Robertshaw, Skresanov Savely, cracker64, Catelite, Bryan Hoyle, Nathan Cousins, jacksonmj,\n"
|
||||
"\bgFelix Wallin, Lieuwe Mosch, Anthony Boot, Me4502, MaksProg, jacob1, mniip, LBPHacker\n"
|
||||
"\n";
|
||||
#ifndef BETA
|
||||
sb << "\bgTo use online features such as saving, you need to register at: \brhttps://powdertoy.co.uk/Register.html\n";
|
||||
#else
|
||||
sb << "\brThis is a BETA, you cannot save things publicly, nor open local saves and stamps made with it in older versions.\n"
|
||||
"\brIf you are planning on publishing any saves, use the release version.\n";
|
||||
#endif
|
||||
if constexpr (BETA)
|
||||
{
|
||||
sb << "\brThis is a BETA, you cannot save things publicly, nor open local saves and stamps made with it in older versions.\n"
|
||||
"\brIf you are planning on publishing any saves, use the release version.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
sb << "\bgTo use online features such as saving, you need to register at: \brhttps://powdertoy.co.uk/Register.html\n";
|
||||
}
|
||||
sb << "\n"
|
||||
<< "\bt" << SAVE_VERSION << "." << MINOR_VERSION << "." << BUILD_NUM << " " << IDENT;
|
||||
#ifdef SNAPSHOT
|
||||
sb << " SNAPSHOT " << SNAPSHOT_ID;
|
||||
#elif defined(MOD)
|
||||
sb << " MODVER " << SNAPSHOT_ID;
|
||||
#endif
|
||||
if constexpr (SNAPSHOT)
|
||||
{
|
||||
sb << " SNAPSHOT " << SNAPSHOT_ID;
|
||||
}
|
||||
else if constexpr (MOD)
|
||||
{
|
||||
sb << " MODVER " << SNAPSHOT_ID;
|
||||
}
|
||||
if constexpr (LUACONSOLE)
|
||||
{
|
||||
sb << " LUACONSOLE";
|
||||
|
@ -5,11 +5,7 @@ namespace ui
|
||||
|
||||
struct Border
|
||||
{
|
||||
#if ENABLE_FLOAT_UI
|
||||
# define BORDER_T float
|
||||
#else
|
||||
# define BORDER_T int
|
||||
#endif
|
||||
using BORDER_T = int;
|
||||
|
||||
BORDER_T Top;
|
||||
BORDER_T Right;
|
||||
|
@ -6,11 +6,7 @@ namespace ui
|
||||
//Lightweight 2D Int32/Float32 Point struct for UI
|
||||
struct Point
|
||||
{
|
||||
#if ENABLE_FLOAT_UI
|
||||
# define POINT_T float
|
||||
#else
|
||||
# define POINT_T int
|
||||
#endif
|
||||
using POINT_T = int;
|
||||
|
||||
POINT_T X;
|
||||
POINT_T Y;
|
||||
|
@ -314,11 +314,14 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
|
||||
lua_setfield(l, tptPropertiesVersion, "minor");
|
||||
lua_pushinteger(l, BUILD_NUM);
|
||||
lua_setfield(l, tptPropertiesVersion, "build");
|
||||
#if defined(SNAPSHOT) || defined(MOD)
|
||||
lua_pushinteger(l, SNAPSHOT_ID);
|
||||
#else
|
||||
lua_pushinteger(l, 0);
|
||||
#endif
|
||||
if constexpr (SNAPSHOT || MOD)
|
||||
{
|
||||
lua_pushinteger(l, SNAPSHOT_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushinteger(l, 0);
|
||||
}
|
||||
lua_setfield(l, tptPropertiesVersion, "snapshot");
|
||||
lua_pushinteger(l, MOD_ID);
|
||||
lua_setfield(l, tptPropertiesVersion, "modid");
|
||||
@ -4100,7 +4103,7 @@ int LuaScriptInterface::platform_ident(lua_State * l)
|
||||
|
||||
int LuaScriptInterface::platform_releaseType(lua_State * l)
|
||||
{
|
||||
tpt_lua_pushByteString(l, IDENT_RELTYPE);
|
||||
tpt_lua_pushByteString(l, ByteString(1, IDENT_RELTYPE));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user