MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / invalidate

Method invalidate

src/OpenLoco/src/Graphics/InvalidationGrid.cpp:44–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 }
43
44 void InvalidationGrid::invalidate(int32_t left, int32_t top, int32_t right, int32_t bottom) noexcept
45 {
46 left = std::max(left, 0);
47 top = std::max(top, 0);
48 right = std::min(right, static_cast<int32_t>(_screenWidth));
49 bottom = std::min(bottom, static_cast<int32_t>(_screenHeight));
50
51 if (left >= right)
52 {
53 return;
54 }
55 if (top >= bottom)
56 {
57 return;
58 }
59
60 left /= _blockWidth;
61 right /= _blockWidth;
62
63 top /= _blockHeight;
64 bottom /= _blockHeight;
65
66 // TODO: Remove this once _blocks is no longer interop wrapper.
67 auto& blocks = _blocks;
68
69 const auto columnSize = right - left + 1;
70
71 for (int16_t y = top; y <= bottom; y++)
72 {
73 const auto yOffset = y * _columnCount;
74
75 // Mark row by column size as invalidated.
76 std::fill_n(blocks.begin() + yOffset + left, columnSize, 0xFF);
77 }
78 }
79
80}

Callers 11

invalidateRegionMethod · 0.45
createAirportFunction · 0.45
loc_49372FFunction · 0.45
removeTrainStationFunction · 0.45
createTrainStationFunction · 0.45
removePortFunction · 0.45
createPortFunction · 0.45
aiTrackReplacementFunction · 0.45
createRoadStationFunction · 0.45
createRoadFunction · 0.45
removeRoadStationFunction · 0.45

Calls 1

beginMethod · 0.45

Tested by

no test coverage detected