From 85458c47b90c3e90002f4e8354f92527afb8a085 Mon Sep 17 00:00:00 2001 From: Jeremiah Billmann Date: Sat, 6 Jul 2013 14:23:41 -0400 Subject: [PATCH] Moved remove into base --- lib/server/controllers/entitycontroller.js | 7 ++++++- lib/server/controllers/playercontroller.js | 9 --------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/server/controllers/entitycontroller.js b/lib/server/controllers/entitycontroller.js index 6ac0eb1..95b0910 100644 --- a/lib/server/controllers/entitycontroller.js +++ b/lib/server/controllers/entitycontroller.js @@ -25,6 +25,11 @@ EntityController.prototype = { return newEntity; }, remove: function (id) { - + for (var i = 0; i < this.entities.length; i ++) { + if (this.entities[i].id === id) { + this.entities.splice(i, 1)[0]; + return; + } + } } }; \ No newline at end of file diff --git a/lib/server/controllers/playercontroller.js b/lib/server/controllers/playercontroller.js index ec563cc..1591ab1 100644 --- a/lib/server/controllers/playercontroller.js +++ b/lib/server/controllers/playercontroller.js @@ -27,15 +27,6 @@ PlayerController.prototype.add = function (client) { return newPlayer; }; -PlayerController.prototype.remove = function (id) { - for (var i = 0; i < this.entities.length; i ++) { - if (this.entities[i].client.id === id) { - this.entities.splice(i, 1)[0]; - return; - } - } -}; - PlayerController.prototype.addInput = function (id, input, sequence, time) { this.entities.some(function (player) { if (player.client.id === id) {