Method and property fix

World.testMap() sets World.seenAll. The latter is true when the whole map has been explored.
World.testMap() is called:

* on world init
* on return home (when the map is updated)
* on applyMap() (when the map is bought from the scout)
This commit is contained in:
Andrea Rendine
2016-02-20 13:17:45 +01:00
parent 28cdca6003
commit a3b1fea424
+5 -4
View File
@@ -163,7 +163,7 @@ var World = {
Room.compassTooltip(World.dir);
// Check if everything has been seen
World.seenAll = World.testMap();
World.testMap();
//subscribe to stateUpdates
$.Dispatch('stateUpdate').subscribe(World.handleStateUpdates);
@@ -621,8 +621,8 @@ var World = {
},
testMap: function() {
var dark;
if(!World.seenAll) {
var dark;
var mask = $SM.get('game.world.mask');
loop:
for(var i = 0; i < mask.length; i++) {
@@ -633,8 +633,8 @@ var World = {
}
}
}
World.seenAll = !dark;
}
return !dark;
},
applyMap: function() {
@@ -646,6 +646,7 @@ var World = {
} while (mask[x][y]);
World.uncoverMap(x, y, 5, mask);
}
World.testMap();
},
generateMap: function() {
@@ -897,7 +898,7 @@ var World = {
goHome: function() {
// Home safe! Commit the changes.
$SM.setM('game.world', World.state);
World.seenAll = World.testMap();
World.testMap();
if(World.state.sulphurmine && $SM.get('game.buildings["sulphur mine"]', true) === 0) {
$SM.add('game.buildings["sulphur mine"]', 1);