Permalink
Browse files

Changes to support starcatcher build server with updates

  • Loading branch information...
jacob1 committed Jul 9, 2016
1 parent b75c831 commit 16b93083d4f5de2af50457141346aed1bb4616e1
Showing with 21 additions and 5 deletions.
  1. +7 −0 src/Config.h
  2. +3 −3 src/client/Client.cpp
  3. +1 −0 src/client/GameSave.cpp
  4. +1 −1 src/client/HTTP.cpp
  5. +6 −0 src/gui/game/GameController.cpp
  6. +3 −1 src/lua/LuaScriptInterface.cpp
@@ -26,6 +26,13 @@
#ifndef SNAPSHOT_ID
#define SNAPSHOT_ID 0
#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
//#define IGNORE_UPDATES //uncomment this for mods, to not get any update notifications
@@ -824,15 +824,15 @@ bool Client::CheckUpdate(void *updateRequest, bool checkSession)
}
}
#ifdef SNAPSHOT
#if defined(SNAPSHOT) || MOD_ID > 0
Json::Value snapshotVersion = versions["Snapshot"];
int snapshotSnapshot = snapshotVersion["Snapshot"].asInt();
std::string snapshotFile = snapshotVersion["File"].asString();
std::string snapshotChangelog = snapshotVersion["Changelog"].asString();
if (snapshotSnapshot > SNAPSHOT_ID)
//if (snapshotSnapshot > SNAPSHOT_ID)
{
updateAvailable = true;
updateInfo = UpdateInfo(snapshotSnapshot, snapshotFile, snapshotChangelog, UpdateInfo::Snapshot);
updateInfo = UpdateInfo(2, snapshotFile, snapshotChangelog, UpdateInfo::Snapshot);
}
#endif
@@ -2174,6 +2174,7 @@ char * GameSave::serialiseOPS(unsigned int & dataLength)
bson_append_int(&b, "minorVersion", MINOR_VERSION);
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, "platform", IDENT_PLATFORM);
bson_append_string(&b, "builtType", IDENT_BUILD);
@@ -194,7 +194,7 @@ void http_init(char *proxy)
}
std::stringstream userAgentBuilder;
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;
std::string newUserAgent = userAgentBuilder.str();
userAgent = new char[newUserAgent.length()+1];
@@ -1537,6 +1537,8 @@ void GameController::NotifyUpdateAvailable(Client * sender)
#ifdef SNAPSHOT
updateMessage << "Snapshot " << SNAPSHOT_ID;
#elif MOD_ID > 0
updateMessage << "Mod version " << SNAPSHOT_ID;
#elif defined(BETA)
updateMessage << SAVE_VERSION << "." << MINOR_VERSION << " Beta, Build " << BUILD_NUM;
#else
@@ -1547,7 +1549,11 @@ void GameController::NotifyUpdateAvailable(Client * sender)
if (info.Type == UpdateInfo::Beta)
updateMessage << info.Major << " " << info.Minor << " Beta, Build " << info.Build;
else if (info.Type == UpdateInfo::Snapshot)
#if MOD_ID > 0
updateMessage << "Mod version " << info.Time;
#else
updateMessage << "Snapshot " << info.Time;
#endif
else if(info.Type == UpdateInfo::Stable)
updateMessage << info.Major << " " << info.Minor << " Stable, Build " << info.Build;
@@ -239,12 +239,14 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
lua_setfield(l, tptPropertiesVersion, "minor");
lua_pushinteger(l, BUILD_NUM);
lua_setfield(l, tptPropertiesVersion, "build");
#ifdef SNAPSHOT
#if defined(SNAPSHOT) || MOD_ID > 0
lua_pushinteger(l, SNAPSHOT_ID);
#else
lua_pushinteger(l, 0);
#endif
lua_setfield(l, tptPropertiesVersion, "snapshot");
lua_pushinteger(l, MOD_ID);
lua_setfield(l, tptPropertiesVersion, "modid");
lua_setfield(l, tptProperties, "version");
lua_sethook(l, &luacon_hook, LUA_MASKCOUNT, 200);

0 comments on commit 16b9308

Please sign in to comment.