--- deliantra/server/socket/sounds.C 2006/09/16 22:24:13 1.5 +++ deliantra/server/socket/sounds.C 2006/12/13 21:27:09 1.6 @@ -25,10 +25,10 @@ play_sound_player_only (player *pl, short soundnum, sint8 x, sint8 y) { char soundtype; - SockList sl; if (!pl->socket.sound) return; + /* Do some quick conversion to the sound type we want. */ if (soundnum >= SOUND_CAST_SPELL_0) { @@ -38,15 +38,16 @@ else soundtype = SOUND_NORMAL; - sl.buf = (unsigned char *) malloc (MAXSOCKBUF); - strcpy ((char *) sl.buf, "sound "); - sl.len = strlen ((char *) sl.buf); - SockList_AddChar (&sl, x); - SockList_AddChar (&sl, y); - SockList_AddShort (&sl, soundnum); - SockList_AddChar (&sl, soundtype); + SockList sl (MAXSOCKBUF); + + sl << "sound " + << uint8 (x) + << uint8 (y) + << uint16 (soundnum) + << uint8 (soundtype); + Send_With_Handling (&pl->socket, &sl); - free (sl.buf); + sl.free (); } #define POW2(x) ((x) * (x))