Skip to content

Commit 66ecb79

Browse files
committed
Fixed switch statement to include breaks for flow control.
1 parent 6f884c3 commit 66ecb79

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

status.creep.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,21 @@ module.exports = {
108108
let time = 0;
109109
const terrain = creepToCalculate.room.getTerrain();
110110
for (let each in creepToCalculate.pos.findPathTo(creepToCalculate.pos.findClosestByPath(FIND_MY_SPAWNS))){
111+
// noinspection JSUnfilteredForInLoop
111112
if (creepToCalculate.room.getPositionAt(each.x, each.y).lookFor(LOOK_STRUCTURES)[0].structureType === STRUCTURE_ROAD) {
112113
time += (weight * 1) - (movement * 2);
113114
}
114115
else {
116+
// noinspection JSUnfilteredForInLoop
115117
switch (terrain.get(each.x, each.y)) {
116-
case TERRAIN_MASK_WALL:
117-
return -1;
118118
case TERRAIN_MASK_SWAMP:
119119
time += (weight * 10) - (movement * 2);
120+
break;
120121
case 0:
121122
time += (weight * 2) - (movement * 2);
123+
break;
124+
default:
125+
return -1;
122126
}
123127
}
124128
}

0 commit comments

Comments
 (0)