--- deliantra/server/common/los.C 2009/11/04 18:17:57 1.65 +++ deliantra/server/common/los.C 2009/11/29 17:41:07 1.67 @@ -34,6 +34,10 @@ FLG_QUEUED = 0x80 // already queued in queue, or border }; +// it is important for performance reasons that this structure +// has a size easily computable by the cpu (*8 is perfect). +// it is possible to move culled and visible into flags, at +// some speed loss. struct los_info { uint8 flags; // FLG_xxx @@ -83,7 +87,7 @@ l.flags |= flags; - if (l.flags & FLG_QUEUED) + if (expect_false (l.flags & FLG_QUEUED)) return; l.flags |= FLG_QUEUED; @@ -303,26 +307,29 @@ } } los_init; -// brighten area, ignore los -sint8 -los_brighten_nolos (sint8 b, sint8 l) -{ - return min (b, l); -} +// the following functions cannot be static, due to c++ stupidity :/ +namespace { + // brighten area, ignore los + sint8 + los_brighten_nolos (sint8 b, sint8 l) + { + return min (b, l); + } -// brighten area, but respect los -sint8 -los_brighten (sint8 b, sint8 l) -{ - return b == LOS_BLOCKED ? b : min (b, l); -} + // brighten area, but respect los + sint8 + los_brighten (sint8 b, sint8 l) + { + return b == LOS_BLOCKED ? b : min (b, l); + } -// darken area, respect los -sint8 -los_darken (sint8 b, sint8 l) -{ - return max (b, l); -} + // darken area, respect los + sint8 + los_darken (sint8 b, sint8 l) + { + return max (b, l); + } +}; template static void