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

Function mar_putstr_text

outdated/win/gem/wingem1.c:1511–1543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1509 use_rip = TRUE;
1510}
1511void
1512mar_putstr_text(winid window, int attr, const char *str)
1513{
1514 static int zeilen_frei = 0;
1515 int breite;
1516 char *ptr;
1517
1518 window = window;
1519 if (!text_lines) {
1520 text_lines = (char **) m_alloc(12 * sizeof(char *));
1521 zeilen_frei = 12;
1522 }
1523 if (!zeilen_frei) {
1524 text_lines = (char **) realloc(text_lines, (Anz_text_lines + 12)
1525 * sizeof(char *));
1526 zeilen_frei = 12;
1527 }
1528 if (!text_lines) {
1529 mar_raw_print("No room for Text");
1530 return;
1531 }
1532
1533 if (str)
1534 breite = strlen(str);
1535 Min(&breite, 80);
1536 ptr = text_lines[Anz_text_lines] =
1537 (char *) m_alloc(breite * sizeof(char) + 2);
1538 *ptr = (char) (attr + 1); /* avoid 0 */
1539 strncpy(ptr + 1, str, breite);
1540 ptr[breite + 1] = 0;
1541 Anz_text_lines++;
1542 zeilen_frei--;
1543}
1544
1545int
1546mar_set_inv_win(Anzahl, Breite)

Callers 1

Gem_putstrFunction · 0.85

Calls 2

m_allocFunction · 0.85
mar_raw_printFunction · 0.85

Tested by

no test coverage detected