Context for known donation history error
parent
bb36014f55
commit
d7ec66131d
|
@ -1,6 +1,7 @@
|
||||||
import WindowManager from "./windowManager.js";
|
import WindowManager from "./windowManager.js";
|
||||||
import { getVar } from "./gameInterface.js";
|
import { getVar } from "./gameInterface.js";
|
||||||
import { escapeHtml } from "./utils.js";
|
import { escapeHtml } from "./utils.js";
|
||||||
|
import { debugWithContext } from "./debugging.js";
|
||||||
|
|
||||||
WindowManager.add({
|
WindowManager.add({
|
||||||
name: "donationHistory",
|
name: "donationHistory",
|
||||||
|
@ -16,10 +17,16 @@ const donationsTracker = new (function(){
|
||||||
this.donationHistory = Array(512);
|
this.donationHistory = Array(512);
|
||||||
// fill the array with empty arrays with length of 3
|
// fill the array with empty arrays with length of 3
|
||||||
//for (var i = 0; i < 512; i++) this.donationHistory.push([]); // not needed as .reset is called on game start
|
//for (var i = 0; i < 512; i++) this.donationHistory.push([]); // not needed as .reset is called on game start
|
||||||
this.getHistoryOf = function(playerID) {
|
let resetCalled = false;
|
||||||
return this.donationHistory[playerID].toReversed();
|
this.getHistoryOf = function (playerID) {
|
||||||
|
return debugWithContext(() => this.donationHistory[playerID].toReversed(), {
|
||||||
|
playerID,
|
||||||
|
resetCalled,
|
||||||
|
type: typeof this.donationHistory[playerID],
|
||||||
|
isArray: Array.isArray(this.donationHistory[playerID])
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.reset = function() { for (var i = 0; i < 512; i++) this.donationHistory[i] = []; };
|
this.reset = function() { resetCalled = true; for (var i = 0; i < 512; i++) this.donationHistory[i] = []; };
|
||||||
this.logDonation = function(senderID, receiverID, amount) {
|
this.logDonation = function(senderID, receiverID, amount) {
|
||||||
const donationInfo = [senderID, receiverID, amount];
|
const donationInfo = [senderID, receiverID, amount];
|
||||||
this.donationHistory[receiverID].push(donationInfo);
|
this.donationHistory[receiverID].push(donationInfo);
|
||||||
|
|
Loading…
Reference in New Issue