Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/Config.h
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/client/Client.cpp
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/client/GameSave.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/client/HTTP.cpp
Expand Up @@ -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];
Expand Down
6 changes: 6 additions & 0 deletions src/gui/game/GameController.cpp
Expand Up @@ -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
Expand All @@ -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;

Expand Down
4 changes: 3 additions & 1 deletion src/lua/LuaScriptInterface.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 16b9308

Please sign in to comment.