Session cleanup.

Use colorizePlayernameByID instead of replica.

This was SVN commit r18152.
This commit is contained in:
elexis 2016-05-10 03:14:51 +00:00
parent 71c441b092
commit 2b0fa71d23

View File

@ -341,7 +341,7 @@ function diplomacyFormatTributeButtons(i, hidden)
continue; continue;
button.enabled = controlsPlayer(g_ViewedPlayer); button.enabled = controlsPlayer(g_ViewedPlayer);
button.tooltip = formatTributeTooltip(g_Players[i], resource, 100); button.tooltip = formatTributeTooltip(i, resource, 100);
button.onpress = (function(i, resource, button) { button.onpress = (function(i, resource, button) {
// Shift+click to send 500, shift+click+click to send 1000, etc. // Shift+click to send 500, shift+click+click to send 1000, etc.
// See INPUT_MASSTRIBUTING in input.js // See INPUT_MASSTRIBUTING in input.js
@ -359,14 +359,14 @@ function diplomacyFormatTributeButtons(i, hidden)
amounts[type] = 0; amounts[type] = 0;
amounts[resource] = 100 * multiplier; amounts[resource] = 100 * multiplier;
button.tooltip = formatTributeTooltip(g_Players[i], resource, amounts[resource]); button.tooltip = formatTributeTooltip(i, resource, amounts[resource]);
// This is in a closure so that we have access to `player`, `amounts`, and `multiplier` without some // This is in a closure so that we have access to `player`, `amounts`, and `multiplier` without some
// evil global variable hackery. // evil global variable hackery.
g_FlushTributing = function() { g_FlushTributing = function() {
Engine.PostNetworkCommand({ "type": "tribute", "player": i, "amounts": amounts }); Engine.PostNetworkCommand({ "type": "tribute", "player": i, "amounts": amounts });
multiplier = 1; multiplier = 1;
button.tooltip = formatTributeTooltip(g_Players[i], resource, 100); button.tooltip = formatTributeTooltip(i, resource, 100);
}; };
if (!isBatchTrainPressed) if (!isBatchTrainPressed)
@ -747,12 +747,12 @@ function closeOpenDialogs()
closeTrade(); closeTrade();
} }
function formatTributeTooltip(player, resource, amount) function formatTributeTooltip(playerID, resource, amount)
{ {
return sprintf(translate("Tribute %(resourceAmount)s %(resourceType)s to %(playerName)s. Shift-click to tribute %(greaterAmount)s."), { return sprintf(translate("Tribute %(resourceAmount)s %(resourceType)s to %(playerName)s. Shift-click to tribute %(greaterAmount)s."), {
"resourceAmount": amount, "resourceAmount": amount,
"resourceType": getLocalizedResourceName(resource, "withinSentence"), "resourceType": getLocalizedResourceName(resource, "withinSentence"),
"playerName": "[color=\"" + rgbToGuiColor(player.color) + "\"]" + player.name + "[/color]", "playerName": colorizePlayernameByID(playerID),
"greaterAmount": (amount < 500 ? 500 : amount + 500) "greaterAmount": amount < 500 ? 500 : amount + 500
}); });
} }