MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CL_CheckSVStringEdRef

Function CL_CheckSVStringEdRef

codemp/client/cl_main.cpp:1780–1847  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1778#define MAX_STRINGED_SV_STRING 1024
1779#endif
1780static void CL_CheckSVStringEdRef(char *buf, const char *str)
1781{ //I don't really like doing this. But it utilizes the system that was already in place.
1782 int i = 0;
1783 int b = 0;
1784 int strLen = 0;
1785 qboolean gotStrip = qfalse;
1786
1787 if (!str || !str[0])
1788 {
1789 if (str)
1790 {
1791 strcpy(buf, str);
1792 }
1793 return;
1794 }
1795
1796 strcpy(buf, str);
1797
1798 strLen = strlen(str);
1799
1800 if (strLen >= MAX_STRINGED_SV_STRING)
1801 {
1802 return;
1803 }
1804
1805 while (i < strLen && str[i])
1806 {
1807 gotStrip = qfalse;
1808
1809 if (str[i] == '@' && (i+1) < strLen)
1810 {
1811 if (str[i+1] == '@' && (i+2) < strLen)
1812 {
1813 if (str[i+2] == '@' && (i+3) < strLen)
1814 { //@@@ should mean to insert a stringed reference here, so insert it into buf at the current place
1815 char stripRef[MAX_STRINGED_SV_STRING];
1816 int r = 0;
1817
1818 while (i < strLen && str[i] == '@')
1819 {
1820 i++;
1821 }
1822
1823 while (i < strLen && str[i] && str[i] != ' ' && str[i] != ':' && str[i] != '.' && str[i] != '\n')
1824 {
1825 stripRef[r] = str[i];
1826 r++;
1827 i++;
1828 }
1829 stripRef[r] = 0;
1830
1831 buf[b] = 0;
1832 Q_strcat(buf, MAX_STRINGED_SV_STRING, SE_GetString(va("MP_SVGAME_%s", stripRef)));
1833 b = strlen(buf);
1834 }
1835 }
1836 }
1837

Callers 1

CL_ConnectionlessPacketFunction · 0.70

Calls 3

Q_strcatFunction · 0.85
SE_GetStringFunction · 0.50
vaFunction · 0.50

Tested by

no test coverage detected