Changes to support starcatcher build server with updates

Cherry-picked from 3ddaec7b2a
3ddaec7b2a
3ddaec7b2a
3ddaec7b2a
3ddaec7b2a
3ddaec7b2a
This commit is contained in:
jacob1 2016-07-09 19:00:54 -04:00
parent b75c8318e4
commit 16b93083d4
6 changed files with 21 additions and 5 deletions

View File

@ -26,6 +26,13 @@
#ifndef SNAPSHOT_ID #ifndef SNAPSHOT_ID
#define SNAPSHOT_ID 0 #define SNAPSHOT_ID 0
#endif #endif
// Mod ID, used on the http://starcatcher.us/TPT build server
// The build server will compile for all platforms for you, and send updates in game
// See jacob1 to get a mod ID
#ifndef MOD_ID
#define MOD_ID 0
#endif
//VersionInfoEnd //VersionInfoEnd
//#define IGNORE_UPDATES //uncomment this for mods, to not get any update notifications //#define IGNORE_UPDATES //uncomment this for mods, to not get any update notifications

View File

@ -824,15 +824,15 @@ bool Client::CheckUpdate(void *updateRequest, bool checkSession)
} }
} }
#ifdef SNAPSHOT #if defined(SNAPSHOT) || MOD_ID > 0
Json::Value snapshotVersion = versions["Snapshot"]; Json::Value snapshotVersion = versions["Snapshot"];
int snapshotSnapshot = snapshotVersion["Snapshot"].asInt(); int snapshotSnapshot = snapshotVersion["Snapshot"].asInt();
std::string snapshotFile = snapshotVersion["File"].asString(); std::string snapshotFile = snapshotVersion["File"].asString();
std::string snapshotChangelog = snapshotVersion["Changelog"].asString(); std::string snapshotChangelog = snapshotVersion["Changelog"].asString();
if (snapshotSnapshot > SNAPSHOT_ID) //if (snapshotSnapshot > SNAPSHOT_ID)
{ {
updateAvailable = true; updateAvailable = true;
updateInfo = UpdateInfo(snapshotSnapshot, snapshotFile, snapshotChangelog, UpdateInfo::Snapshot); updateInfo = UpdateInfo(2, snapshotFile, snapshotChangelog, UpdateInfo::Snapshot);
} }
#endif #endif

View File

@ -2174,6 +2174,7 @@ char * GameSave::serialiseOPS(unsigned int & dataLength)
bson_append_int(&b, "minorVersion", MINOR_VERSION); bson_append_int(&b, "minorVersion", MINOR_VERSION);
bson_append_int(&b, "buildNum", BUILD_NUM); bson_append_int(&b, "buildNum", BUILD_NUM);
bson_append_int(&b, "snapshotId", SNAPSHOT_ID); 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", IDENT_RELTYPE);
bson_append_string(&b, "platform", IDENT_PLATFORM); bson_append_string(&b, "platform", IDENT_PLATFORM);
bson_append_string(&b, "builtType", IDENT_BUILD); bson_append_string(&b, "builtType", IDENT_BUILD);

View File

@ -194,7 +194,7 @@ void http_init(char *proxy)
} }
std::stringstream userAgentBuilder; std::stringstream userAgentBuilder;
userAgentBuilder << "PowderToy/" << SAVE_VERSION << "." << MINOR_VERSION << " "; userAgentBuilder << "PowderToy/" << SAVE_VERSION << "." << MINOR_VERSION << " ";
userAgentBuilder << "(" << IDENT_PLATFORM << "; " << IDENT_BUILD << "; M0) "; userAgentBuilder << "(" << IDENT_PLATFORM << "; " << IDENT_BUILD << "; M" << MOD_ID << ") ";
userAgentBuilder << "TPTPP/" << SAVE_VERSION << "." << MINOR_VERSION << "." << BUILD_NUM << IDENT_RELTYPE << "." << SNAPSHOT_ID; userAgentBuilder << "TPTPP/" << SAVE_VERSION << "." << MINOR_VERSION << "." << BUILD_NUM << IDENT_RELTYPE << "." << SNAPSHOT_ID;
std::string newUserAgent = userAgentBuilder.str(); std::string newUserAgent = userAgentBuilder.str();
userAgent = new char[newUserAgent.length()+1]; userAgent = new char[newUserAgent.length()+1];

View File

@ -1537,6 +1537,8 @@ void GameController::NotifyUpdateAvailable(Client * sender)
#ifdef SNAPSHOT #ifdef SNAPSHOT
updateMessage << "Snapshot " << SNAPSHOT_ID; updateMessage << "Snapshot " << SNAPSHOT_ID;
#elif MOD_ID > 0
updateMessage << "Mod version " << SNAPSHOT_ID;
#elif defined(BETA) #elif defined(BETA)
updateMessage << SAVE_VERSION << "." << MINOR_VERSION << " Beta, Build " << BUILD_NUM; updateMessage << SAVE_VERSION << "." << MINOR_VERSION << " Beta, Build " << BUILD_NUM;
#else #else
@ -1547,7 +1549,11 @@ void GameController::NotifyUpdateAvailable(Client * sender)
if (info.Type == UpdateInfo::Beta) if (info.Type == UpdateInfo::Beta)
updateMessage << info.Major << " " << info.Minor << " Beta, Build " << info.Build; updateMessage << info.Major << " " << info.Minor << " Beta, Build " << info.Build;
else if (info.Type == UpdateInfo::Snapshot) else if (info.Type == UpdateInfo::Snapshot)
#if MOD_ID > 0
updateMessage << "Mod version " << info.Time;
#else
updateMessage << "Snapshot " << info.Time; updateMessage << "Snapshot " << info.Time;
#endif
else if(info.Type == UpdateInfo::Stable) else if(info.Type == UpdateInfo::Stable)
updateMessage << info.Major << " " << info.Minor << " Stable, Build " << info.Build; updateMessage << info.Major << " " << info.Minor << " Stable, Build " << info.Build;

View File

@ -239,12 +239,14 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
lua_setfield(l, tptPropertiesVersion, "minor"); lua_setfield(l, tptPropertiesVersion, "minor");
lua_pushinteger(l, BUILD_NUM); lua_pushinteger(l, BUILD_NUM);
lua_setfield(l, tptPropertiesVersion, "build"); lua_setfield(l, tptPropertiesVersion, "build");
#ifdef SNAPSHOT #if defined(SNAPSHOT) || MOD_ID > 0
lua_pushinteger(l, SNAPSHOT_ID); lua_pushinteger(l, SNAPSHOT_ID);
#else #else
lua_pushinteger(l, 0); lua_pushinteger(l, 0);
#endif #endif
lua_setfield(l, tptPropertiesVersion, "snapshot"); lua_setfield(l, tptPropertiesVersion, "snapshot");
lua_pushinteger(l, MOD_ID);
lua_setfield(l, tptPropertiesVersion, "modid");
lua_setfield(l, tptProperties, "version"); lua_setfield(l, tptProperties, "version");
lua_sethook(l, &luacon_hook, LUA_MASKCOUNT, 200); lua_sethook(l, &luacon_hook, LUA_MASKCOUNT, 200);