Permalink
Browse files

Remove unused variables and make them fatal in lint.

  • Loading branch information...
1 parent d25e55e commit 626ff0b537c498693211703cfd1bdcf21b149df7 @kpreid committed Jul 29, 2012
Showing with 13 additions and 27 deletions.
  1. +0 −5 audio.js
  2. +0 −2 blockset.js
  3. +2 −0 body.js
  4. +0 −3 input.js
  5. +1 −4 player.js
  6. +1 −1 test/test-special.js
  7. +1 −0 util.js
  8. +3 −3 world-gen.js
  9. +5 −8 world-render.js
  10. +0 −1 world.js
View
@@ -33,11 +33,6 @@
footstep: [0.18, 0.1, 0, true, 1],
become: [0.05, 0.1, 0, false, 0.2]
};
-
- // argument is time in wavelengths
- function square(t) {
- return Math.floor(t % 1 * 2);
- }
function SynthData(type) {
var blockWorld = type.world;
View
@@ -385,7 +385,6 @@
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.bindTexture(gl.TEXTURE_2D, null);
- var blockTextureData;
var tileAllocMap;
var freePointer;
var usageMap;
@@ -713,7 +712,6 @@
iconTodoSet[toRerenderIcon.value] = true;
start = true;
}
- var nonempty = false;
if (!iconRendererInterval) {
iconRendererInterval = window.setInterval(function () {
for (var idStr in iconTodoSet) {
View
@@ -262,5 +262,7 @@
}
};
+ Body.GRAVITY = GRAVITY;
+
cubes.Body = Object.freeze(Body);
}());
View
@@ -4,7 +4,6 @@
(function () {
"use strict";
- var Circuit = cubes.Circuit;
var exponentialStep = cubes.util.exponentialStep;
var mkelement = cubes.util.mkelement;
var signum = cubes.util.signum;
@@ -993,8 +992,6 @@
clearChildren(hud.blocksetAll);
forAllMenuBlocks(function (blockID) {
- var blockType = blocksetInMenu.get(blockID);
-
// element structure and style
var item = menuItemsByBlockId[blockID] = mkelement("span", "menu-item");
View
@@ -25,9 +25,7 @@
// physics constants
var WALKING_SPEED = 4; // cubes/s
var FLYING_SPEED = 10; // cubes/s
- var GRAVITY = 20; // cubes/s^2
var JUMP_SPEED = 8; // cubes/s
- var MAX_STEP_UP = 0.57; // cubes
var CONTROL_STIFFNESS = 0.18;
var AIRSTEER_STIFFNESS = 0.03;
@@ -273,7 +271,7 @@
body.addVelocity([
(movAdj[0] - body.vel[0]) * stiffness,
body.flying ? (movAdj[1] - body.vel[1]) * stiffness
- : movAdj[1] !== 0 ? (movAdj[1] - body.vel[1]) * stiffness + timestep * GRAVITY : 0,
+ : movAdj[1] !== 0 ? (movAdj[1] - body.vel[1]) * stiffness + timestep * Body.GRAVITY : 0,
(movAdj[2] - body.vel[2]) * stiffness]);
if (config.lighting.get()) {
@@ -553,7 +551,6 @@
var cube = currentPlace.cursor.cube;
var x = cube[0], y = cube[1], z = cube[2];
if (currentPlace.world.g(x,y,z) !== 0 /* i.e. would destruction do anything */) {
- var value = currentPlace.world.g(x,y,z);
currentPlace.world.transientEvent(cube, "destroy");
currentPlace.world.s(x, y, z, 0);
aimChanged();
View
@@ -72,7 +72,7 @@ describe("Source code", function () {
testFiles.forEach(function (jsFilename) {
fetchResource(jsFilename, "text", runscallback(jsFilename, 1000, function (jsSource) {
var res = JSHINT(jsSource, jshintOptions);
- if (!res) {
+ if (!res || JSHINT.data().unused) {
failures++
var container = mkelement("div", "jshint-report");
container.innerHTML/*ew*/ = JSHINT.report(true);
View
@@ -36,6 +36,7 @@
failures += nullError;
} else {
for (var p in nullo) {
+ /*jshint expr: true */ p;
failures += nullError;
break;
}
View
@@ -800,7 +800,7 @@
// Using raw array access because it lets us cache the altitude computation by iterating over y last, not because the overhead of .edit() is especially high.
var raw = topWorld.raw;
var rawSubData = topWorld.rawSubData;
- var t0 = Date.now();
+ //var t0 = Date.now();
for (var x = 0; x < wx; x++) {
var xbase = x*wy*wz;
for (var z = 0; z < wz; z++) {
@@ -825,9 +825,9 @@
}
}
}
- var t1 = Date.now();
+ //var t1 = Date.now();
topWorld.notifyRawEdit();
- var t2 = Date.now();
+ //var t2 = Date.now();
//console.log("Generation", t1 - t0, "ms updating", t2 - t1, "ms");
}
View
@@ -107,7 +107,6 @@
// Cached blockset characteristics
var tileSize = blockset.tileSize;
- var pixelSize = 1/tileSize;
var ID_EMPTY = Blockset.ID_EMPTY;
var particles = [];
@@ -583,7 +582,6 @@
var rotIndex = rawRotations[rawIndex];
var rot = rotationsByCode[rotIndex];
- var btype = types[value];
var faceData = (rotatedBlockFaceData[value] || BOGUS_BLOCK_DATA)[rotIndex];
thisOpaque = opaques[value];
@@ -721,7 +719,7 @@
}
var CENTER = [0.5, 0.5, 0.5];
- var CYL_RADIUS = round(0.08 * tileSize) / tileSize;
+ var beamRadius = round(0.08 * tileSize) / tileSize;
function makeCircuitRenderer(circuit) {
var dyns;
var circuitRenderer = new renderer.RenderBundle(gl.TRIANGLES, null, function (vertices, normals, colors) {
@@ -730,13 +728,12 @@
var net = record[0];
var fromBlock = record[1];
var block = record[2];
-
- var vbase = vertices.length;
+
var cbase = colors.length;
var numVertices = calcCylinder(
- vec3.add(record[1], CENTER, vec3.create()),
- vec3.add(record[2], CENTER, vec3.create()),
- 0.1,
+ vec3.add(fromBlock, CENTER, vec3.create()),
+ vec3.add(block, CENTER, vec3.create()),
+ beamRadius,
vertices, normals);
for (var i = 0; i < numVertices; i++)
colors.push(1,1,1,1);
View
@@ -523,7 +523,6 @@
var x = Math.floor(Math.random() * wx);
var y = Math.floor(Math.random() * wy);
var z = Math.floor(Math.random() * wz);
- var index = x*wy*wz + y*wz + z;
// The input value given is chosen so that if you want a rate of k, you can
// multiply k*value to get the chance you should do your thing.

0 comments on commit 626ff0b

Please sign in to comment.