MCPcopy Create free account
hub / github.com/NetHack/NetHack / credit_report

Function credit_report

src/shk.c:627–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625}
626
627void
628credit_report(struct monst *shkp, int idx, boolean silent)
629{
630 struct eshk *eshkp = ESHK(shkp);
631 static long credit_snap[2][3] = {{0L, 0L, 0L}, {0L, 0L, 0L}};
632
633 if (!idx) {
634 credit_snap[BEFORE][0] = credit_snap[NOW][0] = 0L;
635 credit_snap[BEFORE][1] = credit_snap[NOW][1] = 0L;
636 credit_snap[BEFORE][2] = credit_snap[NOW][2] = 0L;
637 } else {
638 idx = 1;
639 }
640
641 credit_snap[idx][0] = eshkp->credit;
642 credit_snap[idx][1] = eshkp->debit;
643 credit_snap[idx][2] = eshkp->loan;
644
645 if (idx && !silent) {
646 long amt = 0L;
647 const char *msg = "debt has increased";
648
649 if (credit_snap[NOW][0] < credit_snap[BEFORE][0]) {
650 amt = credit_snap[BEFORE][0] - credit_snap[NOW][0];
651 msg = "credit has been reduced";
652 } else if (credit_snap[NOW][1] > credit_snap[BEFORE][1]) {
653 amt = credit_snap[NOW][1] - credit_snap[BEFORE][1];
654 } else if (credit_snap[NOW][2] > credit_snap[BEFORE][2]) {
655 amt = credit_snap[NOW][2] - credit_snap[BEFORE][2];
656 }
657 if (amt)
658 Your("%s by %ld %s.", msg, amt, currency(amt));
659
660 }
661}
662
663/* robbery from outside the shop via telekinesis or grappling hook */
664void

Callers 1

scatterFunction · 0.85

Calls 2

YourFunction · 0.85
currencyFunction · 0.85

Tested by

no test coverage detected