Variable initializion happens in init

This commit is contained in:
pjht 2018-10-14 18:53:56 -05:00
parent b9f86b11c4
commit 7c6be15b1b

36
main.js
View File

@ -1,21 +1,17 @@
var maxPop=0; var maxPop;
var pop=0; var pop;
var working=0; var working;
var resources={}; var resources;
var maxResources=100; var maxResources;
var numResources=0; var numResources;
var buildings={}; var buildings;
var unlockedBuildings=[]; var unlockedBuildings;
var has_shelter=false; var has_shelter;
var researches={}; var researches;
var unlockedResearch=[]; var unlockedResearch;
var research_points=0; var research_points;
var max_research_points=0; var max_research_points;
var workers={ var workers;
lumberjack:0,
miner:0,
scientist:0
};
var all_buildings={ var all_buildings={
hut:{ hut:{
ings:{ ings:{
@ -410,16 +406,18 @@ function reset() {
function init() { function init() {
if (!load()) { if (!load()) {
maxPop=0; maxPop=0;
maxResources=50;
pop=0; pop=0;
working=0; working=0;
resources={}; resources={};
maxResources=100;
numResources=0;
buildings={}; buildings={};
unlockedBuildings=[]; unlockedBuildings=[];
has_shelter=false; has_shelter=false;
researches={}; researches={};
unlockedResearch=[]; unlockedResearch=[];
research_points=0; research_points=0;
max_research_points=0;
workers={ workers={
lumberjack:0, lumberjack:0,
miner:0, miner:0,