fixed temp evaluation of MAX and PROD for products

This commit is contained in:
Luca Montagna
2022-01-22 13:58:51 +01:00
parent bfa271881b
commit bd775f167e
3 changed files with 10 additions and 9 deletions
+2 -2
View File
@@ -174,8 +174,8 @@ export function SellProduct(product: Product, city: string, amt: string, price:
//Dynamically evaluated quantity. First test to make sure its valid
let qty = amt.replace(/\s+/g, "");
qty = qty.replace(/[^-()\d/*+.MAXPROD]/g, "");
let temp = qty.replace(/MAX/g, "1");
temp = temp.replace(/PROD/g, "1");
let temp = qty.replace(/MAX/g, product.maxsll.toString());
temp = temp.replace(/PROD/g, product.data[city][1].toString());
try {
temp = eval(temp);
} catch (e) {