Ticket #3143: 3143_lobby_data_gameattribs.patch
File 3143_lobby_data_gameattribs.patch, 3.9 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/session/menu.js
622 622 "timeElapsed" : extendedSimState.timeElapsed, 623 623 "playerStates": extendedSimState.players, 624 624 "players": g_Players, 625 "mapSettings": Engine.GetMapSettings(),625 "mapSettings": g_GameAttributes.settings, 626 626 "isInGame": true, 627 627 "gameResult": translate("Current Scores"), 628 628 "callback": "resumeGame" -
binaries/data/mods/public/gui/session/session.js
64 64 var g_FollowPlayer = false; 65 65 66 66 /** 67 * Unique ID for lobby reports.68 */69 var g_MatchID;70 71 /**72 67 * Cache the basic player data (name, civ, color). 73 68 */ 74 69 var g_Players = []; … … 96 91 } 97 92 }; 98 93 94 var g_GameAttributes; 95 99 96 /** 100 97 * Cache dev-mode settings that are frequently or widely used. 101 98 */ … … 230 227 g_IsNetworked = initData.isNetworked; 231 228 g_IsController = initData.isController; 232 229 g_PlayerAssignments = initData.playerAssignments; 233 g_ MatchID = initData.attribs.matchID;230 g_GameAttributes = initData.attribs; 234 231 g_ReplaySelectionData = initData.replaySelectionData; 235 232 g_HasRejoined = initData.isRejoining; 236 233 … … 485 482 486 483 function reportPerformance(time) 487 484 { 488 let settings = Engine.GetMapSettings();485 let settings = g_GameAttributes.settings; 489 486 Engine.SubmitUserReport("profile", 3, JSON.stringify({ 490 487 "time": time, 491 488 "map": settings.Name, … … 526 523 let simData = { 527 524 "timeElapsed" : extendedSimState.timeElapsed, 528 525 "playerStates": extendedSimState.players, 529 "mapSettings": Engine.GetMapSettings()526 "mapSettings": g_GameAttributes.settings 530 527 }; 531 528 532 529 if (!g_IsReplay) … … 1222 1219 playerStatistics.feminisation = ""; 1223 1220 playerStatistics.percentMapExplored = ""; 1224 1221 1225 let mapName = Engine.GetMapSettings().Name;1222 let mapName = g_GameAttributes.settings.Name; 1226 1223 let playerStates = ""; 1227 1224 let playerCivs = ""; 1228 1225 let teams = ""; … … 1272 1269 reportObject.timeElapsed = extendedSimState.timeElapsed; 1273 1270 reportObject.playerStates = playerStates; 1274 1271 reportObject.playerID = Engine.GetPlayerID(); 1275 reportObject.matchID = g_ MatchID;1272 reportObject.matchID = g_GameAttributes.matchID; 1276 1273 reportObject.civs = playerCivs; 1277 1274 reportObject.teams = teams; 1278 1275 reportObject.teamsLocked = String(teamsLocked); -
source/gui/scripting/ScriptFunctions.cpp
510 510 return settings; 511 511 } 512 512 513 JS::Value GetMapSettings(ScriptInterface::CxPrivate* pCxPrivate)514 {515 if (!g_Game)516 return JS::UndefinedValue();517 518 JSContext* cx = g_Game->GetSimulation2()->GetScriptInterface().GetContext();519 JSAutoRequest rq(cx);520 521 JS::RootedValue mapSettings(cx);522 g_Game->GetSimulation2()->GetMapSettings(&mapSettings);523 return pCxPrivate->pScriptInterface->CloneValueFromOtherContext(524 g_Game->GetSimulation2()->GetScriptInterface(),525 mapSettings);526 }527 528 513 /** 529 514 * Get the current X coordinate of the camera. 530 515 */ … … 1070 1055 scriptInterface.RegisterFunction<bool, &AtlasIsAvailable>("AtlasIsAvailable"); 1071 1056 scriptInterface.RegisterFunction<bool, &IsAtlasRunning>("IsAtlasRunning"); 1072 1057 scriptInterface.RegisterFunction<JS::Value, VfsPath, &LoadMapSettings>("LoadMapSettings"); 1073 scriptInterface.RegisterFunction<JS::Value, &GetMapSettings>("GetMapSettings");1074 1058 scriptInterface.RegisterFunction<float, &CameraGetX>("CameraGetX"); 1075 1059 scriptInterface.RegisterFunction<float, &CameraGetZ>("CameraGetZ"); 1076 1060 scriptInterface.RegisterFunction<void, entity_id_t, &CameraFollow>("CameraFollow");