diff --git a/src/Config.h b/src/Config.h index 42f0c94ee..9c2b42a72 100644 --- a/src/Config.h +++ b/src/Config.h @@ -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 diff --git a/src/client/Client.cpp b/src/client/Client.cpp index 67ccaf712..f1202ecad 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -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 diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index eb81aaad2..2a09399fd 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -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); diff --git a/src/client/HTTP.cpp b/src/client/HTTP.cpp index 16a268a91..e9158f27a 100644 --- a/src/client/HTTP.cpp +++ b/src/client/HTTP.cpp @@ -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]; diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index e87bf2a4a..d017bf70c 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -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; diff --git a/src/lua/LuaScriptInterface.cpp b/src/lua/LuaScriptInterface.cpp index 105774aa5..4e7758ca4 100644 --- a/src/lua/LuaScriptInterface.cpp +++ b/src/lua/LuaScriptInterface.cpp @@ -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);