CORPORATION: Fix wrong product price calculation (#1451)

This commit is contained in:
catloversg 2024-07-03 05:11:32 +07:00 committed by GitHub
parent 960fe5aa8b
commit 3c29757827
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -574,8 +574,7 @@ export class Division {
sCost = optimalPrice;
} else if (mat.marketTa1) {
sCost = mat.marketPrice + markupLimit;
// check truthyness to avoid unnecessary eval
} else if (typeof mat.desiredSellPrice === "string" && mat.desiredSellPrice) {
} else if (typeof mat.desiredSellPrice === "string") {
sCost = mat.desiredSellPrice.replace(/MP/g, mat.marketPrice.toString());
sCost = eval(sCost);
} else {
@ -903,7 +902,7 @@ export class Division {
product.markup = 1;
}
sCostString = sCostString.replace(/MP/g, product.cityData[city].productionCost.toString());
sCost = Math.max(product.cityData[city].productionCost, eval(sCostString));
sCost = eval(sCostString);
} else {
sCost = sellPrice;
}