From 4e37103171e538c1b8b05f07e605e277c22d442e Mon Sep 17 00:00:00 2001 From: hun0975 Date: Mon, 4 Dec 2017 15:35:00 +0900 Subject: [PATCH] jshint warning ('cur' is already defined) The "cur" variable is defined twice in each for loop. So I pulled out the definition part of the "cur" variable. --- script/world.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/world.js b/script/world.js index 7c59278..f89e151 100644 --- a/script/world.js +++ b/script/world.js @@ -774,12 +774,13 @@ var World = { var chances = {}; var nonSticky = 1; + var cur; for(var i in adjacent) { if(adjacent[i] == World.TILE.VILLAGE) { // Village must be in a forest to maintain thematic consistency, yo. return World.TILE.FOREST; } else if(typeof adjacent[i] == 'string') { - var cur = chances[adjacent[i]]; + cur = chances[adjacent[i]]; cur = typeof cur == 'number' ? cur : 0; chances[adjacent[i]] = cur + World.STICKINESS; nonSticky -= World.STICKINESS; @@ -788,7 +789,7 @@ var World = { for(var t in World.TILE) { var tile = World.TILE[t]; if(World.isTerrain(tile)) { - var cur = chances[tile]; + cur = chances[tile]; cur = typeof cur == 'number' ? cur : 0; cur += World.TILE_PROBS[tile] * nonSticky; chances[tile] = cur;