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.10 by root, Thu Dec 21 23:37:06 2006 UTC vs.
Revision 1.12 by root, Mon Jan 15 01:39:42 2007 UTC

47 << uint8 (soundtype); 47 << uint8 (soundtype);
48 48
49 pl->ns->send_packet (sl); 49 pl->ns->send_packet (sl);
50} 50}
51 51
52#define POW2(x) ((x) * (x))
53
54/** Plays some sound on map at x,y. */ 52/** Plays some sound on map at x,y. */
55void 53void
56play_sound_map (maptile *map, int x, int y, short sound_num) 54play_sound_map (maptile *map, int x, int y, short sound_num)
57{ 55{
58 player *pl;
59
60 if (sound_num >= NROF_SOUNDS) 56 if (sound_num >= NROF_SOUNDS)
61 { 57 {
62 LOG (llevError, "Tried to play an invalid sound num: %d\n", sound_num); 58 LOG (llevError, "Tried to play an invalid sound num: %d\n", sound_num);
63 return; 59 return;
64 } 60 }
65 61
66 for (pl = first_player; pl; pl = pl->next) 62 for_all_players (pl)
67 { 63 {
68 if (pl->ob->map == map) 64 if (pl->ob->map == map)
69 { 65 {
70 int distance = isqrt (POW2 (pl->ob->x - x) + POW2 (pl->ob->y - y)); 66 int distance = idistance (pl->ob->x - x, pl->ob->y - y);
71 67
72 if (distance <= MAX_SOUND_DISTANCE) 68 if (distance <= MAX_SOUND_DISTANCE)
73 {
74 play_sound_player_only (pl, sound_num, (sint8) (x - pl->ob->x), (sint8) (y - pl->ob->y)); 69 play_sound_player_only (pl, sound_num, x - pl->ob->x, y - pl->ob->y);
75 }
76 } 70 }
77 } 71 }
78} 72}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines