Merge pull request #458 from DanielNoord/fix/buildingcolors (#430)

Fixed building colors not reverting (#430)
This commit is contained in:
DanielNoord
2020-12-19 14:38:59 +01:00
committed by GitHub
2 changed files with 26 additions and 14 deletions

View File

@@ -1696,13 +1696,19 @@ 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) {
var target = ''; if (CM.Options.BuildColor == 1) {
if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10'; var target = '';
else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100'; if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10';
else target = 'Objects'; else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100';
for (var i in CM.Cache[target]) { else target = 'Objects';
l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color]; for (var i in CM.Cache[target]) {
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) {

View File

@@ -669,13 +669,19 @@ 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) {
var target = ''; if (CM.Options.BuildColor == 1) {
if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10'; var target = '';
else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100'; if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10';
else target = 'Objects'; else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100';
for (var i in CM.Cache[target]) { else target = 'Objects';
l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color]; for (var i in CM.Cache[target]) {
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) {