MCPcopy Index your code
hub / github.com/NetHack/NetHack / tmp_at

Function tmp_at

src/display.c:1173–1296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1171} tgfirst;
1172
1173void
1174tmp_at(coordxy x, coordxy y)
1175{
1176 static struct tmp_glyph *tglyph = (struct tmp_glyph *) 0;
1177 struct tmp_glyph *tmp;
1178
1179 switch (x) {
1180 case DISP_BEAM:
1181 case DISP_ALL:
1182 case DISP_TETHER:
1183 case DISP_FLASH:
1184 case DISP_ALWAYS:
1185 if (!tglyph)
1186 tmp = &tgfirst;
1187 else /* nested effect; we need dynamic memory */
1188 tmp = (struct tmp_glyph *) alloc(sizeof *tmp);
1189 tmp->prev = tglyph;
1190 tglyph = tmp;
1191 tglyph->sidx = 0;
1192 tglyph->style = x;
1193 tglyph->glyph = y;
1194 flush_screen(0); /* flush buffered glyphs */
1195 return;
1196
1197 case DISP_FREEMEM: /* in case game ends with tmp_at() in progress */
1198 while (tglyph) {
1199 tmp = tglyph->prev;
1200 if (tglyph != &tgfirst)
1201 free((genericptr_t) tglyph);
1202 tglyph = tmp;
1203 }
1204 return;
1205
1206 default:
1207 break;
1208 }
1209
1210 if (!tglyph) {
1211 panic("tmp_at: tglyph not initialized");
1212 } else {
1213 switch (x) {
1214 case DISP_CHANGE:
1215 tglyph->glyph = y;
1216 break;
1217
1218 case DISP_END:
1219 if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) {
1220 int i;
1221
1222 /* Erase (reset) from source to end */
1223 for (i = 0; i < tglyph->sidx; i++)
1224 newsym(tglyph->saved[i].x, tglyph->saved[i].y);
1225 } else if (tglyph->style == DISP_TETHER) {
1226 int i;
1227
1228 if (y == BACKTRACK && tglyph->sidx > 1) {
1229 /* backtrack */
1230 for (i = tglyph->sidx - 1; i > 0; i--) {

Callers 15

mongrantswishFunction · 0.85
foundoneFunction · 0.85
finditFunction · 0.85
start_engulfFunction · 0.85
end_engulfFunction · 0.85
findtravelpathFunction · 0.85
zap_digFunction · 0.85
sho_obj_return_to_uFunction · 0.85
throwitFunction · 0.85
launch_objFunction · 0.85
bhitFunction · 0.85
boomhitFunction · 0.85

Calls 7

flush_screenFunction · 0.85
newsymFunction · 0.85
show_glyphFunction · 0.85
isokFunction · 0.85
tether_glyphFunction · 0.85
allocFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected