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

Function get_soundlib_name

src/sounds.c:1863–1880  ·  view source on GitHub ↗

copy up to maxlen-1 characters; 'dest' must be able to hold maxlen; treat comma as alternate end of 'src' */

Source from the content-addressed store, hash-verified

1861/* copy up to maxlen-1 characters; 'dest' must be able to hold maxlen;
1862 treat comma as alternate end of 'src' */
1863void
1864get_soundlib_name(char *dest, int maxlen)
1865{
1866 int count, idx;
1867 const char *src;
1868
1869 idx = ga.active_soundlib;
1870 if (!IndexOk(idx, soundlib_choices))
1871 panic("get_soundlib_name: invalid active_soundlib (%d)", idx);
1872
1873 src = soundlib_choices[idx].sndprocs->soundname;
1874 for (count = 1; count < maxlen; count++) {
1875 if (*src == ',' || *src == '\0')
1876 break; /*exit on \0 terminator*/
1877 *dest++ = *src++;
1878 }
1879 *dest = '\0';
1880}
1881
1882enum soundlib_ids
1883soundlib_id_from_opt(char *op)

Callers 1

optfn_soundlibFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected