public void MergeBanklogs(Banklog[] b) { int i; System.Collections.Generic.List<Banklog> t = new System.Collections.Generic.List<Banklog>(this.banklog); if (!System.Object.ReferenceEquals(this, b)) { for (i = 0; i < b.Length; i++) { if (!t.Contains(b[i])) t.Add(b[i]); } } this.banklog = t.ToArray(); }
public bool AddTransaction(Banklog transaction) { //Double check that this is the right player. if (transaction.player != player) return false; //Update the values numberOfTransactions++; if(transaction.ts > lastTransaction) lastTransaction = transaction.ts; //Process the transaction switch (transaction.type) { case (int)TransactionType.DepositMoney: dMoney += transaction.money; break; case (int)TransactionType.WithdrawMoney: wMoney += transaction.money; break; case (int)TransactionType.DepositItem: dItem++; karma += getItemWeight(transaction.item[0].type, transaction.item[0].subtype, transaction.item[0].id); break; case (int)TransactionType.WithdrawItem: wItem++; karma -= getItemWeight(transaction.item[0].type, transaction.item[0].subtype, transaction.item[0].id); break; case (int)TransactionType.Repair: rMoney += transaction.money; break; case (int)TransactionType.Move: break; } //Add to log //bankLog.Add(transaction.ts, transaction); return true; }