mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-04 11:37:12 +08:00
Renamed total to currentBagCapacity in the updateOutfitting method and extracted some functionality into a method called updateBagSpace.
This commit is contained in:
+9
-4
@@ -157,9 +157,8 @@ var Path = {
|
|||||||
$('.row_val', wRow).text(World.getMaxWater());
|
$('.row_val', wRow).text(World.getMaxWater());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var space = Path.getFreeSpace();
|
var space = Path.getFreeSpace();
|
||||||
var total = 0;
|
var currentBagCapacity = 0;
|
||||||
// Add the non-craftables to the craftables
|
// Add the non-craftables to the craftables
|
||||||
var carryable = $.extend({
|
var carryable = $.extend({
|
||||||
'cured meat': { type: 'tool' },
|
'cured meat': { type: 'tool' },
|
||||||
@@ -183,7 +182,7 @@ var Path = {
|
|||||||
var numAvailable = $SM.get('stores["'+k+'"]', true);
|
var numAvailable = $SM.get('stores["'+k+'"]', true);
|
||||||
var row = $('div#outfit_row_' + k.replace(' ', '-'), outfit);
|
var row = $('div#outfit_row_' + k.replace(' ', '-'), outfit);
|
||||||
if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
|
if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
|
||||||
total += num * Path.getWeight(k);
|
currentBagCapacity += num * Path.getWeight(k);
|
||||||
if(row.length === 0) {
|
if(row.length === 0) {
|
||||||
row = Path.createOutfittingRow(k, num, store, store.name);
|
row = Path.createOutfittingRow(k, num, store, store.name);
|
||||||
|
|
||||||
@@ -225,14 +224,20 @@ var Path = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Path.updateBagSpace(currentBagCapacity);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
updateBagSpace: function(currentBagCapacity) {
|
||||||
// Update bagspace
|
// Update bagspace
|
||||||
$('#bagspace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - total) , Path.getCapacity()));
|
$('#bagspace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - currentBagCapacity) , Path.getCapacity()));
|
||||||
|
|
||||||
if(Path.outfit['cured meat'] > 0) {
|
if(Path.outfit['cured meat'] > 0) {
|
||||||
Button.setDisabled($('#embarkButton'), false);
|
Button.setDisabled($('#embarkButton'), false);
|
||||||
} else {
|
} else {
|
||||||
Button.setDisabled($('#embarkButton'), true);
|
Button.setDisabled($('#embarkButton'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createOutfittingRow: function(key, num, store) {
|
createOutfittingRow: function(key, num, store) {
|
||||||
|
|||||||
Reference in New Issue
Block a user