stop looking at holds after ply 40

This commit is contained in:
Thibault Duplessis 2016-03-21 01:12:35 +07:00
parent 2d62fd798b
commit 49e3bbe029
2 changed files with 3 additions and 3 deletions

View file

@ -55,7 +55,7 @@ module.exports = function(opts) {
var onUserMove = function(orig, dest, meta) {
if (hold.applies(this.data)) {
hold.register(this.socket, meta.holdTime);
hold.register(this.socket, meta.holdTime, this.vm.ply);
if (this.vm.ply > 12 && this.vm.ply <= 14) hold.find(this.vm.element, this.data);
}
if (!promotion.start(this, orig, dest, meta.premove))

View file

@ -2,8 +2,8 @@ var holds = [];
var nb = 8;
var was = false;
function register(socket, hold) {
if (!hold) return;
function register(socket, hold, ply) {
if (!hold || ply > 40) return;
holds.push(hold);
var set = false;
if (holds.length > nb) {