Browse Source

Only allowing increased bets to override previous ones.

master
Uno Polak 11 years ago
parent
commit
b2743627d3
  1. 5
      lib/currency.js

5
lib/currency.js

@ -1402,20 +1402,17 @@ Currency.prototype.collect_bets = function (caller, bet, amount) {
for (var i = 0; i < __self.bets_viewers.length; i++) {
if (__self.bets_viewers[i].viewer === caller) {
has_bet = true;
if (amount > __self.bets_viewers[i].amount) {
__self.bets_board[__self.bets_viewers[i].bet].num -= 1;
__self.bets_board[__self.bets_viewers[i].bet].total -= __self.bets_viewers[i].amount;
__self.bets_viewers[i].bet = bet.idx;
__self.bets_viewers[i].amount = amount;
if (amount >= 1) {
__self.bets_board[bet.idx].num += 1;
__self.bets_board[bet.idx].total += amount;
// add flood users to array
if (__self.bets_flood.indexOf(i) < 0) {
__self.bets_flood.push(i);
}
// remove from flood if nullified bet
} else if (__self.bets_flood.indexOf(i) > 0) {
__self.bets_flood.splice(__self.bets_flood.indexOf(i), 1);
}
break;
}

Loading…
Cancel
Save