ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/sounds.C
(Generate patch)

Comparing deliantra/server/socket/sounds.C (file contents):
Revision 1.6 by root, Wed Dec 13 21:27:09 2006 UTC vs.
Revision 1.11 by root, Sat Dec 23 13:56:25 2006 UTC

24void 24void
25play_sound_player_only (player *pl, short soundnum, sint8 x, sint8 y) 25play_sound_player_only (player *pl, short soundnum, sint8 x, sint8 y)
26{ 26{
27 char soundtype; 27 char soundtype;
28 28
29 if (!pl->socket.sound) 29 if (!pl->ns->sound)
30 return; 30 return;
31 31
32 /* Do some quick conversion to the sound type we want. */ 32 /* Do some quick conversion to the sound type we want. */
33 if (soundnum >= SOUND_CAST_SPELL_0) 33 if (soundnum >= SOUND_CAST_SPELL_0)
34 { 34 {
36 soundnum -= SOUND_CAST_SPELL_0; 36 soundnum -= SOUND_CAST_SPELL_0;
37 } 37 }
38 else 38 else
39 soundtype = SOUND_NORMAL; 39 soundtype = SOUND_NORMAL;
40 40
41 SockList sl (MAXSOCKBUF); 41 packet sl;
42 42
43 sl << "sound " 43 sl << "sound "
44 << uint8 (x) 44 << uint8 (x)
45 << uint8 (y) 45 << uint8 (y)
46 << uint16 (soundnum) 46 << uint16 (soundnum)
47 << uint8 (soundtype); 47 << uint8 (soundtype);
48 48
49 Send_With_Handling (&pl->socket, &sl); 49 pl->ns->send_packet (sl);
50 sl.free ();
51} 50}
52 51
53#define POW2(x) ((x) * (x)) 52#define POW2(x) ((x) * (x))
54 53
55/** Plays some sound on map at x,y. */ 54/** Plays some sound on map at x,y. */
56void 55void
57play_sound_map (maptile *map, int x, int y, short sound_num) 56play_sound_map (maptile *map, int x, int y, short sound_num)
58{ 57{
59 player *pl;
60
61 if (sound_num >= NROF_SOUNDS) 58 if (sound_num >= NROF_SOUNDS)
62 { 59 {
63 LOG (llevError, "Tried to play an invalid sound num: %d\n", sound_num); 60 LOG (llevError, "Tried to play an invalid sound num: %d\n", sound_num);
64 return; 61 return;
65 } 62 }
66 63
67 for (pl = first_player; pl; pl = pl->next) 64 for_all_players (pl)
68 { 65 {
69 if (pl->ob->map == map) 66 if (pl->ob->map == map)
70 { 67 {
71 int distance = isqrt (POW2 (pl->ob->x - x) + POW2 (pl->ob->y - y)); 68 int distance = isqrt (POW2 (pl->ob->x - x) + POW2 (pl->ob->y - y));
72 69

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines