Fixed building colors not reverting (#430)

This commit is contained in:
Daniel van Noord
2020-12-19 14:38:14 +01:00
parent 938e850e29
commit 7cfdcc7662
2 changed files with 26 additions and 14 deletions

View File

@@ -1696,7 +1696,8 @@ CM.Disp.UpdateBotTimerBarPosition = function() {
* And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.ConfigData.BulkBuildColor * And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.ConfigData.BulkBuildColor
*/ */
CM.Disp.UpdateBuildings = function() { CM.Disp.UpdateBuildings = function() {
if (CM.Options.BuildColor == 1 && Game.buyMode == 1) { if (Game.buyMode == 1) {
if (CM.Options.BuildColor == 1) {
var target = ''; var target = '';
if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10'; if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10';
else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100'; else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100';
@@ -1704,6 +1705,11 @@ CM.Disp.UpdateBuildings = function() {
for (var i in CM.Cache[target]) { for (var i in CM.Cache[target]) {
l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color]; l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color];
} }
} else {
for (var i in Game.Objects) {
l('productPrice' + Game.Objects[i].id).style.removeProperty("color");
}
}
} }
else if (Game.buyMode == -1) { else if (Game.buyMode == -1) {
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {

View File

@@ -669,7 +669,8 @@ CM.Disp.UpdateBotTimerBarPosition = function() {
* And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.ConfigData.BulkBuildColor * And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.ConfigData.BulkBuildColor
*/ */
CM.Disp.UpdateBuildings = function() { CM.Disp.UpdateBuildings = function() {
if (CM.Options.BuildColor == 1 && Game.buyMode == 1) { if (Game.buyMode == 1) {
if (CM.Options.BuildColor == 1) {
var target = ''; var target = '';
if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10'; if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10';
else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100'; else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100';
@@ -677,6 +678,11 @@ CM.Disp.UpdateBuildings = function() {
for (var i in CM.Cache[target]) { for (var i in CM.Cache[target]) {
l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color]; l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color];
} }
} else {
for (var i in Game.Objects) {
l('productPrice' + Game.Objects[i].id).style.removeProperty("color");
}
}
} }
else if (Game.buyMode == -1) { else if (Game.buyMode == -1) {
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {