MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / add

Method add

Descent3/hudmessage.cpp:1550–1577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1548}
1549
1550bool tMsgList::add(const char *msg, uint8_t lvl, uint8_t hr, uint8_t min, uint8_t sec) {
1551 char buf[2048];
1552
1553 if (!m_limit)
1554 m_limit = 64;
1555
1556 if (m_msg == NULL) {
1557 m_msg = (char **)mem_malloc(sizeof(char *) * m_limit);
1558 m_nmsg = 0;
1559 }
1560
1561 if (m_nmsg == m_limit && m_nmsg > 0) {
1562 int i;
1563 mem_free(m_msg[0]);
1564 for (i = 1; i < m_nmsg; i++)
1565 m_msg[i - 1] = m_msg[i];
1566 m_nmsg--;
1567 }
1568
1569 if (lvl > 0) {
1570 snprintf(buf, sizeof(buf), "[%d.%d.%d.%d] %s", lvl, hr, min, sec, msg);
1571 m_msg[m_nmsg++] = mem_strdup(buf);
1572 } else {
1573 m_msg[m_nmsg++] = mem_strdup(msg);
1574 }
1575
1576 return true;
1577}
1578
1579void tMsgList::reset() {
1580 if (m_msg) {

Callers 3

AddMessageToRollbackFunction · 0.45
AddGameMessageFunction · 0.45
LGSGameMessagesFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected