Ticket #3222: t3222_handle_notifications.patch
File t3222_handle_notifications.patch, 1.7 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"); 142 143 if (!notification) 144 return; 145 if (!notification.type) 146 { 147 error("notification without type found.\n"+uneval(notification)) 148 return; 149 } 150 if (!notification.players) 141 var maxNotifications = 20; 142 for(var i = 0; i < maxNotifications; i++) 151 143 { 152 error("notification without players found.\n"+uneval(notification)) 153 return; 144 var notification = Engine.GuiInterfaceCall("GetNextNotification"); 145 146 if (!notification) 147 return; 148 149 if (!notification.type) 150 { 151 error("notification without type found.\n"+uneval(notification)) 152 continue; 153 } 154 155 if (!notification.players) 156 { 157 error("notification without players found.\n"+uneval(notification)) 158 continue; 159 } 160 161 var action = g_NotificationsTypes[notification.type]; 162 if (!action) 163 { 164 error("unknown notification type '" + notification.type + "' found."); 165 continue; 166 } 167 168 for (var player of notification.players) 169 action(notification, player); 154 170 } 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 171 } 165 172 166 173 function updateDiplomacy() 167 174 { 168 175 g_Players = getPlayerData(g_PlayerAssignments);