# Bug fixes
This was SVN commit r4956.
This commit is contained in:
parent
e0f3507ab1
commit
faf8358b3c
@ -308,7 +308,7 @@ function updateTab (tab, type, cellSheet, attribute, attribute2, arrayCells)
|
|||||||
{ // If it's a list where each element is a value, (entity list)
|
{ // If it's a list where each element is a value, (entity list)
|
||||||
for ( var i in attribute )
|
for ( var i in attribute )
|
||||||
{
|
{
|
||||||
listArray[listArray.length] = i;
|
listArray[listArray.length] = lastPiece(i);
|
||||||
// Store any current quantity in the queue for this object.
|
// Store any current quantity in the queue for this object.
|
||||||
// if (attribute[i].quantity)
|
// if (attribute[i].quantity)
|
||||||
// listArray[listArray.length].quantity = attribute[i].quantity;
|
// listArray[listArray.length].quantity = attribute[i].quantity;
|
||||||
@ -322,9 +322,9 @@ function updateTab (tab, type, cellSheet, attribute, attribute2, arrayCells)
|
|||||||
// If cell sheet for each item is stored in attribute.sheet, transfer that across too.
|
// If cell sheet for each item is stored in attribute.sheet, transfer that across too.
|
||||||
if (arrayCells == true)
|
if (arrayCells == true)
|
||||||
{
|
{
|
||||||
console.write (attribute[i].sheet);
|
//console.write (attribute[i].sheet);
|
||||||
listArray[listArray.length].sheet = new Object(attribute[i].sheet);
|
listArray[listArray.length].sheet = new Object(attribute[i].sheet);
|
||||||
console.write (listArray[listArray.length].sheet);
|
//console.write (listArray[listArray.length].sheet);
|
||||||
}
|
}
|
||||||
// Store any current quantity in the queue for this object.
|
// Store any current quantity in the queue for this object.
|
||||||
// if (attribute[i].quantity)
|
// if (attribute[i].quantity)
|
||||||
@ -418,6 +418,8 @@ function updateTab (tab, type, cellSheet, attribute, attribute2, arrayCells)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
var itemName = "?";
|
||||||
|
//console.write(listArray[createLoop]);
|
||||||
switch (tab)
|
switch (tab)
|
||||||
{
|
{
|
||||||
case "selection":
|
case "selection":
|
||||||
@ -425,11 +427,11 @@ function updateTab (tab, type, cellSheet, attribute, attribute2, arrayCells)
|
|||||||
case "research":
|
case "research":
|
||||||
// Get name of item to display in list.
|
// Get name of item to display in list.
|
||||||
// (These already know the full name of the entity tag, so we don't prefix it.)
|
// (These already know the full name of the entity tag, so we don't prefix it.)
|
||||||
var itemName = listArray[createLoop];
|
itemName = listArray[createLoop];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Get name of item to display in list.
|
// Get name of item to display in list.
|
||||||
var itemName = selection[0].traits.id.civ_code + "_" + listArray[createLoop];
|
itemName = selection[0].traits.id.civ_code + "_" + listArray[createLoop];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,8 +441,13 @@ function updateTab (tab, type, cellSheet, attribute, attribute2, arrayCells)
|
|||||||
{
|
{
|
||||||
case "research":
|
case "research":
|
||||||
// Store name of tech to display in list in this button's coordinate.
|
// Store name of tech to display in list in this button's coordinate.
|
||||||
Crd[getCrd (listObject.name, true)].entity = getTechnology(itemName, selection[0].player);
|
var tech = getTechnology(itemName, selection[0].player);
|
||||||
|
Crd[getCrd (listObject.name, true)].entity = tech;
|
||||||
|
|
||||||
|
if(!tech) {
|
||||||
|
listObject.tooltip = "Bad tech: " + itemName;
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Set tooltip.
|
// Set tooltip.
|
||||||
listObject.tooltip = Crd[getCrd (listObject.name, true)].entity.generic + " (" + Crd[getCrd (listObject.name, true)].entity.specific + ")";
|
listObject.tooltip = Crd[getCrd (listObject.name, true)].entity.generic + " (" + Crd[getCrd (listObject.name, true)].entity.specific + ")";
|
||||||
|
|
||||||
@ -449,6 +456,7 @@ function updateTab (tab, type, cellSheet, attribute, attribute2, arrayCells)
|
|||||||
Crd[getCrd (listObject.name, true)].entity.icon,
|
Crd[getCrd (listObject.name, true)].entity.icon,
|
||||||
"Button",
|
"Button",
|
||||||
Crd[getCrd (listObject.name, true)].entity.icon_cell);
|
Crd[getCrd (listObject.name, true)].entity.icon_cell);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Store name of entity to display in list in this button's coordinate.
|
// Store name of entity to display in list in this button's coordinate.
|
||||||
@ -601,9 +609,12 @@ function refreshCommandButtons()
|
|||||||
// Update production lists (both types of Construction, Train). (Tab button, persistent buttons, click them to do things.)
|
// Update production lists (both types of Construction, Train). (Tab button, persistent buttons, click them to do things.)
|
||||||
if (validProperty ("selection[0].actions.create.list"))
|
if (validProperty ("selection[0].actions.create.list"))
|
||||||
{
|
{
|
||||||
|
console.write("Got actions.create.list");
|
||||||
listRoot = selection[0].actions.create.list;
|
listRoot = selection[0].actions.create.list;
|
||||||
for (listTab in listRoot)
|
for (listTab in listRoot)
|
||||||
{
|
{
|
||||||
|
listTab = lastPiece(listTab);
|
||||||
|
console.write("Updating " + listTab);
|
||||||
if (listTab != "research") // Do research later.
|
if (listTab != "research") // Do research later.
|
||||||
updateTab (listTab, "production", "Tab", "listRoot[listTab]", "");
|
updateTab (listTab, "production", "Tab", "listRoot[listTab]", "");
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ function refreshResources ()
|
|||||||
var shouldRefresh = false;
|
var shouldRefresh = false;
|
||||||
for (var currResource in resourcePool)
|
for (var currResource in resourcePool)
|
||||||
{
|
{
|
||||||
|
currResource = lastPiece(currResource);
|
||||||
if( oldResources[currResource] != localPlayer.resources[currResource] )
|
if( oldResources[currResource] != localPlayer.resources[currResource] )
|
||||||
{
|
{
|
||||||
oldResources[currResource] = localPlayer.resources[currResource].valueOf();
|
oldResources[currResource] = localPlayer.resources[currResource].valueOf();
|
||||||
@ -76,6 +77,7 @@ function refreshResources ()
|
|||||||
var resourceCount = 0;
|
var resourceCount = 0;
|
||||||
for (var currResource in resourcePool)
|
for (var currResource in resourcePool)
|
||||||
{
|
{
|
||||||
|
currResource = lastPiece(currResource);
|
||||||
if(currResource != "housing")
|
if(currResource != "housing")
|
||||||
{
|
{
|
||||||
// Pass the array index of the resource as the second parameter (as we'll need that to determine the centered screen position of each counter).
|
// Pass the array index of the resource as the second parameter (as we'll need that to determine the centered screen position of each counter).
|
||||||
@ -94,7 +96,7 @@ function refreshResource (resourceName, resourceIndex)
|
|||||||
// Refresh the onscreen counter for a given resource (called to recalculate the size of the coordinates, as these dynamically adjust depending on character length).
|
// Refresh the onscreen counter for a given resource (called to recalculate the size of the coordinates, as these dynamically adjust depending on character length).
|
||||||
|
|
||||||
// Ensure resource name is title-case.
|
// Ensure resource name is title-case.
|
||||||
resourceName = toTitleCase (resourceName);
|
resourceName = toTitleCase (lastPiece(resourceName));
|
||||||
|
|
||||||
// Ignore the "Housing" resource ... It doesn't work like normal resources and doesn't have a counter to resize.
|
// Ignore the "Housing" resource ... It doesn't work like normal resources and doesn't have a counter to resize.
|
||||||
if (resourceName == "Housing")
|
if (resourceName == "Housing")
|
||||||
|
@ -79,3 +79,13 @@ function toTitleCase (string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
|
|
||||||
|
// Get last piece of a dot-separated string
|
||||||
|
function lastPiece(x) {
|
||||||
|
var str = ""+x;
|
||||||
|
var idx = str.lastIndexOf('.');
|
||||||
|
if(idx >= 0) {
|
||||||
|
str = str.substring(idx+1, str.length);
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user