Ticket #4369: 4369_stay_ready.patch
File 4369_stay_ready.patch, 3.8 KB (added by , 7 years ago) |
---|
-
binaries/data/mods/public/gui/gamesetup/gamesetup.js
137 137 * Highlight ready players. 138 138 */ 139 139 const g_ReadyColor = "green"; 140 const g_StayReadyColor = "blue"; 140 141 141 142 /** 142 143 * Placeholder item for the map-dropdownlist. … … 172 173 173 174 /** 174 175 * Whether the current player is ready to start the game. 176 * 0 - not ready 177 * 1 - ready 178 * 2 - stay ready 175 179 */ 176 180 var g_IsReady; 177 181 … … 687 691 { 688 692 --g_ReadyChanged; 689 693 690 if (g_ReadyChanged < 1 && g_PlayerAssignments[message.guid].player != -1 )694 if (g_ReadyChanged < 1 && g_PlayerAssignments[message.guid].player != -1 && message.status < 2) 691 695 addChatMessage({ 692 696 "type": message.status == 1 ? "ready" : "not-ready", 693 697 "guid": message.guid … … 1838 1842 1839 1843 function toggleReady() 1840 1844 { 1841 setReady( !g_IsReady);1845 setReady((g_IsReady + 1) % 3); 1842 1846 } 1843 1847 1844 1848 function setReady(ready, sendMessage = true) … … 1853 1857 1854 1858 let button = Engine.GetGUIObjectByName("startGame"); 1855 1859 1856 button.caption = g_IsReady ? 1857 translate("I'm not ready!") : 1860 button.caption = g_IsReady ? ( 1861 g_IsReady == 2 ? 1862 translate("I'm not ready!") : 1863 translate("Stay ready")) : 1858 1864 translate("I'm ready"); 1859 1865 1860 button.tooltip = g_IsReady ? 1861 translate("State that you are not ready to play.") : 1866 button.tooltip = g_IsReady ? ( 1867 g_IsReady == 2 ? 1868 translate("State that you are not ready to play.") : 1869 translate("Stay ready even when the game settings change.")) : 1862 1870 translate("State that you are ready to play!"); 1863 1871 } 1864 1872 … … 1878 1886 let pDefs = g_DefaultPlayerData ? g_DefaultPlayerData[g_PlayerAssignments[guid].player - 1] : {}; 1879 1887 isAI[g_PlayerAssignments[guid].player] = false; 1880 1888 if (g_PlayerAssignments[guid].status || !g_IsNetworked) 1881 Engine.GetGUIObjectByName("playerName[" + (g_PlayerAssignments[guid].player - 1) + "]").caption = '[color="' + g_ReadyColor + '"]' + translate(getSetting(pData, pDefs, "Name")) + '[/color]'; 1889 Engine.GetGUIObjectByName("playerName[" + (g_PlayerAssignments[guid].player - 1) + "]").caption = 1890 '[color="' + (g_PlayerAssignments[guid].status == 1 ? g_ReadyColor : g_StayReadyColor) + '"]' + 1891 translate(getSetting(pData, pDefs, "Name")) + '[/color]'; 1882 1892 else 1883 1893 { 1884 1894 Engine.GetGUIObjectByName("playerName[" + (g_PlayerAssignments[guid].player - 1) + "]").caption = translate(getSetting(pData, pDefs, "Name")); … … 1894 1904 let pData = g_GameAttributes.settings.PlayerData ? g_GameAttributes.settings.PlayerData[playerid] : {}; 1895 1905 let pDefs = g_DefaultPlayerData ? g_DefaultPlayerData[playerid] : {}; 1896 1906 if (isAI[playerid + 1]) 1897 Engine.GetGUIObjectByName("playerName[" + playerid + "]").caption = '[color="' + g_ReadyColor + '"]' + translate(getSetting(pData, pDefs, "Name")) + '[/color]'; 1907 Engine.GetGUIObjectByName("playerName[" + playerid + "]").caption = 1908 '[color="' + g_StayReadyColor + '"]' + translate(getSetting(pData, pDefs, "Name")) + '[/color]'; 1898 1909 } 1899 1910 1900 1911 // The host is not allowed to start until everyone is ready. … … 1931 1942 Engine.ClearAllPlayerReady(); 1932 1943 setReady(true); 1933 1944 } 1934 else 1945 else if (g_IsReady != 2) 1935 1946 setReady(false, false); 1936 1947 } 1937 1948 -
source/network/NetServer.cpp
774 774 void CNetServerWorker::ClearAllPlayerReady() 775 775 { 776 776 for (PlayerAssignmentMap::iterator it = m_PlayerAssignments.begin(); it != m_PlayerAssignments.end(); ++it) 777 it->second.m_Status = 0; 777 if (it->second.m_Status != 2) 778 it->second.m_Status = 0; 778 779 779 780 SendPlayerAssignments(); 780 781 }