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

Function setMapSelectionSingleTile

src/OpenLoco/src/Map/MapSelection.cpp:86–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84 }
85
86 uint16_t setMapSelectionSingleTile(const Pos2& loc, bool setQuadrant)
87 {
88 uint16_t xPos = loc.x & 0xFFE0;
89 uint16_t yPos = loc.y & 0xFFE0;
90 MapSelectionType cursorQuadrant = getQuadrantOrCentreFromPos(loc);
91
92 auto count = 0;
93 if (!World::hasMapSelectionFlag(World::MapSelectionFlags::enable))
94 {
95 World::setMapSelectionFlags(World::MapSelectionFlags::enable);
96 count++;
97 }
98
99 if (setQuadrant && _mapSelectionType != cursorQuadrant)
100 {
101 _mapSelectionType = cursorQuadrant;
102 count++;
103 }
104 else if (!setQuadrant && _mapSelectionType != MapSelectionType::full)
105 {
106 _mapSelectionType = MapSelectionType::full;
107 count++;
108 }
109
110 if (xPos != _mapSelectionAX)
111 {
112 _mapSelectionAX = xPos;
113 count++;
114 }
115
116 if (yPos != _mapSelectionAY)
117 {
118 _mapSelectionAY = yPos;
119 count++;
120 }
121
122 if (xPos != _mapSelectionBX)
123 {
124 _mapSelectionBX = xPos;
125 count++;
126 }
127
128 if (yPos != _mapSelectionBY)
129 {
130 _mapSelectionBY = yPos;
131 count++;
132 }
133
134 mapInvalidateSelectionRect();
135
136 return count;
137 }
138
139 // 0x004610F2
140 void mapInvalidateSelectionRect()

Callers 2

onAdjustLandToolUpdateFunction · 0.85
onToolUpdateFunction · 0.85

Calls 4

hasMapSelectionFlagFunction · 0.85
setMapSelectionFlagsFunction · 0.85

Tested by 1

onToolUpdateFunction · 0.68