diff --git a/script/room.js b/script/room.js index a7b3f90..d569154 100644 --- a/script/room.js +++ b/script/room.js @@ -901,19 +901,18 @@ var Room = { .addClass('row_val') .text(Engine.getIncomeMsg(income.stores[store], income.delay)) .appendTo(tt); - if (totalIncome[store] === undefined || totalIncome[store]['income'] === undefined) { - totalIncome[store] = {}; - totalIncome[store]['income'] = 0; + if (!totalIncome[store] || totalIncome[store].income === undefined) { + totalIncome[store] = { income: 0 }; } - totalIncome[store]['income'] += Number(income.stores[store]); - totalIncome[store]['delay'] = income.delay; + totalIncome[store].income += Number(income.stores[store]); + totalIncome[store].delay = income.delay; } } } if(tt.children().length > 0) { - var total = totalIncome[storeName]['income']; + var total = totalIncome[storeName].income; $('
').addClass('total row_key').text(_('total')).appendTo(tt); - $('
').addClass('total row_val').text(Engine.getIncomeMsg(total, totalIncome[storeName]['delay'])).appendTo(tt); + $('
').addClass('total row_val').text(Engine.getIncomeMsg(total, totalIncome[storeName].delay)).appendTo(tt); tt.appendTo(el); } });