Ticket #3222: t3222_handle_notifications_v3.patch
File t3222_handle_notifications_v3.patch, 2.9 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/gui/session/messages.js
136 136 }; 137 137 138 138 // Notifications 139 139 function handleNotifications() 140 140 { 141 var notification = Engine.GuiInterfaceCall("GetNextNotification");141 var notifications = Engine.GuiInterfaceCall("GetNotifications"); 142 142 143 if (!notification) 144 return; 145 if (!notification.type) 143 for(var i = 0; i < notifications.length; ++i) 146 144 { 147 error("notification without type found.\n"+uneval(notification)) 148 return; 145 let notification = notifications[i]; 146 147 if (!notification.type) 148 { 149 error("Notification without type found.\n"+uneval(notification)) 150 continue; 151 } 152 153 if (!notification.players) 154 { 155 error("Notification without players found.\n"+uneval(notification)) 156 continue; 157 } 158 159 var action = g_NotificationsTypes[notification.type]; 160 if (!action) 161 { 162 error("Unknown notification type '" + notification.type + "' found."); 163 continue; 164 } 165 166 for (var player of notification.players) 167 action(notification, player); 149 168 } 150 if (!notification.players)151 {152 error("notification without players found.\n"+uneval(notification))153 return;154 }155 var action = g_NotificationsTypes[notification.type];156 if (!action)157 {158 error("unknown notification type '" + notification.type + "' found.");159 return;160 }161 162 for (var player of notification.players)163 action(notification, player);164 169 } 165 170 166 171 function updateDiplomacy() 167 172 { 168 173 g_Players = getPlayerData(g_PlayerAssignments); -
binaries/data/mods/public/simulation/components/GuiInterface.js
732 732 this.AddTimeNotification(notification); 733 733 else 734 734 this.notifications.push(notification); 735 735 }; 736 736 737 GuiInterface.prototype.GetN extNotification= function()737 GuiInterface.prototype.GetNotifications = function() 738 738 { 739 if (this.notifications.length) 740 return this.notifications.pop(); 741 else 742 return false; 739 var n = this.notifications; 740 this.notifications = []; 741 return n; 743 742 }; 744 743 745 744 GuiInterface.prototype.GetAvailableFormations = function(player, wantedPlayer) 746 745 { 747 746 var cmpPlayerMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager); … … 1875 1874 "CheckTechnologyRequirements": 1, 1876 1875 "GetStartedResearch": 1, 1877 1876 "GetBattleState": 1, 1878 1877 "GetIncomingAttacks": 1, 1879 1878 "GetNeededResources": 1, 1880 "GetN extNotification": 1,1879 "GetNotifications": 1, 1881 1880 "GetTimeNotifications": 1, 1882 1881 1883 1882 "GetAvailableFormations": 1, 1884 1883 "GetFormationRequirements": 1, 1885 1884 "CanMoveEntsIntoFormation": 1,