Some refactoring and some bug fixes.

This commit is contained in:
Michael
2013-11-01 23:00:51 -04:00
parent d8f6e73c6b
commit 994f01c78c
8 changed files with 177 additions and 242 deletions
+9 -44
View File
@@ -28,15 +28,15 @@ var StateManager = {
//create categories
var cats = [
'features', //big features like buildings, location availability, unlocks, etc
'stores', //little stuff, items, weapons, etc
'character', //this is for player's character stats such as perks
'income',
'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
];
'features', //big features like buildings, location availability, unlocks, etc
'stores', //little stuff, items, weapons, etc
'character', //this is for player's character stats such as perks
'income',
'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
];
for(var which in cats) {
if(!$SM.get(cats[which])) $SM.set(cats[which], {});
@@ -190,41 +190,6 @@ var StateManager = {
};
},
getStores: function() {
var stores = [
$SM.get('stores["wood"]'),
$SM.get('stores["fur"]'),
$SM.get('stores["meat"]'),
$SM.get('stores["iron"]'),
$SM.get('stores["coal"]'),
$SM.get('stores["sulphur"]'),
$SM.get('stores["steel"]'),
$SM.get('stores["cured meat"]'),
$SM.get('stores["scales"]'),
$SM.get('stores["teeth"]'),
$SM.get('stores["leather"]'),
$SM.get('stores["bait"]'),
$SM.get('stores["torch"]'),
$SM.get('stores["cloth"]'),
$SM.get('stores["bone spear"]'),
$SM.get('stores["iron sword"]'),
$SM.get('stores["steel sword"]'),
$SM.get('stores["bayonet"]'),
$SM.get('stores["rifle"]'),
$SM.get('stores["laser rifle"]'),
$SM.get('stores["bullets"]'),
$SM.get('stores["energy cell"]'),
$SM.get('stores["grenade"]'),
$SM.get('stores["bolas"]')
];
for (var n = 0; n <= 23; n++) {
if (isNaN(stores[n])) {
stores[n] = 0;
}
}
return stores;
},
//creates full reference from input
//hopefully this won't ever need to be more complicated
buildPath: function(input){