From cf64bba0b77fed3d2e3b38124d43596da9366c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Sun, 16 Apr 2023 16:55:40 +0300 Subject: [PATCH] Add more comments --- src/openrct2/paint/Paint.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 8b3998ed17..fc8ef81318 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -320,6 +320,9 @@ static PaintStruct* PaintStructsFirstInQuadrant(PaintStruct* psNext, uint16_t qu return ps; } +// Initializes sorting flags for all entries in the specified quadrant by quadrantIndex. +// Sorting flags specify whether a node needs to be traversed, is a neighbour, or is outside the +// quadrant range. static void PaintStructsInitializeSort(PaintStruct* ps, uint16_t quadrantIndex, uint8_t flag) { do @@ -346,6 +349,9 @@ static void PaintStructsInitializeSort(PaintStruct* ps, uint16_t quadrantIndex, } while (ps->QuadrantIndex <= quadrantIndex + 1); } +// Returns a pair of parent and child where child is the next node that requires traversal. +// Because this structure uses a singly linked list we need to keep track of the parent in order +// to be able to re-order the list. static std::pair PaintStructsGetNextPending(PaintStruct* ps) { PaintStruct* ps_next; @@ -372,6 +378,8 @@ static std::pair PaintStructsGetNextPending(PaintStr return { ps, ps_next }; } +// Re-orders all nodes after the specified child node and marks the child node as traversed. The resulting +// order of the children is the depth based on rotation and dimensions of the bounding box. template static void PaintStructsSortQuadrant(PaintStruct* parent, PaintStruct* child) { // Mark visited.