diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 3ddc558b..a037d448 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -164,7 +164,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) } case SV_SOUND: - playsound(getint(p), !d ? NULL : d); + playsound(getint(p), d); break; case SV_VOICECOMTEAM: diff --git a/source/src/sound.cpp b/source/src/sound.cpp index 702b3314..e539398d 100644 --- a/source/src/sound.cpp +++ b/source/src/sound.cpp @@ -516,7 +516,8 @@ struct entityreference : worldobjreference const vec ¤tposition() const { - static vec tmp = vec(ent->x, ent->y, ent->z); + static vec tmp; + tmp = vec(ent->x, ent->y, ent->z); return tmp; } @@ -1718,9 +1719,9 @@ location *playsound(int n, const worldobjreference &r, int priority, float offse } void playsound(int n, int priority) { playsound(n, camerareference(), priority); } -void playsound(int n, physent *p, int priority) { playsound(n, physentreference(p), priority); } -void playsound(int n, entity *e, int priority) { playsound(n, entityreference(e), priority); } -void playsound(int n, const vec *v, int priority) { playsound(n, staticreference(*v), priority); } +void playsound(int n, physent *p, int priority) { if(p) playsound(n, physentreference(p), priority); } +void playsound(int n, entity *e, int priority) { if(e) playsound(n, entityreference(e), priority); } +void playsound(int n, const vec *v, int priority) { if(v) playsound(n, staticreference(*v), priority); } void playsoundname(char *s, const vec *loc, int vol) {