Fix obj_can_hear_obj implementation
This commit is contained in:
parent
db57fe6a5e
commit
8a5c3bc97b
|
@ -2622,9 +2622,10 @@ static void opObjectCanHearObject(Program* program)
|
||||||
|
|
||||||
bool canHear = false;
|
bool canHear = false;
|
||||||
|
|
||||||
// FIXME: This is clearly an error. If any of the object is NULL
|
// SFALL: Fix broken implementation.
|
||||||
// dereferencing will crash the game.
|
// CE: In Sfall this fix is available under "ObjCanHearObjFix" switch and
|
||||||
if (object2 == NULL || object1 == NULL) {
|
// it's not enabled by default. Probably needs testing.
|
||||||
|
if (object2 != nullptr && object1 != nullptr) {
|
||||||
if (object2->elevation == object1->elevation) {
|
if (object2->elevation == object1->elevation) {
|
||||||
if (object2->tile != -1 && object1->tile != -1) {
|
if (object2->tile != -1 && object1->tile != -1) {
|
||||||
if (isWithinPerception(object2, object1)) {
|
if (isWithinPerception(object2, object1)) {
|
||||||
|
|
Loading…
Reference in New Issue