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

Function genl_outrip

src/rip.c:85–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void
86genl_outrip(winid tmpwin, int how, time_t when)
87{
88 char **dp;
89 char *dpx;
90 char buf[BUFSZ];
91 int x;
92 int line, year;
93 long cash;
94
95 gr.rip = dp = (char **) alloc(sizeof(rip_txt));
96 for (x = 0; rip_txt[x]; ++x)
97 dp[x] = dupstr(rip_txt[x]);
98 dp[x] = (char *) 0;
99
100 /* Put name on stone */
101 Sprintf(buf, "%.*s", (int) STONE_LINE_LEN, svp.plname);
102 center(NAME_LINE, buf);
103
104 /* Put $ on stone */
105 cash = max(gd.done_money, 0L);
106 /* arbitrary upper limit; practical upper limit is quite a bit less */
107 if (cash > 999999999L)
108 cash = 999999999L;
109 Sprintf(buf, "%ld Au", cash);
110 center(GOLD_LINE, buf);
111
112 /* Put together death description */
113 formatkiller(buf, sizeof buf, how, FALSE);
114
115 /* Put death type on stone */
116 for (line = DEATH_LINE, dpx = buf; line < YEAR_LINE; line++) {
117 char tmpchar;
118 int i, i0 = (int) strlen(dpx);
119
120 if (i0 > STONE_LINE_LEN) {
121 for (i = STONE_LINE_LEN; (i > 0) && (i0 > STONE_LINE_LEN); --i)
122 if (dpx[i] == ' ')
123 i0 = i;
124 if (!i)
125 i0 = STONE_LINE_LEN;
126 }
127 tmpchar = dpx[i0];
128 dpx[i0] = 0;
129 center(line, dpx);
130 if (tmpchar != ' ') {
131 dpx[i0] = tmpchar;
132 dpx = &dpx[i0];
133 } else
134 dpx = &dpx[i0 + 1];
135 }
136
137 /* Put year on stone */
138 year = (int) ((yyyymmdd(when) / 10000L) % 10000L);
139 Sprintf(buf, "%4d", year);
140 center(YEAR_LINE, buf);
141
142#ifdef DUMPLOG

Callers 4

X11_outripFunction · 0.85
amii_outripFunction · 0.85
really_doneFunction · 0.85
mswin_outripFunction · 0.85

Calls 6

dupstrFunction · 0.85
centerFunction · 0.85
formatkillerFunction · 0.85
yyyymmddFunction · 0.85
dump_forward_putstrFunction · 0.85
allocFunction · 0.70

Tested by

no test coverage detected