From 42ff0f7c586b6700dea7729e9f4e1fa5bd42fc96 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Wed, 1 Jan 2020 23:55:01 +0300 Subject: bug fixes --- src/core/ZoneCull.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index 6d33a1cf..6b04c213 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -134,14 +134,16 @@ CCullZones::FindAttributesForCoors(CVector coors, int32 *wantedLevel) int i; int32 attribs; + if (wantedLevel) + *wantedLevel = 0; attribs = 0; for(i = 0; i < NumAttributeZones; i++) if(coors.x >= aAttributeZones[i].minx && coors.x <= aAttributeZones[i].maxx && coors.y >= aAttributeZones[i].miny && coors.y <= aAttributeZones[i].maxy && coors.z >= aAttributeZones[i].minz && coors.z <= aAttributeZones[i].maxz){ attribs |= aAttributeZones[i].attributes; - if(wantedLevel && *wantedLevel <= aAttributeZones[i].wantedLevel) - *wantedLevel = aAttributeZones[i].wantedLevel; + if(wantedLevel) + *wantedLevel = max(*wantedLevel, aAttributeZones[i].wantedLevel); } return attribs; } -- cgit v1.2.3