Merge pull request #196 from rgravina/162_save_path_outfit

Include state of Path outfit in save game
This commit is contained in:
Blake Grotewold
2014-12-24 10:27:40 -06:00
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -46,7 +46,7 @@ var Path = {
cooldown: World.DEATH_COOLDOWN cooldown: World.DEATH_COOLDOWN
}).appendTo(this.panel); }).appendTo(this.panel);
Path.outfit = {}; Path.outfit = $SM.get('outfit');
Engine.updateSlider(); Engine.updateSlider();
@@ -269,6 +269,7 @@ var Path = {
var maxExtraByStore = $SM.get('stores["'+supply+'"]', true) - cur; var maxExtraByStore = $SM.get('stores["'+supply+'"]', true) - cur;
var maxExtraByBtn = btn.data; var maxExtraByBtn = btn.data;
Path.outfit[supply] = cur + Math.min(maxExtraByBtn, Math.min(maxExtraByWeight, maxExtraByStore)); Path.outfit[supply] = cur + Math.min(maxExtraByBtn, Math.min(maxExtraByWeight, maxExtraByStore));
$SM.set('outfit['+supply+']', Path.outfit[supply])
Path.updateOutfitting(); Path.updateOutfitting();
} }
}, },
@@ -280,6 +281,7 @@ var Path = {
cur = typeof cur == 'number' ? cur : 0; cur = typeof cur == 'number' ? cur : 0;
if(cur > 0) { if(cur > 0) {
Path.outfit[supply] = Math.max(0, cur - btn.data); Path.outfit[supply] = Math.max(0, cur - btn.data);
$SM.set('outfit['+supply+']', Path.outfit[supply])
Path.updateOutfitting(); Path.updateOutfitting();
} }
}, },
@@ -288,6 +290,7 @@ var Path = {
Path.setTitle(); Path.setTitle();
Path.updateOutfitting(); Path.updateOutfitting();
Path.updatePerks(true); Path.updatePerks(true);
$SM.set('outfit', Path.outfit);
Engine.moveStoresView($('#perks'), transition_diff); Engine.moveStoresView($('#perks'), transition_diff);
}, },
@@ -300,6 +303,7 @@ var Path = {
for(var k in Path.outfit) { for(var k in Path.outfit) {
$SM.add('stores["'+k+'"]', -Path.outfit[k]); $SM.add('stores["'+k+'"]', -Path.outfit[k]);
} }
$SM.remove('outfit');
World.onArrival(); World.onArrival();
$('#outerSlider').animate({left: '-700px'}, 300); $('#outerSlider').animate({left: '-700px'}, 300);
Engine.activeModule = World; Engine.activeModule = World;
+2 -1
View File
@@ -35,7 +35,8 @@ var StateManager = {
'timers', 'timers',
'game', //mostly location related: fire temp, workers, population, world map, etc 'game', //mostly location related: fire temp, workers, population, world map, etc
'playStats', //anything play related: play time, loads, etc 'playStats', //anything play related: play time, loads, etc
'previous' // prestige, score, trophies (in future), achievements (again, not yet), etc 'previous', // prestige, score, trophies (in future), achievements (again, not yet), etc
'outfit' // used to temporarily store the items to be taken on the path
]; ];
for(var which in cats) { for(var which in cats) {