Exemplo n.º 1
0
Player.prototype.setBoat = function (contest, request) {

    var options;
    var isCustomLatLong = request && request.latitude && request.longitude && true;
    if (isCustomLatLong) {
        options = {
            latitude: request.latitude,
            longitude: request.longitude
        };
    } else {
        if (contest) {
            options = contest.waypoints[0];
        } else {
            // Set a default latitude / longitude
            options = {
                latitude: 41.68997067878485,
                longitude: -8.824600720709379
            };
        }
        options.latitude = 0.0003 + util.jitter(options.latitude, 0.0001);
        options.longitude = 0.0003 + util.jitter(options.longitude, 0.0001);
    }

    this.boat = new Boat(options);
};
Exemplo n.º 2
0
 function jitterName(name) {
     var val = self[name];
     var jit = self.jitter[name];
     return util.jitter(val, jit);
 }