Save the state of the path outfit in the State object.

Load the state when initialising the path screen. When embarking, make sure to clear the state. On arrival, update the saved state.

This enables save/load of the path state in the save game if it occurs before leaving.
This commit is contained in:
Robert Gravina
2014-12-24 22:57:45 +09:00
parent 4201652e8f
commit 72a83d48dd
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -46,7 +46,7 @@ var Path = {
cooldown: World.DEATH_COOLDOWN
}).appendTo(this.panel);
Path.outfit = {};
Path.outfit = $SM.get('outfit');
Engine.updateSlider();
@@ -269,6 +269,7 @@ var Path = {
var maxExtraByStore = $SM.get('stores["'+supply+'"]', true) - cur;
var maxExtraByBtn = btn.data;
Path.outfit[supply] = cur + Math.min(maxExtraByBtn, Math.min(maxExtraByWeight, maxExtraByStore));
$SM.set('outfit['+supply+']', Path.outfit[supply])
Path.updateOutfitting();
}
},
@@ -280,6 +281,7 @@ var Path = {
cur = typeof cur == 'number' ? cur : 0;
if(cur > 0) {
Path.outfit[supply] = Math.max(0, cur - btn.data);
$SM.set('outfit['+supply+']', Path.outfit[supply])
Path.updateOutfitting();
}
},
@@ -288,6 +290,7 @@ var Path = {
Path.setTitle();
Path.updateOutfitting();
Path.updatePerks(true);
$SM.set('outfit', Path.outfit);
Engine.moveStoresView($('#perks'), transition_diff);
},
@@ -300,6 +303,7 @@ var Path = {
for(var k in Path.outfit) {
$SM.add('stores["'+k+'"]', -Path.outfit[k]);
}
$SM.remove('outfit');
World.onArrival();
$('#outerSlider').animate({left: '-700px'}, 300);
Engine.activeModule = World;
+2 -1
View File
@@ -35,7 +35,8 @@ var StateManager = {
'timers',
'game', //mostly location related: fire temp, workers, population, world map, 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) {